Jump to content

lock gui


Recommended Posts

i want to lock Gui and this ma source. i also tried Guisetstate(@sw_lock)

here i put my source

CODE
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****

#AutoIt3Wrapper_icon=C:\Program Files\AutoIt3\Icons\filetype-blank.ico

#AutoIt3Wrapper_outfile=importanta.exe

#AutoIt3Wrapper_Allow_Decompile=n

#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <GUIConstants.au3>

#include <Misc.au3>

HotKeySet("6", "rungames")

Opt("GUIOnEventMode", 1)

#Region ### START Koda GUI section ### Form=

$Form1 = GUICreate("", 641, 450, 0, 0, BitOR($WS_MINIMIZEBOX,$WS_GROUP,$WS_CLIPSIBLINGS))

GUISetBkColor(0x800000)

GUISetOnEvent($GUI_EVENT_CLOSE, "AForm1Close")

GUISetOnEvent($GUI_EVENT_MINIMIZE, "AForm1Minimize")

GUISetOnEvent($GUI_EVENT_MAXIMIZE, "AForm1Maximize")

GUISetOnEvent($GUI_EVENT_RESTORE, "AForm1Restore")

$Pic1 = GUICtrlCreatePic("C:\pics\2.jpg", 40, 32, 193, 145, BitOR($SS_NOTIFY,$WS_GROUP))

GUICtrlSetOnEvent(-1, "APic1Click")

$Pic2 = GUICtrlCreatePic("C:\pics\3.jpg", 352, 32, 193, 145, BitOR($SS_NOTIFY,$WS_GROUP))

GUICtrlSetOnEvent(-1, "APic2Click")

$Pic3 = GUICtrlCreatePic("C:\pics\4.jpg", 40, 232, 193, 145, BitOR($SS_NOTIFY,$WS_GROUP))

GUICtrlSetOnEvent(-1, "APic3Click")

$Pic4 = GUICtrlCreatePic("C:\pics\1.jpg", 352, 232, 193, 145, BitOR($SS_NOTIFY,$WS_GROUP))

GUICtrlSetOnEvent(-1, "APic4Click")

$GtaViceCity = GUICtrlCreateButton("GtaViceCity", 40, 184, 193, 33, 0)

GUICtrlSetFont(-1, 16, 800, 0, "Times New Roman")

GUICtrlSetOnEvent(-1, "GtaViceCityClick")

$THERAGE = GUICtrlCreateButton("THERAGE", 352, 184, 193, 33, 0)

GUICtrlSetFont(-1, 16, 800, 0, "Times New Roman")

GUICtrlSetOnEvent(-1, "THERAGEClick")

$SONICHEROES = GUICtrlCreateButton("SONICHEROES", 40, 392, 193, 33, 0)

GUICtrlSetFont(-1, 16, 800, 0, "Times New Roman")

GUICtrlSetOnEvent(-1, "SONICHEROESClick")

$VIRTUAtennis = GUICtrlCreateButton("VIRTUAtennis", 352, 392, 193, 33, 0)

GUICtrlSetFont(-1, 16, 800, 0, "Times New Roman")

GUICtrlSetOnEvent(-1, "VIRTUAtennisClick")

GUISetState(@SW_SHOW)

#EndRegion ### END Koda GUI section ###

While 1

Sleep(100)

WEnd

Func AForm1Close()

EndFunc

Func AForm1Maximize()

EndFunc

Func AForm1Minimize()

EndFunc

Func AForm1Restore()

EndFunc

Func APic1Click()

EndFunc

Func APic2Click()

EndFunc

Func APic3Click()

EndFunc

Func APic4Click()

EndFunc

Func GtaViceCityClick()

run("gtb.exe")

EndFunc

Func SONICHEROESClick()

Run("shb.exe")

EndFunc

Func THERAGEClick()

Run("trb.exe")

EndFunc

Func VIRTUAtennisClick()

Run("VTb.exe")

EndFunc

Func rungames()

Send ("{enter}")

EndFunc

and alos here i put my gui image

post-24728-1185709137_thumb.jpg

i'm very responsible, when ever something goes wrong they always say I'm responsible.Life is like an Adventure... BUT COOL GRAPHICS<====================----=LEGEND KILLER=----=========================>

Link to comment
Share on other sites

Yes, I believe thats what he wants.....and I don't think @SW_LOCK would help with that at all....but what do I know (everything). I guess he could just get rid of the border with guicreate("blahblahblah", numbers no one cares about, $WS_POPUP) or something like that.

maybe looking like this:

$Form1 = GUICreate("", 641, 450, 0, 0, BitOR($WS_MINIMIZEBOX,$WS_GROUP,$WS_CLIPSIBLINGS, $WS_POPUP))
Edited by Infinitex0

