[Win32 api] Can't show dialog

Hello,

I haven't been programming for a LONG time, today I decided to make a "Dream Journal", however, after I did basics i'm not able to load main dialog, I have everyting just same as my other win32api applications since I have "base.cpp" file where I have that base source code so I don't have to write it all the time, I remember that I had this problem long time ago, but I have no idea how I fixed it, the problem is that when I compile and run program it will just do "beep" and close, here's source code:

http://pastebin.com/8F3LCBgf

and here's source code of working converter (it's almost the same)

http://pastebin.com/bt25DCGu

how I said, after running application it will just do a "beep" (error sound) and close without showing dialog, I've fixed this in my last application, but I have NO IDEA how, also I'm using multi-byte character set

what I remember from last time I had this bug it's that it wasn't able to create dialog, so it failed here:

1
2
3
4
5
6
        if(!hWnd)
        {
                int nResult = GetLastError();
                MessageBox(NULL, "Dialog Creation Failed!", NULL, MB_ICONERROR | MB_OK);
                return 0;
        }
Don't think you are doing this correctly -
HWND hWnd = CreateDialog(hInst, MAKEINTRESOURCE(IDD_DIALOG1), NULL, NULL);

The last parameter should be a pointer to the dialog procedure

Syntax of CreateDialog function:
1
2
3
4
5
6
HWND WINAPI CreateDialog(
  __in_opt  HINSTANCE hInstance,
  __in      LPCTSTR lpTemplate,
  __in_opt  HWND hWndParent,
  __in_opt  DLGPROC lpDialogFunc
);


nope, that's not the error since wndproc is in wndclass, also I;ve tried it and it's not working...
closed account (DSLq5Di1)
Common controls such as the date/time picker need to be initialized:-
http://msdn.microsoft.com/en-us/library/windows/desktop/hh298356
http://msdn.microsoft.com/en-us/library/windows/desktop/bb775507

Rich Edit controls require that you load the library yourself:-
http://msdn.microsoft.com/en-us/library/windows/desktop/hh298375
http://msdn.microsoft.com/en-us/library/windows/desktop/bb787873
oh yea, I forgot to load richedit :X thanks!

date/time picker works even without that initializing btw :)
Last edited on
Topic archived. No new replies allowed.