Sign in to follow this  
Followers 0
bigbangnet

displaying a button on screen

9 posts in this topic

Wrote this code so each time (when I set it up on a pc of course) the pc starts and the user logs in for the first time, they would see an image to call me so I can finish some setup procedure. everything is fine for now and the code is far from finished. here is me question, I figured out how to use the image full screen so the idiots cant click anywhere (hope their stupid enough NOT to alt tab or alt f4 lol). But if I use the macro @DesktopWidth @DesktopHeight, is there a way for me to put a button on that screen in the bottom or top. Because i I use some numbers or static numbers who know what will happen on different kinds monitor size and resolution.

In other words, I want everyone to see a button (which they could click eventually) so even if its they use a different resolution, they could still see it. Any help would be great.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Outfile=C:\Program Files (x86)\AutoIt3\Icons\NouveaupPc.exe
#AutoIt3Wrapper_Res_Comment=Richard
#AutoIt3Wrapper_Res_Fileversion=0.0.0.1
#AutoIt3Wrapper_Res_Fileversion_AutoIncrement=y
#AutoIt3Wrapper_Res_Language=1036
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

; ajouter ca a la fin de la linge  $ws_popup)
;$FrmNouveauPc = GUICreate("Nouveau Pc ", 613, 425, -1, -1,$ws_popup)

;-------------------> ne pas enlever la partie du haut  <------------------------------------------------
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=V:\Script\AutoIt\MessagePc.kxf
;$FrmNouveauPc = GUICreate("Nouveau Pc ", 806, 607, -1, -1,$ws_popup)
$FrmNouveauPc =  GUICreate("Nouveau Pc " ,@DesktopWidth,@DesktopHeight,0,0 ,$WS_POPUP)
GUISetBkColor(0x0066CC)
;$Pic1 = GUICtrlCreatePic("\\192.168.1.126\clientsapps\Script\AutoIt\Images\CallMIS.jpg", 0, 0, 804, 604)
$Pic1 = GUICtrlCreatePic("\\192.168.1.126\clientsapps\Script\AutoIt\Images\CallMIS.jpg",0,0,@DesktopWidth,@DesktopHeight)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
Case $GUI_EVENT_CLOSE
Exit

EndSwitch
WEnd

** Warning **Noobie ahead. handle with caution

Share this post


Link to post
Share on other sites



#3 ·  Posted (edited)

I have modified your script to put a very large button dead center in the screen, you can adjust as needed.

;-------------------> ne pas enlever la partie du haut  <------------------------------------------------
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#region ### START Koda GUI section ### Form=V:ScriptAutoItMessagePc.kxf
;$FrmNouveauPc = GUICreate("Nouveau Pc ", 806, 607, -1, -1,$ws_popup)
$FrmNouveauPc = GUICreate("Nouveau Pc ", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP)
GUISetBkColor(0x0066CC)
;$Pic1 = GUICtrlCreatePic("192.168.1.126clientsappsScriptAutoItImagesCallMIS.jpg", 0, 0, 804, 604)
$Pic1 = GUICtrlCreatePic("192.168.1.126clientsappsScriptAutoItImagesCallMIS.jpg", 0, 0, @DesktopWidth, @DesktopHeight)
GUICtrlSetState(-1, $GUI_DISABLE)
$Button = GUICtrlCreateButton("Test", @DesktopWidth / 2 - 100, @DesktopHeight / 2 - 100, 200, 200)
GUICtrlSetFont(-1, 45, 600)
GUISetState(@SW_SHOW)
#endregion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()
    Switch $nMsg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Button
            Exit
    EndSwitch
WEnd
Edited by BrewManNH

If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Thanks for the code. I modified the button to appear near the bottom and it works perfectly.


** Warning **Noobie ahead. handle with caution

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Ok, here is my new code with the button and the "function" to exit when the button is pressed. With the keyboard is pressed. Well, I press tab then enter and it exit but the mouse doesn't on it ? i can't press the "Quitter" button ? lol

