Note that there are some explanatory texts on larger screens.

plurals
  1. POCall to TMouse.GetCursorPos sometimes fails with "A call to an OS function failed"
    primarykey
    data
    text
    <p>On occasion my application gets the error below.</p> <p>Normally this happens when the user steps away from their desk leaving my program open. When they come back this error has appeared. </p> <p>TMouse.GetCursorPostion does not do anything except make the Windows API call to GetCursorPosition. Then it checks the return value and calls GetLastError if it failed. </p> <p>"A call to an OS function failed" is not very helpful in tracking down the cause of this. Could a screen saver or sleep mode be kicking in causing this error? I could modify the component to just catch and ignore the error, but if possible I would rather know what/why it is happening in the first place.</p> <p>My application is using Delphi 2007 and the call is being made from Transfer@Once (v 1.7) component by Quasidata.</p> <p>Here is the call stack:</p> <pre> operating system : Windows XP Service Pack 3 build 2600 exception number : 1 exception class : EOSError exception message : A call to an OS function failed. main thread ($d34): 0045e208 UaarSales.exe SysUtils RaiseLastOSError 0045e191 UaarSales.exe SysUtils RaiseLastOSError 0045e237 UaarSales.exe SysUtils Win32Check 004c6de9 UaarSales.exe Controls TMouse.GetCursorPos 00736d8b UaarSales.exe taoCntrr 3999 TtaoHoverTimer.Timer 004a1d27 UaarSales.exe ExtCtrls TTimer.WndProc 0047a7a0 UaarSales.exe Classes StdWndProc 7e4196c2 USER32.dll DispatchMessageA 004da230 UaarSales.exe Forms TApplication.ProcessMessage 004da26a UaarSales.exe Forms TApplication.HandleMessage 004da55f UaarSales.exe Forms TApplication.Run 00b3ea76 UaarSales.exe UaarSales 117 initialization </pre> <p>Here is the Timer procedure</p> <pre> <code> procedure TtaoHoverTimer.Timer; var lPos: TPoint; begin lPos := Mouse.CursorPos; <b> // this is line 3999 </b> if (lPos.X = FMousePos.X) and (lPos.Y = FMousePos.Y) and not ((lPos.X = FOutdatedPos.X) and (lPos.Y = FOutdatedPos.Y)) then begin inherited Timer; FOutdatedPos := Point(MaxInt, MaxInt); end; Enabled := False; end; </code> </pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload