I have a simple thread, and inside the execution I'm trying to call EnumWindows () with the address of one of the functions defined in the thread. So I'm trying to do this: EnumWindows (@cbEnumWindowsClickOK, 0); where cbEnumWindowsClickOK is the EnumWindowProc defined inside the stream class, for example:
TAutoClickOKThread = class(TThread) private fExitEvent : THandle; function cbEnumWindowsClickOK(Wnd: HWND; Info: Pointer): BOOL; public constructor Create(ExitEvent : Thandle); procedure Execute(); override; end;
When I try to do this, I keep getting "Error: Variable required", hinting that it does not interpret @cbEnumWindowsClickOK as an address. If I transfer this function to the global scope (removing it from the stream), it works.
Any thoughts on how I can fix this?
source share