I found the window management function in autoit but I'm a bit lost...and don't know if this is what I need.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$FrmNouveauPc = GUICreate("Nouveau Pc",@DesktopWidth,@DesktopHeight,0,0 ,$WS_POPUP)
GUISetBkColor(0x0066CC)
$Pic1 = GUICtrlCreatePic("192.168.1.126clientsappsScriptAutoItImagesCallMIS.jpg",0,0,@DesktopWidth,@DesktopHeight)
$BtnQuitter = GUICtrlCreateButton("Quitter", @DesktopWidth / 2 - 50, @DesktopHeight / 2 + 200, 100, 50, $BS_CENTER)
GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###

While 1
$nMsg = GUIGetMsg()
Switch $nMsg
case $BtnQuitter
Exit
Case $GUI_EVENT_CLOSE
Exit

EndSwitch
WEnd
Edited by bigbangnet

** Warning **Noobie ahead. handle with caution

Share this post


Link to post
Share on other sites

This should work.

#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_Res_requestedExecutionLevel=asInvoker
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
#include <ButtonConstants.au3>
#include <GUIConstantsEx.au3>
#include <StaticConstants.au3>
#include <WindowsConstants.au3>
#Region ### START Koda GUI section ### Form=
$FrmNouveauPc = GUICreate("Nouveau Pc",@DesktopWidth,@DesktopHeight,0,0 ,$WS_POPUP)
GUISetBkColor(0x0066CC)
$Pic1 = GUICtrlCreatePic("192.168.1.126clientsappsScriptAutoItImagesCallMIS.jpg",0,0,@DesktopWidth,@DesktopHeight)
GUICtrlSetState($Pic1,$GUI_DISABLE)
$BtnQuitter = GUICtrlCreateButton("Quitter", @DesktopWidth / 2 - 50, @DesktopHeight / 2 + 200, 100, 50, $BS_CENTER)
GUICtrlSetResizing(-1, $GUI_DOCKBOTTOM)
GUISetState(@SW_SHOW)
#EndRegion ### END Koda GUI section ###
While 1
   Sleep(10)
   $nMsg = GUIGetMsg()
   Switch $nMsg
   case $BtnQuitter
   Exit
   Case $GUI_EVENT_CLOSE
   Exit
   EndSwitch
WEnd

Share this post


Link to post
Share on other sites

Ahh I get it, because the $pic was "considered" enable or active (please correct my term if I'm wrong). Now I understand what you did. Thank you so much


** Warning **Noobie ahead. handle with caution

Share this post


Link to post
Share on other sites

Yup, you forgot the line GUICtrlSetState(-1, $GUI_DISABLE) after the picture was created.


If I posted any code, assume that code was written using the latest release version unless stated otherwise. Also, if it doesn't work on XP I can't help with that because I don't have access to XP, and I'm not going to.
Give a programmer the correct code and he can do his work for a day. Teach a programmer to debug and he can do his work for a lifetime - by Chirag Gude
How to ask questions the smart way!

I hereby grant any person the right to use any code I post, that I am the original author of, on the autoitscript.com forums, unless I've specifically stated otherwise in the code or the thread post. If you do use my code all I ask, as a courtesy, is to make note of where you got it from.

Back up and restore Windows user files _Array.au3 - Modified array functions that include support for 2D arrays.  -  ColorChooser - An add-on for SciTE that pops up a color dialog so you can select and paste a color code into a script.  -  Customizable Splashscreen GUI w/Progress Bar - Create a custom "splash screen" GUI with a progress bar and custom label.  -  _FileGetProperty - Retrieve the properties of a file  -  SciTE Toolbar - A toolbar demo for use with the SciTE editor  -  GUIRegisterMsg demo - Demo script to show how to use the Windows messages to interact with controls and your GUI.  -   Latin Square password generator

Share this post


Link to post
Share on other sites

Ahh I get it.... Now I understand what you did. Thank you so much

I love it when this happens! :);)

Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0