What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » api question

api question
Author: Message:
TheGuruSupremacy
Full Member
***

Avatar

Posts: 367
Reputation: 19
34 / Male / Flag
Joined: Nov 2006
O.P. api question
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.

This post was edited on 12-03-2006 at 05:23 PM by TheGuruSupremacy.
12-03-2006 05:19 PM
Profile PM Find Quote Report
Eljay
Elite Member
*****

Avatar
:O

Posts: 2949
Reputation: 77
– / Male / –
Joined: May 2004
RE: api question
use FindWindowW instead of FindWindowA, strings passed to Interop.Call are unicode not ANSI.
12-03-2006 05:52 PM
Profile PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: api question
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

This post was edited on 12-03-2006 at 05:53 PM by Spunky.
<Eljay> "Problems encountered: shit blew up" :zippy:
12-03-2006 05:52 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: api question
Javascript works with unicode.

code:
Debug.Trace(Interop.Call('user32','FindWindowW', 'notepad', ''));
12-03-2006 05:53 PM
Profile E-Mail PM Find Quote Report
TheGuruSupremacy
Full Member
***

Avatar

Posts: 367
Reputation: 19
34 / Male / Flag
Joined: Nov 2006
O.P. RE: api question
thanks to all....you were very helpful!!!!!thanks again!!!:D
12-03-2006 06:01 PM
Profile PM Find Quote Report
vikke
Senior Member
****

Avatar

Posts: 900
Reputation: 28
31 / Male / Flag
Joined: May 2006
RE: RE: api question
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".

This post was edited on 12-03-2006 at 06:04 PM by vikke.
12-03-2006 06:03 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On