Interop.Call("user32.dll","GetActiveWindow") returns 0 - 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: Interop.Call("user32.dll","GetActiveWindow") returns 0 (/showthread.php?tid=87893) Interop.Call("user32.dll","GetActiveWindow") returns 0 by V@no on 12-22-2008 at 02:01 AM
Hello! code:However if active window not related to WLM or MPL, it always returns 0 Any other way get handle of the active window? Thank you. RE: Interop.Call("user32.dll","GetActiveWindow") returns 0 by felipEx on 12-22-2008 at 03:01 AM
You can achieve this by using the GetForegroundWindow function. RE: Interop.Call("user32.dll","GetActiveWindow") returns 0 by V@no on 12-22-2008 at 03:11 AM Thank you. That is exactly what I needed. There is one issue though. It returns HWND...how do I get PID from HWND or vise versa? P.S. I'm very new to this and not sure how to use classes... I found this: http://msdn.microsoft.com/en-us/library/system.di...etprocessbyid.aspx It seems to be what I needed, bu how do I use it within MPL scripts? RE: Interop.Call("user32.dll","GetActiveWindow") returns 0 by Pinecone on 12-22-2008 at 04:12 AM
Untested... I think will work as is. GetWindowThreadProcessId was the function you were looking for. http://msdn.microsoft.com/en-us/library/ms633522.aspx code: RE: Interop.Call("user32.dll","GetActiveWindow") returns 0 by V@no on 12-22-2008 at 05:45 AM
Thank you very much! RE: Interop.Call("user32.dll","GetActiveWindow") returns 0 by Pinecone on 12-22-2008 at 06:31 AM
No problem. Thanks for pointing out the spelling error (corrected now). RE: Interop.Call("user32.dll","GetActiveWindow") returns 0 by V@no on 12-22-2008 at 06:42 AM
Yes, you are right. |