The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

Link to comment
Share on other sites

Thanx and tell me one more thing how to lock this titlebar.

CODE
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****

#AutoIt3Wrapper_icon=C:\Program Files\AutoIt3\Icons\filetype-blank.ico

#AutoIt3Wrapper_outfile=coin.exe

#AutoIt3Wrapper_Allow_Decompile=n

#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

#include <GUIConstants.au3>

HotKeySet("5", "SevenUp")

HotKeySet("1", "SevenDown")

Opt("GUIOnEventMode", 1)

Global $i = 0

$myGUI = GUICreate("Coins:= 0", 641, 1, 0, 450, BitOR($WS_MINIMIZEBOX,$WS_GROUP,$WS_CLIPSIBLINGS))

GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate")

GUISetState(@SW_SHOW)

While 1

Sleep(10)

WEnd

Func Terminate()

Exit 0

EndFunc

Func SevenUp()

HotKeySet("1", "SevenDown")

$i += 1

SoundPlay(@WindowsDir & "\media\ringin.wav")

WinSetTitle("Coins:= 0", "", "Coins:= 0" & $i)

EndFunc

Func SevenDown()

if $i < 0 Then

Send("m")

EndIf

if $i > 0 Then

send ("3")

sleep(100)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

send ("3")

sleep(20)

Send("6")

Send("6")

EndIf

If $i > 0 Then

$i -= 1

Else

$i = 0

EndIf

WinSetTitle("Coins:= 0", "", "Coins:= 0" & $i)

HotKeySet("1")

$s = Sleep(60000)

HotKeySet("1", "SevenDown")

EndFunc

i'm very responsible, when ever something goes wrong they always say I'm responsible.Life is like an Adventure... BUT COOL GRAPHICS<====================----=LEGEND KILLER=----=========================>

Link to comment
Share on other sites

Not sure I understand what you want now.

The below statement is False.The above statement is True.a lesson I learned from Greenmachine; give a man a code and he'll solve one problem. Teach a man to code and he'll solve all his problems.P.S please don't use autoIt as a virus creator/spyware maker(keyLogger especially)Cick this and help me[center]My Scripts:[/center][center]Port Scanner[/center]

Link to comment
Share on other sites

i want to lock titlebar position that user can't move it from its position.

its only a titlebar

see post no. 4 for codes.

i'm very responsible, when ever something goes wrong they always say I'm responsible.Life is like an Adventure... BUT COOL GRAPHICS<====================----=LEGEND KILLER=----=========================>

Link to comment
Share on other sites

There's a sweet and easy alternative without going through a whole lot of trouble.

$myGUI = GUICreate("", 200, 25, 100, 100, $WS_POPUP,0)
GUISetFont(12,400,0,"Verdana")
GUICtrlCreateLabel("Coins:= 0", 0, 0, 200, 25)
GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate")
GUISetState(@SW_SHOW)

You should always try to find a simpler alternative, and it doesn't always turn out EXACTLY as you want it to.

Link to comment
Share on other sites

Here's a window that's stuck in it's position:

#include <GuiConstants.au3>
Global Const $WM_ENTERSIZEMOVE = 0x231
Global Const $WM_EXITSIZEMOVE = 0x232

Opt("GUIOnEventMode", 1)

$testGUI = GUICreate("Test - Stuck Window")
GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate")
GUIRegisterMsg($WM_ENTERSIZEMOVE, "OnEnterMove")
GUIRegisterMsg($WM_EXITSIZEMOVE, "OnExitMove")

Global $pos = WinGetPos($testGUI)

GUISetState()

While 1
    Sleep(10)
WEnd

Func Terminate()
    Exit 0
EndFunc

Func OnEnterMove()
    $pos = WinGetPos($testGUI)
EndFunc

Func OnExitMove()
    WinMove($testGUI, "", $pos[0], $pos[1])
EndFunc
IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

That's a pretty nice compliment coming from the likes of Manadar :)

Edited by mikehunt114
IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
Link to comment
Share on other sites

Hey, no problem. I'm just another kid with a computer. :)

So am I. If you want to make it really stuck then

#include <GuiConstants.au3>
Global Const $WM_ENTERSIZEMOVE = 0x231
Global Const $WM_EXITSIZEMOVE = 0x232

Opt("GUIOnEventMode", 1)

$testGUI = GUICreate("Test - Stuck Window")
GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate")

Global $pos = WinGetPos($testGUI)
Global Const $WM_NCHITTEST = 0x0084
GUIRegisterMsg($WM_NCHITTEST,"WM_NCHITTEST")
GUISetState()

