PDA

View Full Version : use .rc files in Qt



SirJonas
17th February 2017, 15:20
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:

RC_FILE += resources.rc
resources.rc:

#include <windows.h>
#include "resource.h"

PROGRAM RCDATA "C:/Users/moh/Desktop/Example1.exe"

resource.h:

#ifndef RESOURCE_H_INCLUDED
#define RESOURCE_H_INCLUDED

#define PROGRAM "PROGRAM"

#endif // RESOURCE_H_INCLUDED


findresource:

HRSRC res=FindResourceA(NULL,"PROGRAM",MAKEINTRESOURCEA(PROGRAM));

return error 1813

d_stranz
18th February 2017, 03:25
Your RCDATA definition has the wrong syntax. It should be:



PROGRAM RCDATA { "C:/Users/moh/Desktop/Example1.exe\0" }


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



HRSRC res = FindResourceA( NULL, MAKEINTRESOURCEA(PROGRAM), RT_RCDATA );