1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67
|
#define WIN32_LEAN_AND_MEAN
#define _WIN32_WINNT 0x0500
#include <windows.h>
#include "resource.h"
HINSTANCE hInst;
BOOL CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
switch(uMsg)
{
case WM_INITDIALOG:
//Blank
return TRUE;
case WM_CLOSE: // If the user clicks the X to close the dialog box
EndDialog(hwndDlg, 0);
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDC_BTN_QUIT:
EndDialog(hwndDlg, 0);
return TRUE;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//MB_ICONINFORMATION is the type of icon displayed in the window that pops up. There is also//
//MB_ICONHAND, MB_ICONSTOP, or MB_ICONERROR - Error Icon //
//MB_ICONQUESTION - Question mark Icon //
//MB_ICONEXCLAMATION or MB_ICONWARNING - Exclamation Icon //
//MB_ICONASTERISK or MB_ICONINFORMATION - Asterisk Icon //
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
case IDC_BTN_TEST:
MessageBox(hwndDlg, "Your computer will now crash because you suck.", "Information", MB_ICONERROR);
return TRUE;
case IDC_BTN_TESTBTN2:
MessageBox(hwndDlg, "Rated Argh for pirates fuck you.", "Information", MB_ICONWARNING);
return TRUE;
case Button:
MessageBox(hwndDlg, "Test Button 2", "Information", MB_ICONINFORMATION);
return TRUE;
case CheckB:
HWND txt = CreateWindowEx( 0,"BUTTON","Check and uncheck me",BS_AUTOCHECKBOX | WS_VISIBLE | S_CHILD, 10,50,170,25, myDialog,(HMENU)checkbox_id,NULL,NULL );
return TRUE;
}
}
return FALSE;
}
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nShowCmd)
{
hInst = hInstance;
// The user interface is a modal dialog box
return DialogBox(hInstance, MAKEINTRESOURCE(DLG_MAIN), NULL, (DLGPROC)DialogProc);
}
|