While 1
    Sleep(10)
WEnd

Func Terminate()
    Exit 0
EndFunc


Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
    If $hWnd = $testGUI And $iMsg = $WM_NCHITTEST Then
     $id = _API_DefWindowProc($hWnd, $iMsg, $iwParam, $ilParam)
     If $id = 2 Then;if it is the title handle
       Return 1;return the client handle
   Else
       Return $id;return the real handle
   EndIf
   EndIf
          
EndFunc
   
   
Func _API_DefWindowProc($hWnd, $iMsg, $iwParam, $ilParam)
  Local $aResult

  $aResult = DllCall("User32.dll", "int", "DefWindowProc", "hwnd", $hWnd, "int", $iMsg, "int", $iwParam, "int", $ilParam)
  Return $aResult[0]
EndFunc
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

You may want to recheck that code...

What is wrong with it? It seems to work.

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

Doesn't here. Win XP SP2. Are you using Vista or an ancient version of Windows? :)

Tested it on XP SP1, XP SP2 and XP Professional. Haven't ried it on Vista or Windows 98.

What happens when you try it?

Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

i reallly Thankful to all of u. for helping me :)

i'm very responsible, when ever something goes wrong they always say I'm responsible.Life is like an Adventure... BUT COOL GRAPHICS<====================----=LEGEND KILLER=----=========================>

Link to comment
Share on other sites

Below is a script that reproduces exactly what happens.

#include <GuiConstants.au3>

Opt("GUIOnEventMode", 1)

$testGUI = GUICreate("Test - Stuck Window")
GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate")
GUISetState()

While 1
    Sleep(10)
WEnd

Func Terminate()
    Exit 0
EndFunc
I'm a bit worried that it doesn't work for you because I'm using this technique for other things and I haven't had a problem until you said it doesn't work.

Could you, or anyone lese , try the code below and then tell me the values are displayed in the label when the mouse cursor is over different components. (Over buttons and labels etc you will only get the id of the client area.)

I get-

1 = client area

2 = title bar

3 = menu icon in title

8 = minimise button

9 = maximise button

18 = a border (side or bottom)

20 = close button

EDIT: Is this affected by themes perhaps?

#include <GuiConstants.au3>

Opt("GUIOnEventMode", 1)

$testGUI = GUICreate("Test - Free Window",300,200)
$lab = GUICtrlCreateLabel("99",20,20,120,28)

GUICtrlSetFont(-1,20)

$free = GUICtrlCreateButton("free",150,100,100,28)
$fix = GUICtrlCreateButton("fix",50,100,100,28)
GUIctrlSetOnEvent($fix,"fix")
GUIctrlSetOnEvent($free,"free")
$state = GuiCtrlCreateLabel("window can be moved",80,70,200,25)
GUISetOnEvent($GUI_EVENT_CLOSE, "Terminate")

Global Const $WM_NCHITTEST = 0x0084

GUISetState()
$lastval =-1
$fixed = false

GUIRegisterMsg($WM_NCHITTEST,"WM_NCHITTEST")
While 1
    Sleep(10)
WEnd

Func Terminate()
    Exit 0
EndFunc

Func free()
    $fixed = false
    guictrlsetdata($state,"window can be moved")
EndFunc

Func fix()
$fixed = true   
guictrlsetdata($state,"window should be fixed")
EndFunc


Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
    
    
    If $hWnd = $testGUI And $iMsg = $WM_NCHITTEST Then
     $id = _API_DefWindowProc($hWnd, $iMsg, $iwParam, $ilParam)
     
;if not $fixed then return $id
     
     if $id <> $lastval Then
         guictrlsetdata($lab,$id)
         $lastval = $id
     EndIf
     
     If $id = 2 and $fixed Then;if it is the title handle
       Return 1;return the client handle
   Else
       Return $id;return the real handle
   EndIf
   EndIf
          
EndFunc
  
  
Func _API_DefWindowProc($hWnd, $iMsg, $iwParam, $ilParam)
  Local $aResult

  $aResult = DllCall("User32.dll", "int", "DefWindowProc", "hwnd", $hWnd, "int", $iMsg, "int", $iwParam, "int", $ilParam)
  Return $aResult[0]
EndFunc
Edited by martin
Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script.
Link to comment
Share on other sites

when cursor on centre of gui so its equal to 1. and on titlebar equal to 2. otherwise out of gui it value equal to 18.

Edited by L3G3NdKillEr

i'm very responsible, when ever something goes wrong they always say I'm responsible.Life is like an Adventure... BUT COOL GRAPHICS<====================----=LEGEND KILLER=----=========================>

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...