hdl->srcitem = LBItemFromPt(dlm->hWnd, dlm->ptCursor, TRUE);
hdl->dragging = 0;
/* XXX hack Q183115 */
- SetWindowLong(hwnd, DWL_MSGRESULT, TRUE);
+ SetWindowLongPtr(hwnd, DWLP_MSGRESULT, TRUE);
ret |= 1; break;
case DL_CANCELDRAG:
DrawInsert(hwnd, dlm->hWnd, -1); /* Clear arrow */
if (dest > hdl->dummyitem) dest = hdl->dummyitem;
DrawInsert (hwnd, dlm->hWnd, dest);
if (dest >= 0)
- SetWindowLong(hwnd, DWL_MSGRESULT, DL_MOVECURSOR);
+ SetWindowLongPtr(hwnd, DWLP_MSGRESULT, DL_MOVECURSOR);
else
- SetWindowLong(hwnd, DWL_MSGRESULT, DL_STOPCURSOR);
+ SetWindowLongPtr(hwnd, DWLP_MSGRESULT, DL_STOPCURSOR);
ret |= 1; break;
case DL_DROPPED:
if (hdl->dragging) {
wc.style = CS_DBLCLKS | CS_SAVEBITS | CS_BYTEALIGNWINDOW;
wc.lpfnWndProc = DefDlgProc;
wc.cbClsExtra = 0;
- wc.cbWndExtra = DLGWINDOWEXTRA + 8;
+ wc.cbWndExtra = DLGWINDOWEXTRA + 2*sizeof(LONG_PTR);
wc.hInstance = hinst;
wc.hIcon = NULL;
wc.hCursor = LoadCursor(NULL, IDC_ARROW);
hwnd = CreateDialog(hinst, tmpl, hwndparent, lpDialogFunc);
- SetWindowLong(hwnd, BOXFLAGS, 0); /* flags */
- SetWindowLong(hwnd, BOXRESULT, 0); /* result from SaneEndDialog */
+ SetWindowLongPtr(hwnd, BOXFLAGS, 0); /* flags */
+ SetWindowLongPtr(hwnd, BOXRESULT, 0); /* result from SaneEndDialog */
while ((gm=GetMessage(&msg, NULL, 0, 0)) > 0) {
- flags=GetWindowLong(hwnd, BOXFLAGS);
+ flags=GetWindowLongPtr(hwnd, BOXFLAGS);
if (!(flags & DF_END) && !IsDialogMessage(hwnd, &msg))
DispatchMessage(&msg);
if (flags & DF_END)
if (gm == 0)
PostQuitMessage(msg.wParam); /* We got a WM_QUIT, pass it on */
- ret=GetWindowLong(hwnd, BOXRESULT);
+ ret=GetWindowLongPtr(hwnd, BOXRESULT);
DestroyWindow(hwnd);
return ret;
}
static void SaneEndDialog(HWND hwnd, int ret)
{
- SetWindowLong(hwnd, BOXRESULT, ret);
- SetWindowLong(hwnd, BOXFLAGS, DF_END);
+ SetWindowLongPtr(hwnd, BOXRESULT, ret);
+ SetWindowLongPtr(hwnd, BOXFLAGS, DF_END);
}
/*
dp.hwnd = hwnd;
create_controls(hwnd, ""); /* Open and Cancel buttons etc */
SetWindowText(hwnd, dp.wintitle);
- SetWindowLong(hwnd, GWL_USERDATA, 0);
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, 0);
if (help_path)
- SetWindowLong(hwnd, GWL_EXSTYLE,
- GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_CONTEXTHELP);
+ SetWindowLongPtr(hwnd, GWL_EXSTYLE,
+ GetWindowLongPtr(hwnd, GWL_EXSTYLE) |
+ WS_EX_CONTEXTHELP);
else {
HWND item = GetDlgItem(hwnd, IDC_HELPBTN);
if (item)
}
}
- SetWindowLong(hwnd, GWL_USERDATA, 1);
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, 1);
return 0;
case WM_LBUTTONUP:
/*
/*
* Only process WM_COMMAND once the dialog is fully formed.
*/
- if (GetWindowLong(hwnd, GWL_USERDATA) == 1) {
+ if (GetWindowLongPtr(hwnd, GWLP_USERDATA) == 1) {
ret = winctrl_handle_command(&dp, msg, wParam, lParam);
if (dp.ended && GetCapture() != hwnd)
SaneEndDialog(hwnd, dp.endresult ? 1 : 0);
/* Enable or disable the scroll bar, etc */
{
- LONG nflg, flag = GetWindowLong(hwnd, GWL_STYLE);
+ LONG nflg, flag = GetWindowLongPtr(hwnd, GWL_STYLE);
LONG nexflag, exflag =
- GetWindowLong(hwnd, GWL_EXSTYLE);
+ GetWindowLongPtr(hwnd, GWL_EXSTYLE);
nexflag = exflag;
if (cfg.alwaysontop != prev_cfg.alwaysontop) {
if (nflg != flag || nexflag != exflag) {
if (nflg != flag)
- SetWindowLong(hwnd, GWL_STYLE, nflg);
+ SetWindowLongPtr(hwnd, GWL_STYLE, nflg);
if (nexflag != exflag)
- SetWindowLong(hwnd, GWL_EXSTYLE, nexflag);
+ SetWindowLongPtr(hwnd, GWL_EXSTYLE, nexflag);
SetWindowPos(hwnd, NULL, 0, 0, 0, 0,
SWP_NOACTIVATE | SWP_NOCOPYBITS |
{
if (!IsZoomed(hwnd))
return FALSE;
- if (GetWindowLong(hwnd, GWL_STYLE) & WS_CAPTION)
+ if (GetWindowLongPtr(hwnd, GWL_STYLE) & WS_CAPTION)
return FALSE;
return TRUE;
}
return;
/* Remove the window furniture. */
- style = GetWindowLong(hwnd, GWL_STYLE);
+ style = GetWindowLongPtr(hwnd, GWL_STYLE);
style &= ~(WS_CAPTION | WS_BORDER | WS_THICKFRAME);
if (cfg.scrollbar_in_fullscreen)
style |= WS_VSCROLL;
else
style &= ~WS_VSCROLL;
- SetWindowLong(hwnd, GWL_STYLE, style);
+ SetWindowLongPtr(hwnd, GWL_STYLE, style);
/* Resize ourselves to exactly cover the nearest monitor. */
get_fullscreen_rect(&ss);
DWORD oldstyle, style;
/* Reinstate the window furniture. */
- style = oldstyle = GetWindowLong(hwnd, GWL_STYLE);
+ style = oldstyle = GetWindowLongPtr(hwnd, GWL_STYLE);
style |= WS_CAPTION | WS_BORDER;
if (cfg.resize_action == RESIZE_DISABLED)
style &= ~WS_THICKFRAME;
else
style &= ~WS_VSCROLL;
if (style != oldstyle) {
- SetWindowLong(hwnd, GWL_STYLE, style);
+ SetWindowLongPtr(hwnd, GWL_STYLE, style);
SetWindowPos(hwnd, NULL, 0, 0, 0, 0,
SWP_NOMOVE | SWP_NOSIZE | SWP_NOZORDER |
SWP_FRAMECHANGED);
switch (msg) {
case WM_INITDIALOG:
if (help_path)
- SetWindowLong(hwnd, GWL_EXSTYLE,
- GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_CONTEXTHELP);
+ SetWindowLongPtr(hwnd, GWL_EXSTYLE,
+ GetWindowLongPtr(hwnd, GWL_EXSTYLE) |
+ WS_EX_CONTEXTHELP);
else {
/*
* If we add a Help button, this is where we destroy it
state->collecting_entropy = FALSE;
state->entropy = NULL;
state->key_exists = FALSE;
- SetWindowLong(hwnd, GWL_USERDATA, (LONG) state);
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) state);
{
HMENU menu, menu1;
return 1;
case WM_MOUSEMOVE:
- state = (struct MainDlgState *) GetWindowLong(hwnd, GWL_USERDATA);
+ state = (struct MainDlgState *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (state->collecting_entropy &&
state->entropy && state->entropy_got < state->entropy_required) {
state->entropy[state->entropy_got++] = lParam;
case IDC_KEYSSH2DSA:
{
state = (struct MainDlgState *)
- GetWindowLong(hwnd, GWL_USERDATA);
+ GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (!IsDlgButtonChecked(hwnd, LOWORD(wParam)))
CheckRadioButton(hwnd, IDC_KEYSSH1, IDC_KEYSSH2DSA,
LOWORD(wParam));
case IDC_COMMENTEDIT:
if (HIWORD(wParam) == EN_CHANGE) {
state = (struct MainDlgState *)
- GetWindowLong(hwnd, GWL_USERDATA);
+ GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (state->key_exists) {
HWND editctl = GetDlgItem(hwnd, IDC_COMMENTEDIT);
int len = GetWindowTextLength(editctl);
HIWORD(wParam) != BN_DOUBLECLICKED)
break;
state =
- (struct MainDlgState *) GetWindowLong(hwnd, GWL_USERDATA);
+ (struct MainDlgState *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (!state->generation_thread_exists) {
BOOL ok;
state->keysize = GetDlgItemInt(hwnd, IDC_BITS, &ok, FALSE);
if (HIWORD(wParam) != BN_CLICKED)
break;
state =
- (struct MainDlgState *) GetWindowLong(hwnd, GWL_USERDATA);
+ (struct MainDlgState *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (state->key_exists) {
char filename[FILENAME_MAX];
char passphrase[PASSPHRASE_MAXLEN];
if (HIWORD(wParam) != BN_CLICKED)
break;
state =
- (struct MainDlgState *) GetWindowLong(hwnd, GWL_USERDATA);
+ (struct MainDlgState *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (state->key_exists) {
char filename[FILENAME_MAX];
if (prompt_keyfile(hwnd, "Save public key as:",
if (HIWORD(wParam) != BN_CLICKED)
break;
state =
- (struct MainDlgState *) GetWindowLong(hwnd, GWL_USERDATA);
+ (struct MainDlgState *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
if (!state->generation_thread_exists) {
char filename[FILENAME_MAX];
if (prompt_keyfile(hwnd, "Load private key:",
}
return 0;
case WM_DONEKEY:
- state = (struct MainDlgState *) GetWindowLong(hwnd, GWL_USERDATA);
+ state = (struct MainDlgState *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
state->generation_thread_exists = FALSE;
state->key_exists = TRUE;
SendDlgItemMessage(hwnd, IDC_PROGRESS, PBM_SETRANGE, 0,
}
break;
case WM_CLOSE:
- state = (struct MainDlgState *) GetWindowLong(hwnd, GWL_USERDATA);
+ state = (struct MainDlgState *) GetWindowLongPtr(hwnd, GWLP_USERDATA);
sfree(state);
if (requested_help) {
WinHelp(hwnd, help_path, HELP_QUIT, 0);
}
if (help_path)
- SetWindowLong(hwnd, GWL_EXSTYLE,
- GetWindowLong(hwnd, GWL_EXSTYLE) | WS_EX_CONTEXTHELP);
+ SetWindowLongPtr(hwnd, GWL_EXSTYLE,
+ GetWindowLongPtr(hwnd, GWL_EXSTYLE) |
+ WS_EX_CONTEXTHELP);
else {
HWND item = GetDlgItem(hwnd, 103); /* the Help button */
if (item)
};
#define BOXFLAGS DLGWINDOWEXTRA
-#define BOXRESULT DLGWINDOWEXTRA + 4
+#define BOXRESULT (DLGWINDOWEXTRA + sizeof(LONG_PTR))
#define DF_END 0x0001
/*