Recent

Author Topic: GetGUIThreadInfo missing definition  (Read 1085 times)

440bx

  • Hero Member
  • *****
  • Posts: 4220
GetGUIThreadInfo missing definition
« on: April 29, 2024, 04:57:02 am »
Hello,

For some reason the definition of Windows user32 API, GetGUIDThreadInfo GetGUIThreadInfo in redef.inc is commented out.  This is a problem when attempting to use the function.

The function and the structure it uses could be defined as follows (parallel to MSDN):
Code: Pascal  [Select][+][-]
  1. type
  2.   PGUITHREADINFO = ^TGUITHREADINFO;
  3.   TGUITHREADINFO = record
  4.     cbSize           : DWORD;     { must be initialized before the call       }
  5.     flags            : DWORD;
  6.     hwndActive       : HWND;
  7.     hwndFocus        : HWND;
  8.     hwndCapture      : HWND;
  9.     hwndMenuOwner    : HWND;
  10.     hwndMoveSize     : HWND;
  11.     hwndCaret        : HWND;
  12.     rcCaret          : TRECT;
  13.   end;
  14.  
  15. function GetGUIThreadInfo
  16.            (
  17.             InThreadId         : DWORD;
  18.             InoutGuiThreadInfo : PGUITHREADINFO
  19.            )
  20.          : BOOL; stdcall; external 'user32';
  21.  
  22. function GetGUIThreadInfo
  23.            (
  24.                 InThreadId         : DWORD;
  25.             var InoutGuiThreadInfo : TGUITHREADINFO
  26.            )
  27.          : BOOL; stdcall; external 'user32'; overload;
  28.  
the first definition exactly mirrors the C definition.  The second definition is "Pascalish" in that it uses "var" (which in this case is appropriate since the structure must be initialized before being used.)

HTH.

ETA:

Corrected the function's name.
« Last Edit: April 29, 2024, 09:49:42 am by 440bx »
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

Thaddy

  • Hero Member
  • *****
  • Posts: 14820
  • Censorship about opinions does not belong here.
Re: GetGUIDThreadInfo missing definition
« Reply #1 on: April 29, 2024, 09:23:43 am »
isn't it TGuiTHreadInfo? not related to GUID.
bitrate is always calculated like this:sample rate * bitdepth * number of channels.

440bx

  • Hero Member
  • *****
  • Posts: 4220
Re: GetGUIThreadInfo missing definition
« Reply #2 on: April 29, 2024, 09:33:26 am »
isn't it TGuiTHreadInfo? not related to GUID.
You are correct.  It is GetGUIThreadInfo (no "D" in there.)  Thank you for bringing that to my attention.
« Last Edit: April 29, 2024, 09:52:55 am by 440bx »
(FPC v3.0.4 and Lazarus 1.8.2) or (FPC v3.2.2 and Lazarus v3.2) on Windows 7 SP1 64bit.

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 11583
  • FPC developer.
Re: GetGUIThreadInfo missing definition
« Reply #3 on: April 29, 2024, 10:18:11 am »
Prototypes using VAR instead of pointers (in redef) are only added for Delphi compatibility or for extremely highly used functions.

 

TinyPortal © 2005-2018