NO

Author Topic: CreateDialogParamA API Problem  (Read 3537 times)

halsten

  • Guest
CreateDialogParamA API Problem
« on: May 01, 2008, 12:15:59 PM »
Code: [Select]
hDlgLog = CreateDialogParam(ghInstance, (LPCSTR) DLG_LOG, hTab, DlgLog, 0);

When compiling the previous line it generates the following error:

Code: [Select]
'CreateDialogParamA' : cannot convert parameter 1 from 'void *' to 'struct HINSTANCE__ *'

Any idea on why is it doing that? Thanks in advance.

Offline DMac

  • Member
  • *
  • Posts: 272
Re: CreateDialogParamA API Problem
« Reply #1 on: May 01, 2008, 05:27:29 PM »
WinMain will provide this for you:

Code: [Select]
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:

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

ghInstance = GetModuleHandle(NULL);

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

regards,
DMac
No one cares how much you know,
until they know how much you care.

halsten

  • Guest
Re: CreateDialogParamA API Problem
« Reply #2 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.