alogrep 0 Posted November 3, 2022 Hi. I get the subject error on this line of code SetWindowLong(thisform.Handle, GWL_STYLE, WS_POPUP or WS_CLIPSIBLINGS or WS_CLIPCHILDREN or WS_SYSMENU); The peculiar thing is I get it in one application but not in another application (they both use the identical code and "thisform") I traced it with Ctrl+F7 and this is the sequence that produces th error. Any help, please? SetWindowLong(thisform.Handle, GWL_STYLE, WS_POPUP or WS_CLIPSIBLINGS or WS_CLIPCHILDREN or WS_SYSMENU); function TWinControl.GetHandle: HWND; begin HandleNeeded; Result := WindowHandle; end; procedure _BoundErr; {$IFDEF PUREPASCAL} begin ErrorAt(Byte(reRangeError), ReturnAddress); end; {$ELSE !PUREPASCAL} {$IFDEF CPUX86} asm MOV AL,reRangeError JMP Error end; procedure Error(errorCode: TRuntimeError); begin ErrorAt(Byte(errorCode), ReturnAddress); end; Share this post Link to post
Remy Lebeau 1436 Posted November 3, 2022 (edited) Type-cast the 3rd parameter: SetWindowLong(thisform.Handle, GWL_STYLE, LONG(WS_POPUP or WS_CLIPSIBLINGS or WS_CLIPCHILDREN or WS_SYSMENU)); Though, SetWindowLong() has been deprecated for a long time, as it doesn't support 64-bit apps. You really should be using SetWindowLongPtr() instead: SetWindowLongPtr(thisform.Handle, GWL_STYLE, LONG_PTR(WS_POPUP or WS_CLIPSIBLINGS or WS_CLIPCHILDREN or WS_SYSMENU)); Edited November 4, 2022 by Remy Lebeau Share this post Link to post