Recent

Author Topic: get open windows  (Read 5246 times)

skaner1900

  • Jr. Member
  • **
  • Posts: 59
get open windows
« on: May 01, 2011, 03:37:06 pm »
I useing WinAPI function:

Code: [Select]
function EnumWindowsProc(WHandle: HWND; LParM: LParam): Boolean;StdCall;Export;
var Title,ClassName:array[0..128] of char;
    sTitle,sClass,Linia:STRING ;
begin
 Result:=True;
 GetWindowText(wHandle, Title,128);
 GetClassName(wHandle, ClassName,128);
 sTitle:=Title;
 sClass:=ClassName;
 if IsWindowVisible(wHandle) then
 begin
  Linia:=sTitle+'        '+sClass+'       '+IntToHex(wHandle,4);
  Form1.ComboBox2.Items.Add(Linia);
 end;
end;



But when I try to call it by:

Code: [Select]
EnumWindows(@EnumWindowsProc,0);


I receive error:

unit1.pas(416,31) Error: Incompatible type for arg no. 1: Got "<address of function(LongWord,LongInt):Boolean;StdCall>", expected "<procedure variable type of function(LongWord,LongInt):LongBool;StdCall>"



What's wrong?!

Marc

  • Administrator
  • Hero Member
  • *
  • Posts: 2512
Re: get open windows
« Reply #1 on: May 01, 2011, 06:57:46 pm »
Boolean <> LongBool.

Declare your function like the error said:
function EnumWindowsProc(WHandle: HWND; LParM: LParam): LongBool;StdCall;Export;

(you don't have to export btw)
//--
{$I stdsig.inc}
//-I still can't read someones mind
//-Bugs reported here will be forgotten. Use the bug tracker

 

TinyPortal © 2005-2018