Skip to content

Commit

Permalink
Discovering WinAPI's DialogBoxParam procedure
Browse files Browse the repository at this point in the history
  • Loading branch information
Magnetic-Fox committed Jan 24, 2025
1 parent 0aeb79f commit bd45dfe
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,16 @@ long int inline MakeDialogBox(HWND hwnd, unsigned int type, void* procedure) {
FreeProcInstance(proc);
return result;
}

long int inline MakeDialogBoxParam(HWND hwnd, unsigned int type, void* procedure, LPARAM parameter) {
long int result;
HANDLE instHandle=(HINSTANCE)GetWindowWord(hwnd,GWW_HINSTANCE);
FARPROC proc=MakeProcInstance((FARPROC)procedure, instHandle);
result=DialogBoxParam(instHandle, MAKEINTRESOURCE(type), hwnd, (DLGPROC)proc, parameter);
FreeProcInstance(proc);
return result;
}

/*
HHOOK inline MakeSetWindowsHook(HWND hwnd, FARPROC &proc, int hookType, void* procedure) {
HANDLE instHandle=(HINSTANCE)GetWindowWord(hwnd,GWW_HINSTANCE);
Expand Down Expand Up @@ -532,7 +542,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
}
break;
case ID_BUTTON4:
ShowInteger(MakeDialogBox(hwnd,IDD_DIALOG1,DlgProc));
ShowInteger(MakeDialogBoxParam(hwnd,IDD_DIALOG1,DlgProc,1987));
break;
case ID_BUTTON7:
createSecondWindow(hwnd,winMem,0);
Expand Down Expand Up @@ -697,6 +707,9 @@ LRESULT CALLBACK WndProc2(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
BOOL CALLBACK DlgProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) {
switch(msg) {
case WM_INITDIALOG:
if(lParam!=0) {
ShowInteger(lParam);
}
if(Ctl3dEnabled()) {
unsigned int ctlRegs=CTL3D_ALL;
Ctl3dSubclassDlg(hwnd,ctlRegs);
Expand Down

0 comments on commit bd45dfe

Please sign in to comment.