nwbyy Posted July 19, 2017 Share Posted July 19, 2017 Hello. My GUI is for a old PC running under windows XP. 3 buttons are to call "mouse options", "keyboard options" and the "audio mixer". I didn't find out how to call them directly, so I created shortcuts and tried call them. run ( "C:\My GUI\mouse.lnk" ) But nothing happened. So I did a .bat file like this for the 3 links: @echo off cd "C:\My GUI\" & start mouse.lnk exit And called the bat file instead: run ( "C:\My GUI\mouse.bat" ) With the "audio mixer" it works. But the "mouse options" and "keyboard options" windows stay in foreground for about 2 seconds, and then they go background. Or my GUI goes foreground... Is it possible to open a window and tell him "stay in foreground"?? Or to tell the GUI to "stay in background"?... Thanks a lot. Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted July 20, 2017 Share Posted July 20, 2017 Hi @nwbyy, and welcome to the AutoIt forum Did you test WinSetOnTop() yet? With this function, you can set the window on top of other windows. Post your entire code, so we can try to help you as much as we can Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
nwbyy Posted July 20, 2017 Author Share Posted July 20, 2017 Hi. Thanks. I will try by myself with WinSetOnTop() If I don't get it right, I'll post my code. :-) Link to comment Share on other sites More sharing options...
FrancescoDiMuro Posted July 20, 2017 Share Posted July 20, 2017 Click here to see my signature: Spoiler ALWAYS GOOD TO READ: Forum Rules Forum Etiquette Link to comment Share on other sites More sharing options...
nwbyy Posted July 21, 2017 Author Share Posted July 21, 2017 Okay, I don't get behind :-( Here is my code (sorry, some words are in french). I deleted the lines having nothing to do with this topic. #include <ColorConstantS.au3> #include <GUIConstants.au3> ; Page 1 $page_1_GUI = GUICreate ("Menu options", @DesktopWidth , @DesktopHeight, 0 , 0 ,$WS_POPUP) GUISetState(@SW_SHOW, $page_1_GUI) ; Couleur de fond GUISetBkColor($COLOR_BLACK) ; Insertion des images GUICtrlCreatePic("C:\My GUI\Logos options\Logo RETOUR.jpg", 37, 551, 0, 0) GUICtrlCreatePic("C:\My GUI\Logos options\Logo CLAVIER.jpg", 233, 211, 0, 0) GUICtrlCreatePic("C:\My GUI\Logos options\Logo SOURIS.jpg", 625, 211, 0, 0) ; Boutons $b_4 = GUICtrlCreateButton("RETOUR", 42, 680, 155, 25) $b_6 = GUICtrlCreateButton("CLAVIER", 238, 340, 155, 25) $b_14 = GUICtrlCreateButton("SOURIS", 630, 340, 155, 25) While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit Case $msg = $b_4 Exit Case $msg = $b_6 run ( "C:\My GUI\LNK_keyboard.bat" ) Case $msg = $b_14 run ( "C:\My GUI\LNK_mouse.bat" ) EndSelect WEnd The LNK_keyboard.bat file: @echo off cd "C:\My GUI\" & start keyboard.lnk exit keyboard.lnk goes to "control pannel/ keyboard properties". The LNK_mouse.bat file: @echo off cd "C:\My GUI\" & start mouse.lnk exit mouse.lnk goes to "control pannel/ mouse properties". With this, the "mouse properties" and "keyboard properties" windows only stay in foreground for about 2 seconds. I found out that "mouse properties" under windows XP can be called by typing "control main.cpl". And "keyboard properties" by typing "control main.cpl keyboard" (this one does not work with me :-( ) Here: http://www.geekgirls.com/2010/03/xp-control-panel-shortcuts/ So I tried with: Case $msg = $b_14 run ( "control main.cpl" ) But the problem remains the same, window goes background after 2 secs. I tried to add: Case $msg = $b_14 $winMouse = run ( "control main.cpl" ) WinSetOnTop ( $winMouse, "", $WINDOWS_ONTOP ) This opens the "mouse properties" window, but closes my GUI. Of course there is a problem with my WinSetOnTop () line, but I can't figure it out... Any help would be great. Thanks in advance. Link to comment Share on other sites More sharing options...
Trong Posted July 21, 2017 Share Posted July 21, 2017 for shortcut (.ink file) run by ShellExecute() if use RUN need get file path with FileGetShortcut() Regards, Link to comment Share on other sites More sharing options...
nwbyy Posted July 21, 2017 Author Share Posted July 21, 2017 (edited) Thanks. I'll try. Edited July 21, 2017 by nwbyy Link to comment Share on other sites More sharing options...
Trong Posted July 21, 2017 Share Posted July 21, 2017 shortcut: Run('control main.cpl,@0') ; opens the Mouse Properties Run('control main.cpl,@1') ; opens the Keyboard Properties Regards, Link to comment Share on other sites More sharing options...
nwbyy Posted July 21, 2017 Author Share Posted July 21, 2017 With Run('control main.cpl,@0') ; opens the Mouse Properties Run('control main.cpl,@1') ; opens the Keyboard Properties the windows still go background. They must be a little shy But using ShellExecute() pointing to the links, it works like a charm: ShellExecute ( "C:\My GUI\mouse.lnk" ) ShellExecute ( "C:\My GUI\keyboard.lnk" ) Thank you! What would I do without you?? Link to comment Share on other sites More sharing options...
Trong Posted July 21, 2017 Share Posted July 21, 2017 (edited) Can you try this code and tell me, it works on your Apps or not? ShellExecute('control', 'main.cpl,@0') ; opens the Mouse Properties ShellExecute('control', 'main.cpl,@1') ; opens the Keyboard Properties Edited July 21, 2017 by Trong Spell Regards, Link to comment Share on other sites More sharing options...
nwbyy Posted July 21, 2017 Author Share Posted July 21, 2017 Yes I tried. The windows open... and go background... Link to comment Share on other sites More sharing options...
nwbyy Posted July 21, 2017 Author Share Posted July 21, 2017 (edited) I'll do with ShellExecute ( "C:\My GUI\mouse.lnk" ) That's perfect for me ;-) Edited July 21, 2017 by nwbyy Link to comment Share on other sites More sharing options...
Trong Posted July 21, 2017 Share Posted July 21, 2017 (edited) try new solution without ink: expandcollapse popup#include <ColorConstantS.au3> #include <GUIConstants.au3> ; Page 1 Global $page_1_GUI = GUICreate("Menu options", @DesktopWidth, @DesktopHeight, -1, -1, $WS_POPUP) ; Couleur de fond GUISetBkColor($COLOR_BLACK) ; Insertion des images GUICtrlCreatePic("C:\My GUI\Logos options\Logo RETOUR.jpg", 37, 551, 0, 0) GUICtrlCreatePic("C:\My GUI\Logos options\Logo CLAVIER.jpg", 233, 211, 0, 0) GUICtrlCreatePic("C:\My GUI\Logos options\Logo SOURIS.jpg", 625, 211, 0, 0) ; Boutons Global $b_4 = GUICtrlCreateButton("RETOUR", 42, 680, 155, 25) Global $b_6 = GUICtrlCreateButton("CLAVIER", 238, 340, 155, 25) Global $b_14 = GUICtrlCreateButton("SOURIS", 630, 340, 155, 25) GUISetState(@SW_SHOW, $page_1_GUI) While 1 Switch GUIGetMsg() Case $GUI_EVENT_CLOSE Exit Case $b_4 Exit Case $b_6 ShellExecute('control', 'main.cpl,@0') ; opens the Mouse Properties ;~ Run('control main.cpl,@0') ; opens the Mouse Properties WinSetOnTop($page_1_GUI, "", 0) WinSetOnTop("Mouse Properties", "", 1) WinActive("Mouse Properties") WinActivate("Mouse Properties") Case $b_14 ShellExecute('control', 'main.cpl,@1') ; opens the Keyboard Properties ;~ Run('control main.cpl,@1') ; opens the Keyboard Properties WinSetOnTop($page_1_GUI, "", 0) WinSetOnTop("Keyboard Properties", "", 1) WinActive("Keyboard Properties") WinActivate("Keyboard Properties") EndSwitch WEnd Edited July 21, 2017 by Trong THE END Regards, Link to comment Share on other sites More sharing options...
nwbyy Posted July 21, 2017 Author Share Posted July 21, 2017 Thank you. But I'm afraid the problem comes back with this new code. It'll be smarter to do without creating a .lnk file. That's right. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now