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
|
#include <windows.h>
#include <tchar.h>
#include "CustCtrl.h"
#include "resource.h"
BOOL CALLBACK DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
{
switch(msg)
{
case WM_INITDIALOG:
SetDlgItemText(hwnd, IDC_CUSTOM1, _T("Custom Control Practice") );
return TRUE;
case WM_CLOSE:
EndDialog(hwnd, 0);
return TRUE;
case WM_COMMAND:
switch(LOWORD(wParam))
{
case IDCANCEL: case IDOK:
EndDialog(hwnd, 0);
return TRUE;
case IDShowText:
TCHAR tcInput [256];
GetWindowText (hwnd, tcInput, 256);
MessageBox (hwnd, tcInput, "Test message", NULL);
return TRUE;
}
return FALSE;
}
return FALSE;
}
int WINAPI WinMain(HINSTANCE hInst, HINSTANCE hPrev, LPSTR lpCmdLine, int nShowCmd)
{
InitCustomControl();
DialogBox(hInst, MAKEINTRESOURCE(IDD_DIALOG1), 0, DlgProc);
return 0;
}
| |