PDA

View Full Version : Send OK message



rhosk
11-26-2003, 10:36 AM
Hello again all,

Is there a way to send a [press] "OK" message to a given window? Similar I guess to a "SendClose" message?

TJ_Tigger
11-26-2003, 11:23 AM
Could you use worms keystroke dll to send an enter to the window?

Worm
11-26-2003, 11:51 AM
Yep you can... :)

rhosk
11-26-2003, 12:35 PM
Well, I tried this and it doesn't seem to work. Is it maybe a little different between ver4 and 5? I'm merely reinvoking a screensaver which brings up the Desktop "Display Properties" window. I just want this to be user hands off is all. (This is just a piece of the script)


Dllresult = DLL.CallFunction("KeyStrokes.dll", "KeyStroke", "Keys", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);
File.Run(_SystemFolder.."\\rundll32.exe", "desk.cpl,InstallScreenSaver myscreen.scr", "", SW_SHOWNORMAL, false);
prpwindow = Window.EnumerateTitles(true);
--Enumerate the table and try to find the window
for handle, title in prpwindow do
-- Check if the window title has the target text.
result = String.Find(title, "Display Properties", 1, false);
-- if the string was found in the title, then change the title.
if (result ~= -1) then
Window.SetOrder(handle, HWND_TOPMOST);
Application.Sleep(5000);
Keys = "{Enter}";


Any help would be appreciated!

rhosk
11-26-2003, 12:36 PM
Why'd that post do that?? :confused:

Worm
11-26-2003, 12:48 PM
Cause when you use the {code} {/code} vBcode, it doesn't wrap the text

Worm
11-26-2003, 12:54 PM
You have to make the call to the DLL after you set the variable to {ENTER}. Also, consider using a page timer to poll the system for the window title you want to ensure its there before sending th TopMost and keystrokes.



File.Run(_SystemFolder.."\\rundll32.exe", "desk.cpl,InstallScreenSaver myscreen.scr", "", SW_SHOWNORMAL, false);
prpwindow = Window.EnumerateTitles(true);
--Enumerate the table and try to find the window
for handle, title in prpwindow do
-- Check if the window title has the target text.
result = String.Find(title, "Display Properties", 1, false);
-- if the string was found in the title, then change the title.
if (result ~= -1) then
Window.SetOrder(handle, HWND_TOPMOST);
Application.Sleep(5000);
Keys = "{Enter}";
Dllresult = DLL.CallFunction("KeyStrokes.dll", "KeyStroke", "Keys", DLL_RETURN_TYPE_INTEGER, DLL_CALL_STDCALL);

rhosk
11-26-2003, 01:02 PM
Ohh, I thought I could call that dll anytime in the script.

And this is inside a page.timer (already using it for other functions), just gave you a piece of the script :)

I'll give this a shot, thanks.

rhosk
11-26-2003, 01:35 PM
Well, it's not working. When the "Display Properties" window arrives and is brought to front, the "OK" button is highlighted ready to receive this enter call, but it ain't firing. Maybe a version issue Worm? Can you try to close a "Display Properties" window with your dll in 5?

Corey
11-26-2003, 02:06 PM
Hi Ron. VBulletin doesn't break the lines for code output apparently for readibilty.

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

rhosk
11-26-2003, 02:13 PM
Originally posted by Corey
Hi Ron. VBulletin doesn't break the lines for code output apparently for readibilty.

Eh, I was hoping that "I" didn't somehow do that.

Corey
11-26-2003, 02:15 PM
Actually it seems like a good idea, the code is very easy to read. I'm going to start using that feature I think...

Corey Milner
Creative Director, Indigo Rose Software (http://www.indigorose.com)

stickck
11-23-2005, 12:17 AM
Hey RHOSK, did you ever figure out how to send OK to a popup window? i have a simiar problem. i have a confirmation popup that i want close but i havent figured it out yet. 3 days and going....

thanks for help you can give me.

chris