Quote:
Originally Posted by Cuttlas
Hi
I use several plugins and modules within my setup, such as WinTB, botva2, progressBar, Trackbar.
They will use SetWindowLong and I should release them in the correct situation. But sometimes I do not know where to release and so on ... So the setup will delay on Exit and will close with an error in the debugger (most with 0xc000041d exit code).
How to trace the problem and release the WindowLong? any idea or similar Experience?
|
If you loaded any PROC with SetWindowlong it is necessary to restore the previous values.
Example:
Code:
const
GWL_WNDPROC = (-4);
SC_MINIMIZE = $F020;
WM_SYSCOMMAND = $0112;
var
OldProc: Longint;
function CallWindowProc(lpPrevWndFunc: Longint; hWnd: HWND; Msg: UINT; wParam, lParam: Longint): Longint; external '[email protected] stdcall delayload';
function SetWindowLong(hWnd: HWND; nIndex: Integer; dwNewLong: Longint): Longint; external '[email protected] stdcall delayload';
function WindowProc(hWnd: HWND; uMsg, wParam, lParam: Longint): Longint;
begin
//code here
Result := CallWindowProc(OldProc, hWnd, uMsg, wParam, lParam);
end;
procedure InitializeWizard();
begin
OldProc := SetWindowLong(WizardForm.Handle, GWL_WNDPROC, CreateCallBack(@WindowProc));
end;
procedure DeinitializeSetup();
begin
SetWindowLong(WizardForm.Handle, GWL_WNDPROC, OldProc);
end;
If you use Timers calling SetTimer they must also be terminated with KillTimer.