I have this function :
function EnumWindowsProc(hWnd: HWND; {%H-}lParam: LPARAM): bool; stdcall;
var
Title: array[0..255] of Char;
begin
GetWindowText(hWnd, Title, 255);
if (IsWindowVisible(hWnd)) and (pos('JPEGView', Title) <> 0) then
AHandle := hWnd;
Result := True;
end;
function GetJPGViewHandle : hWnd;
begin
AHandle := 0;
EnumWindows(@EnumWindowsProc, 0);
Result := AHandle;
end;
I would like to pass a parameter (string) like this
function EnumWindowsProc(hWnd: HWND; {%H-}lParam: LPARAM): bool; stdcall;
var
Title: array[0..255] of Char;
begin
GetWindowText(hWnd, Title, 255);
if (IsWindowVisible(hWnd)) and (pos(AValue, Title) <> 0) then
AHandle := hWnd;
Result := True;
end;
function GetJPGViewHandle(Avalue : string) : hWnd;
begin
AHandle := 0;
EnumWindows(@EnumWindowsProc, 0);
Result := AHandle;
end;
withput using global variables. How can I do that?