EnumWindows????

I use EnumWindows with a callback function, when I check the returned HWND(s) with ISWindow? I get false!!!!!!
Can you tell me why I hear no Beep here?

function CallBackFun(H:LongWord; A:Integer):Boolean;
begin
   Form1.Memo1.Lines.Add(IntToStr(H));
   If IsWindow(H) then Beep;
   Result:=True
end;

procedure TForm1.Button1Click(Sender: TObject);
begin
   Form1.Memo1.Lines.Add('-----------------------');
   EnumWindows ( @CallBackFun, 0);
end;

barzangyAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

rwilson032697Commented:
Well that's strange. The code works, but says none of the handles are windows (even redeclared H as HWND with no success).

Unless its got something to do with the windows only being top-level windows, but thats a bit far fecthed...

Cheers,

Raymond.
0
barzangyAuthor Commented:
but what do you mean with top-level windows?
0
bryan7Commented:
listenning
0
Cloud Class® Course: Certified Penetration Testing

This CPTE Certified Penetration Testing Engineer course covers everything you need to know about becoming a Certified Penetration Testing Engineer. Career Path: Professional roles include Ethical Hackers, Security Consultants, System Administrators, and Chief Security Officers.

rwilson032697Commented:
Top level windows are windows with no parents. Like the main application window. A window like that for an edit control is a child window.

Cheers,

Raymond.
0
intheCommented:
to add to the confusion:

procedure TForm1.Button1Click(Sender: TObject);
var
 wnd: HWND;
begin
 wnd := FindWindow('notepad', nil);
 if IsWindow(wnd) then
 beep;
end;
0
DrDelphiCommented:
You neglected the calling convention in the callback function:

function EnumWindowsCallBack(HWND: hwnd;LPARAM : lParam):bool stdcall

an example is on my webpage and I just tonight got done writing a component for window tasks... check in tommorow if you like to try it out.


Good luck!!


0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
craig_capelCommented:
Delphi... Wheres your web page :)
0
DrDelphiCommented:
www.drdelphi.com

I have not uploaded the component yet due to a small problem with the server. I can email it to you if you like, though.
0
craig_capelCommented:
oh no... just want to nosey at your web page :)
0
craig_capelCommented:
oooh no... thats your weather reading 3c / 38f... oh i feel sorry for you... its nice and warm here 32c / about 90f  in the Canary Islands Tenerife.....
0
DrDelphiCommented:
Show off!!

0
barzangyAuthor Commented:
Ok, just give me sometime to test it!
0
craig_capelCommented:
i just tried out the code... and it returns the same number how ever many it is.... no compiler errors nothing...
13487
13487
13487
13487
13487
13487
  and it goes on and on.....


And No Beep here... is it because it goes that fast, the wave doesent get a chance to play?

beep by itself works ok
0
craig_capelCommented:
oh... stupid me... yeah i caught on to what you mean, your not questioning the beep.... LOL sorry all!!!!.... yeah ok

Yep, i put a breakpoint in and nothing on my machine either... really am not with it today :)

Craig C.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Delphi

From novice to tech pro — start learning today.