Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 1080
  • Last Modified:

FindwindowEx

Hi,

i want to read the text of the user at MSN Messenger Login dialog... it's a ComboBox.

Inside the window there's a class named 'SysCredential' and it's the parent for the combobox, but when i try to get its handle i do not success... here's part of the code

var
  wnd: HWND;

······

// Find Msgr Window
wnd := FindWindow('#32770', '.NET Messenger Service');

// Find 'SysCredential' window
wnd := FindWindowEx(wnd, 0, 'SysCredential', nil);

// **** THIS should give me the handle for the combobox, but it does not! :(
wnd := FindWindowEx(wnd 0, 'ComboBox', nil);

 
Please Help me!! what am i doing wrong????
btw... i got class names using Spy++
--
Thanks!
0
tearsoftragedy
Asked:
tearsoftragedy
  • 3
1 Solution
 
BTechoCommented:
Hello.

Im not running XP at the moment so I have no way of testing your code snippet.

But in any case I would add some small modifications. Check if the HWND returned is not Zero before proceeding.

// Find Msgr Window
wnd := FindWindow('#32770', '.NET Messenger Service');

// Find 'SysCredential' window
if wnd<>0 then begin
wnd := FindWindowEx(wnd, 0, 'SysCredential', nil);

/***** THIS should give me the handle for the combobox, but it does not! :( */
 if wnd<>0 then begin
 wnd := FindWindowEx(wnd 0, 'ComboBox', nil);
 end;

end;

I would then add breakpoints to each line where FindWindowEx is used, now run the snippet and see if it continues to each line FindWindowEx is and it should reach FindWindowEx(wnd 0, 'ComboBox', nil); if it does and there is only one such combobox on that form then you got the right handle, if not then I would recheck if gave the correct captions, becuase FindWindow is case sensitive.

I would suspect you really check the classname and window caption for this one and all the other classes and captions,
FindWindow('#32770', '.NET Messenger Service');

becuase I happen to find a snippet on the internet that shows this'
FindWindow('#32770', 'Messenger Service ');


0
 
CleanupPingCommented:
tearsoftragedy:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
BTechoCommented:
tearsoftragedy,

It would really be great if you can tell use what the answer to the problem was. That is if you have found the correct answer since then.

Thanks.
0
 
tearsoftragedyAuthor Commented:
Im very very sorry for this delay

i actually forgot this thread, anyway, the code i was using  was wrong, i had to find
some other window inside the other to get the combobox... all the stuff
your code works

thanks!
0
 
BTechoCommented:
Thanks the follow up and accepting the answer, really appreciated :)
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now