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
|
CHAR szOtherThing[512];
WCHAR wszDomain[256];
HWND hDomainEdit;
HWND hOtherEdit;
HWND hButton;
#define DOMAIN_EDIT_ID 1019
#define OTHER_EDIT_ID 1020
#define OK_BUTTON_ID 1021
BOOL DialogProc(HWND hDlg, UINT msg, WPARAM wParam, LPARAM lParam) {
if (msg == WM_INIT) {
InitComCtl32();
hDomainEdit = GetDlgItem(hDlg, DOMAIN_EDIT_ID);
hOtherEdit = GetDlgItem(hDlg, OTHER_EDIT_ID);
hButton = GetDlgItem(hDlg, OK_BUTTON_ID);
/*...*/
return FALSE;
} else if (msg == WM_COMMAND) {
WORD wNotifyCode = HIWORD(wParam);
WORD wId = LOWORD(wParam);
if (wId == OK_BUTTON_ID && wNotifyCode == BN_CLICKED) {
int length = (int) SendMessageA(hOtherEdit, WM_GETTEXT, (WPARAM) 512, (LPARAM) szOtherThing);
/* length is non-zero in WinXP and Win7 */
length = (int) SendMessageW(hDomainEdit, WM_GETTEXT, (WPARAM) 256, (LPARAM) wszDomain);
/* length is non-zero in WinXP, zero in Win7! Same input! Error find? Medal get? */
/* ... think about doing other stuff, but can't without a domain name ... */
}
} // don't process other messages, just out of spite. just kidding, it's for brevity
}
|