Recently I've been working on a Click and Create extention and the ease of useing dialogs struck me, so as a side project I started "CK-Prog" for lack of the better name at the time, I planned it to be a simple app that Created a Dialog and that'll be the main window.
But now I've come across a seemingly novice problem, CreateDialog() isn't working, heres the code:
main.cpp -- Sence I very much think the problem is only in main.cpp, I've only put main.cpp source in.
Code:
/*-- CK-Prog
*
*
*
*/
#include "main.h"
int mainProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
{
char hi[100],tmphi[100];
switch(Message)
{
case WM_INITDIALOG:
SetDlgItemText(hwnd, ID_NAME_EB, "ck4r1");
return 0;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case ID_EXIT:
EndDialog(hwnd, ID_EXIT);
break;
case ID_INFO:
MessageBox(NULL,"\tCK-Prog\nCKarl's first real program with WinAPI.\n\n(C) Karl 2004","CK-Prog",MB_OK);
break;
case ID_HELLO: // clicked "Hello!"
GetDlgItemText(hwnd, ID_NAME_EB, tmphi, 100);
//^ Put the edit box text into a tmp buffer
wsprintf(hi,"Hello %s",tmphi);
//^ put the tmp buffer with "Hello" into hi
MessageBox(hwnd, hi,"Hello!",MB_OK);
//^ pops up the MsgBox with your name in it!
break;
}
break;
default:
return 1;
}
return 0;
}
int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,LPSTR lpCmdLine, int nCmdShow)
{
HWND WIN_MAIN = NULL;
WIN_MAIN = CreateDialog(GetModuleHandle(NULL), MAKEINTRESOURCE(ID_MAIN), NULL, mainProc);
if(WIN_MAIN == NULL)
MessageBox(WIN_MAIN, "'WIN_MAIN' did not open correctly!","ERROR!",MB_OK | MB_ICONINFORMATION);
return(0);// no error
}
and if anyone finds other problems that might make it go in a undesireble way, plz post it.
Here is the error:
C:\Programs\CKProg\main.cpp(53) : error C2664: 'CreateDialogParamA' : cannot convert parameter 4 from 'int (void *,unsigned int,unsigned int,long)' to 'int (__stdcall *)(void)'
THX, CK4R1 0U7