Pelles C forum

C language => Expert questions => Topic started by: halsten on May 01, 2008, 12:15:59 PM

Title: CreateDialogParamA API Problem
Post by: halsten on May 01, 2008, 12:15:59 PM

hDlgLog = CreateDialogParam(ghInstance, (LPCSTR) DLG_LOG, hTab, DlgLog, 0);


When compiling the previous line it generates the following error:


'CreateDialogParamA' : cannot convert parameter 1 from 'void *' to 'struct HINSTANCE__ *'


Any idea on why is it doing that? Thanks in advance.
Title: Re: CreateDialogParamA API Problem
Post by: DMac on May 01, 2008, 05:27:29 PM
WinMain will provide this for you:


int PASCAL WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpszCmdLine, int nCmdShow)
{
            ghInstance = hInstance;

hDlgLog = CreateDialogParam(ghInstance, (LPCSTR) DLG_LOG, hTab, DlgLog, 0);


In the event that this is not an option you can do the following:


int main(int argc, char *argv[])
{
HINSTANCE ghInstance;

ghInstance = GetModuleHandle(NULL);

hDlgLog = CreateDialogParam(ghInstance, (LPCSTR) DLG_LOG, hTab, DlgLog, 0);


regards,
DMac
Title: Re: CreateDialogParamA API Problem
Post by: halsten on May 01, 2008, 06:10:27 PM
I already had this written in my code. The problem is with the compilation and not what's written.