This App is No Longer Maintained. Visit the Replacement at StrokesPlus.net

StrokesPlus Forum
                       
StrokesPlus Forum
Home | Profile | Active Topics
Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Lua Scripts
 General Action Scripts
 Help with acMoveWindow and hwndTarget
 Forum Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

stevem99

8 Posts

Posted - 07/11/2013 :  17:00:16  Show Profile
I'm a new user of StrokesPlus and need help with hwndTarget syntax. Here is my code for trying to open notepad on the Desktop and then move it to a screen location of 0x and 0y.
It does open but does not move. I'm using Win7.

acRunProgram("c:\\windows\\system32\\notepad.exe","",0, 1)
acDelay(500)
acMoveWindow(nil, gsx, gsy, 0, 0)

the last line is what I'm not sure about how to code for notepad's handle. I tried
acMoveWindow("Untitled - Notepad", 0, 0) but it is not moving the window.

Thanks for any help.

Rob

USA
2615 Posts

Posted - 07/11/2013 :  17:28:54  Show Profile  Visit Rob's Homepage
There wasn't necessarily anything wrong with the last line, other than it would mean that Notepad would have to open under the place where you started the gesture drawing.

This would be a little more consistent:
acRunProgram("c:\\windows\\system32\\notepad.exe","",0, 1)
acDelay(500)
acMoveWindow(acFindWindow(nil, "Untitled - Notepad"), nil, nil, 0, 0)
hwndTarget is the internal identifier of the window itself (the handle for the window [hence "hwnd"]). Most S+ actions accept either the handle itself (which is a number Windows assigns to the window), or the coordinates of where the window is. if no hwnd is passed in, S+ will take the coordinates and get the window handle at that location.

So in my code above, I'm calling acFindWindow, which returns the hwnd for the matching window and passes it (the number) into acMoveWindow for the hwndTarget parameter. acMoveWindow then tells Windows to move the window with the handle returned by acFindWindow (Notepad), to the specified coordinates.

Make sense?
Go to Top of Page

stevem99

8 Posts

Posted - 07/11/2013 :  17:36:10  Show Profile
That makes perfect sense Rob, thanks so much. I wasn't sure how the handle was obtained and didn't know that it was a number.
Go to Top of Page
  Previous Topic Topic Next Topic  
 Forum Locked
 Printer Friendly
Jump To:
StrokesPlus Forum © 2011-2018 Rob Yapchanyk Go To Top Of Page
Snitz Forums 2000