Jump to content

Recommended Posts

Posted

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.

Posted

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.

Posted

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 :lol:

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?? ;)

Posted (edited)

try new solution without ink:
 

#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 by Trong
THE END

Enjoy my work? Buy me a 🍻 or tip via ❤️ PayPal

Posted

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.

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...