Shoutbox

api question - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: api question (/showthread.php?tid=69114)

api question by TheGuruSupremacy on 12-03-2006 at 05:19 PM

hi....i have a question...i have tried to call an api with this code

var exhnd=Interop.Call("User32","FindWindowA","Notepad",null);
Debug.Trace(exhnd)
Interop.Call("User32","ShowWindow",exhnd,0)


but i can't understand why exhnd value is always 0 even if actually the handle is not 0...can anybody help me???sorry for my english.


RE: api question by Eljay on 12-03-2006 at 05:52 PM

use FindWindowW instead of FindWindowA, strings passed to Interop.Call are unicode not ANSI.


RE: api question by Spunky on 12-03-2006 at 05:52 PM

If the class equals null then the API calls GetWindowText() and check to see if that matches any open windows...

I think either way it should be checking for "<filename> - Notepad"

EDIT: Beaten and it looks like I may be wrong :p


RE: api question by matty on 12-03-2006 at 05:53 PM

Javascript works with unicode.

code:
Debug.Trace(Interop.Call('user32','FindWindowW', 'notepad', ''));

RE: api question by TheGuruSupremacy on 12-03-2006 at 06:01 PM

thanks to all....you were very helpful!!!!!thanks again!!!:D


RE: RE: api question by vikke on 12-03-2006 at 06:03 PM

quote:
Originally posted by SpunkyLoveMuff
If the class equals null then the API calls GetWindowText() and check to see if that matches any open windows...

I think either way it should be checking for "<filename> - Notepad"

EDIT: Beaten and it looks like I may be wrong :p


You're talking about the title, there's no need to search for it. It's the second parameter, the first one is class, which is the same for all Notepads windows.

Then, by making the second parameter NULL it will only search for windows with the class "Notepad".