| |

VerySource

 Forgot password?
 Register
Search
View: 610|Reply: 1

What's wrong with this code? Why would hwnd return 0x00000000 from CreateDialog, what mistake did I make? How to change

[Copy link]

2

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-1-21 00:40:01
| Show all posts |Read mode
#include <windows.h>
#include <commdlg.h>

#include "resource.h"

BOOL CALLBACK MainDlgProc (HWND, UINT, WPARAM, LPARAM);


int WINAPI WinMain (HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpcmdLine,
int nCmdShow)
{
HWND hwnd;
MSG msg;
Ranch
hwnd = CreateDialog (hInstance, MAKEINTRESOURCE (IDD_TidyMain),
NULL,
MainDlgProc);


ShowWindow (hwnd, SW_SHOW);
UpdateWindow (hwnd);

 while (GetMessage (&msg, NULL, 0,0))
{
TranslateMessage (&msg);
DispatchMessage (&msg);
}
return msg.wParam;
}

BOOL CALLBACK MainDlgProc (HWND hDlg,
                          UINT message,
                          WPARAM wParam,
                          LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
return TRUE;
case WM_COMMAND:
switch (LOWORD (wParam))
{

}

return FALSE;
case WM_CLOSE:
EndDialog (hDlg, 0);
return TRUE;
}

return FALSE;
}
Reply

Use magic Report

0

Threads

36

Posts

22.00

Credits

Newbie

Rank: 1

Credits
22.00

 China

Post time: 2020-1-30 17:18:01
| Show all posts
Is the control used without calling InitCommonControlsEx Function
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list