*sigh* first the menu now the buttons....anyway, this time i can't get a window to display when the button is pressed:
mainprogg.cpp (section)
Code:
LRESULT CALLBACK
WndProc( HWND hWnd, UINT message,
WPARAM wParam, LPARAM lParam )
{
static HWND level_edit;
static HWND button;
switch ( message ) {
case WM_CREATE:
return 0;
case WM_CLOSE:
if(MessageBox (NULL, "Are you sure you want to close the program?\nAll un-saved data will be lost." , "Exiting...", 0 + MB_YESNO + MB_DEFBUTTON2 + MB_ICONQUESTION)==IDYES)
{
PostQuitMessage( 0 );
}
return 0;
case WM_DESTROY:
return 0;
case WM_KEYDOWN:
switch ( wParam ) {
case VK_ESCAPE:
if(MessageBox (NULL, "Are you sure you want to close the program?\nAll un-saved data will be lost." , "Exiting...", 0 + MB_YESNO + MB_DEFBUTTON2 + MB_ICONQUESTION)==IDYES)
{
PostQuitMessage( 0 );
}
return 0;
}
case WM_COMMAND:
switch(LOWORD(wParam))
{
case ID_EXIT:
if(MessageBox (NULL, "Are you sure you want to close the program?\nAll un-saved data will be lost." , "Exiting...", 0 + MB_YESNO + MB_DEFBUTTON2 + MB_ICONQUESTION)==IDYES)
{
PostQuitMessage( 0 );
}
break;
case ID_LVLEDIT:
LvlEdit(hWnd, level_edit, button, GetModuleHandle(0));
break;
return 0;
}
WORD wID,wNotify;
wID=LOWORD(wParam);
wNotify=HIWORD(wParam);
if (lParam)
{
//if a button was clicked
if (wNotify==BN_CLICKED)
{
//if a buttons id was clicked
if (wID==10)
{
LvlEdit(hWnd, level_edit, button, GetModuleHandle(0));
}
}
}
return 0;
windowcall.h
Code:
BOOL LvlEdit(HWND hWnd, HWND level_edit, HWND button, HINSTANCE hInstance )
{
level_edit = CreateWindow(
"LVLEDIT", "Level Editor",
WS_CHILD | WS_CAPTION | WS_VISIBLE,
200, 0, 592, 516,
hWnd, NULL, hInstance, NULL );
button = CreateWindow("BUTTON", "Close", WS_VISIBLE | WS_CHILD | BS_PUSHBUTTON, 528, 0, 64, 24, level_edit,(HMENU) 210, (HINSTANCE) GetWindowLong(hWnd, GWL_HINSTANCE), NULL);
}
not quite sure how much of the mainprog.cpp is actually neccessary, but anyway/.......thanks ahead of time
-psychopath