Results 1 to 2 of 2

Thread: use .rc files in Qt

  1. #1
    Join Date
    Oct 2016
    Posts
    61
    Qt products
    Qt5
    Platforms
    Unix/X11

    Default use .rc files in Qt

    Hello i was trying to use .rc files in Qt using like compiler MinGW and worked. But now i'm trying with visual studio and not seems to work. the code is the follow:
    i add in the .pro file:
    Qt Code:
    1. RC_FILE += resources.rc
    To copy to clipboard, switch view to plain text mode 
    resources.rc:
    Qt Code:
    1. #include <windows.h>
    2. #include "resource.h"
    3.  
    4. PROGRAM RCDATA "C:/Users/moh/Desktop/Example1.exe"
    To copy to clipboard, switch view to plain text mode 

    resource.h:
    Qt Code:
    1. #ifndef RESOURCE_H_INCLUDED
    2. #define RESOURCE_H_INCLUDED
    3.  
    4. #define PROGRAM "PROGRAM"
    5.  
    6. #endif // RESOURCE_H_INCLUDED
    To copy to clipboard, switch view to plain text mode 


    findresource:
    Qt Code:
    1. HRSRC res=FindResourceA(NULL,"PROGRAM",MAKEINTRESOURCEA(PROGRAM));
    To copy to clipboard, switch view to plain text mode 

    return error 1813
    Last edited by SirJonas; 17th February 2017 at 16:25.

  2. #2
    Join Date
    Jan 2008
    Location
    Alameda, CA, USA
    Posts
    5,230
    Thanks
    302
    Thanked 864 Times in 851 Posts
    Qt products
    Qt5
    Platforms
    Windows

    Default Re: use .rc files in Qt

    Your RCDATA definition has the wrong syntax. It should be:

    Qt Code:
    1. PROGRAM RCDATA { "C:/Users/moh/Desktop/Example1.exe\0" }
    To copy to clipboard, switch view to plain text mode 

    In addition, your FindResource call is incorrect. It should be:

    Qt Code:
    1. HRSRC res = FindResourceA( NULL, MAKEINTRESOURCEA(PROGRAM), RT_RCDATA );
    To copy to clipboard, switch view to plain text mode 
    <=== The Great Pumpkin says ===>
    Please use CODE tags when posting source code so it is more readable. Click "Go Advanced" and then the "#" icon to insert the tags. Paste your code between them.

Similar Threads

  1. Replies: 5
    Last Post: 30th October 2012, 09:52
  2. Replies: 1
    Last Post: 16th August 2011, 00:26
  3. Replies: 12
    Last Post: 17th June 2009, 06:34
  4. visual studio project files - adding extra files
    By luf in forum Qt Programming
    Replies: 3
    Last Post: 13th June 2008, 22:05
  5. how to save sequences of text files and sound files
    By nagpalma in forum Qt Programming
    Replies: 8
    Last Post: 3rd July 2007, 01:06

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Digia, Qt and their respective logos are trademarks of Digia Plc in Finland and/or other countries worldwide.