argh
e come?
Sto provando in questo modo ma non va, CreateDialog mi restituisce NULL
codice:
#include <windows.h>
#include "resource.h"
BOOL CALLBACK DialogProc (HWND hwnd,
UINT message,
WPARAM wParam,
LPARAM lParam);
int WINAPI WinMain
(HINSTANCE hInst, HINSTANCE hPrevInst, char * cmdParam, int cmdShow)
{
HWND hDialog;
MSG msg;
int status;
hDialog = CreateDialog (hInst,
MAKEINTRESOURCE(IDD_MAIN),
NULL,
DialogProc);
if (hDialog==NULL)
{
char buf [100];
wsprintf (buf, "Error x%x", GetLastError ());
MessageBox (0, buf, "CreateDialog", MB_ICONEXCLAMATION | MB_OK);
return 1;
}
while ((status = GetMessage (&msg, 0, 0, 0)) != 0)
{
if (status == -1)
return -1;
if (!IsDialogMessage (hDialog, &msg))
{
TranslateMessage ( &msg );
DispatchMessage ( &msg );
}
}
return msg.wParam;
}
BOOL CALLBACK DialogProc (HWND hwnd,
UINT message,
WPARAM wParam,
LPARAM lParam)
{
switch (message)
{
case WM_INITDIALOG:
MessageBox(hwnd,"ciao","ciao",0);
return TRUE;
case WM_COMMAND:
return TRUE;
case WM_HSCROLL:
return 0;
case WM_DESTROY:
PostQuitMessage(0);
return TRUE;
case WM_CLOSE:
DestroyWindow (hwnd);
return TRUE;
}
return FALSE;
}