Jump to content

Recommended Posts

Is there a (simple) way to make your script using a picture-control to resize the gui?
This would be useful for a transparant pop-up window with a custom made theme using picture controls:

$Form = GUICreate('', 301, 173, 5, 5, $WS_POPUP, BitOR($WS_EX_LAYERED, $WS_EX_TOPMOST))

GUICtrlCreatePic(@scriptdir & "\resize_win.bmp", 0, 73, 20, 51)
; some api call or code telling the os to use this picture as a resize border
GUICtrlSetResizing(-1, $GUI_DOCKLEFT+$GUI_DOCKTOP+$GUI_DOCKBOTTOM+$GUI_DOCKWIDTH+$GUI_DOCKHEIGHT)
GUISetState(@SW_SHOW)

While True
    if GUIGetMsg() = $GUI_EVENT_CLOSE then Exit
WEnd

 

EDIT: to make it more clear what i wanna do, if you go with the mouse arrow over the border of a re-sizable window the arrow changes to a "resize" arrow, you click and drag the border and then the window size adjusts to the mouse position until you release the mouse button.
I want my picture control to be used the same way as the resize border to resize my window.

Edited by TheAutomator
Link to post
Share on other sites

If this is what you are looking for

;coded by UEZ
#include <Constants.au3>
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>

AutoItSetOption("GUICoordMode", 2)

Global Const $STM_SETIMAGE = 0x0172
Global $sPathKey = "HKLM64\SOFTWARE\AutoIt v3\AutoIt\"
If @OSArch = "x64" Then $sPathKey = "HKLM\SOFTWARE\Wow6432Node\AutoIt v3\AutoIt\"
Global $sImage = RegRead($sPathKey, "InstallDir") & "\Examples\GUI\logo4.gif"

_GDIPlus_Startup()
Global $hBmp = _GDIPlus_BitmapCreateFromFile($sImage)
Global $iW = _GDIPlus_ImageGetWidth($hBmp), $iH = _GDIPlus_ImageGetHeight($hBmp), $iWG = 600, $iHG = 300

Global $hGUI = GUICreate("Test", $iWG, $iHG, -1, -1, -1, $WS_EX_COMPOSITED)
Global $idPic = GUICtrlCreatePic("", ($iWG - $iW) / 2, ($iHG - $iH) / 2, $iW, $iH, -1, $WS_EX_STATICEDGE)

Global $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp)
Global $hB = GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap)
If $hB Then _WinAPI_DeleteObject($hB)
GUISetState(@SW_SHOW)

Global $aMPos, $aCPos = ControlGetPos($hGUI, "", $idPic)
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            _WinAPI_DeleteObject($hHBitmap)
            _GDIPlus_BitmapDispose($hBmp)
            _GDIPlus_Shutdown()
            GUIDelete()
            Exit
        Case $GUI_EVENT_RESTORE
            ControlMove($hGUI, "", $idPic, $aCPos[0], $aCPos[1], $aCPos[2], $aCPos[3])
    EndSwitch
    $aMPos = GUIGetCursorInfo($hGUI)
    Switch $aMPos[4]
        Case $idPic
            $aCPos = ControlGetPos($hGUI, "", $idPic)
            If $aMPos[0] = $aCPos[0] Then ;border west
                GUISetCursor(13, 1, $hGUI)
                If $aMPos[2] Then
                    While $aMPos[2]
                        $aMPos = GUIGetCursorInfo($hGUI)
                        ControlMove($hGUI, "", $idPic, $aMPos[0], $aCPos[1], $aCPos[2] + $aCPos[0] - $aMPos[0], $aCPos[3])
                    WEnd
                EndIf
            ElseIf $aMPos[0] = $aCPos[0] + $aCPos[2] Then ;border east
                GUISetCursor(13, 1, $hGUI)
                If $aMPos[2] Then
                    While $aMPos[2]
                        $aMPos = GUIGetCursorInfo($hGUI)
                        ControlMove($hGUI, "", $idPic, $aCPos[0], $aCPos[1], $aMPos[0] - $aCPos[0], $aCPos[3])
                    WEnd
                EndIf
            ElseIf $aMPos[1] = $aCPos[1] + $aCPos[3] Then ;border north
                GUISetCursor(11, 1, $hGUI)
                If $aMPos[2] Then
                    While $aMPos[2]
                        $aMPos = GUIGetCursorInfo($hGUI)
                        ControlMove($hGUI, "", $idPic, $aCPos[0], $aCPos[1], $aCPos[2], $aMPos[1] - $aCPos[1])
                    WEnd
                EndIf
            ElseIf $aMPos[1] = $aCPos[1] Then ;border south
                GUISetCursor(11, 1, $hGUI)
                If $aMPos[2] Then
                    While $aMPos[2]
                        $aMPos = GUIGetCursorInfo($hGUI)
                        ControlMove($hGUI, "", $idPic, $aCPos[0], $aMPos[1], $aCPos[2], $aCPos[3] + $aCPos[1] - $aMPos[1])
                    WEnd
                EndIf
            Else
                GUISetCursor(2, 1, $hGUI)
            EndIf
        Case Else
            GUISetCursor(2, 1, $hGUI)
    EndSwitch
WEnd

then adding the 4 corners is homework for you. ;)

Edited by UEZ

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to post
Share on other sites

Another great one from UEZ :)

In case one finds it a bit difficult to grab exactly the desired edge, it should be possible to give him some space :

; If $aMPos[0] = $aCPos[0] Then ;border west
If $aMPos[0] >= $aCPos[0] - 3 And $aMPos[0] <= $aCPos[0] + 3 Then ;border west

; a little homework for the 3 other borders :)

 

Edited by pixelsearch
Link to post
Share on other sites

its an interesting workaround for resizing a picture inside a window but i think you still not quite get what i meant..
i'm sorry if my question wasn't clear, i want to use the picture to resize the window
anyways, i maybe can alter the code so it resizes the window and not the picture

i thought the grip on the window edge was a control itself that could be placed anywhere on a window with some sort of api call, maybe a simple mousepos and winmove is the most simple solution?

Thanks for the example :)

 

Edited by TheAutomator
Link to post
Share on other sites
12 hours ago, pixelsearch said:

In case one finds it a bit difficult to grab exactly the desired edge

Well, if you hold the lmb pressed and move the mouse cursor over the frames slowly it will automatically catch it.

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to post
Share on other sites
10 hours ago, TheAutomator said:

i want to use the picture to resize the window

Sorry but I don't understand what you want exactly. 

Please don't send me any personal message and ask for support! I will not reply!

Selection of finest graphical examples at Codepen.io

The own fart smells best!
Her 'sikim hıyar' diyene bir avuç tuz alıp koşma!
¯\_(ツ)_/¯  ٩(●̮̮̃•̃)۶ ٩(-̮̮̃-̃)۶ૐ

Link to post
Share on other sites

When is the window enlarged ? When the picture hits the border ? At the moment the picture starts moving ?  How do you reduce the window ? How do we know what type of arrow cursor to use ?

I think this is the kind of questions...

Edited by Nine
Link to post
Share on other sites
1 hour ago, Nine said:

When is the window enlarged ? When the picture hits the border ? At the moment the picture starts moving ?  How do you reduce the window ? How do we know what type of arrow cursor to use ?

I think this is the kind of questions...

oh okay, well

i'm planning on using 4 pictures, top, bottom, left,right and they are on a transparent popup window.
hover over for example the right image and the horizontal resize arrow appears
when for example the mouse clicks and drags on the bottom picture, the form starts to change shape vertically at the bottom like it would if you would click-drag the bottom grip on a normal re sizable form.

the image is supposed to be saying at the bottom in this case

Edited by TheAutomator
Link to post
Share on other sites

Use the picture to trigger a WinMove, you can use the picture like you would a button control.

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

Link to post
Share on other sites

Well like @BrewManNH said you can use winmove.  I modified @UEZ script to give you an idea how it can be done...

#include <Constants.au3>
#include <GDIPlus.au3>
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include <StaticConstants.au3>

Opt ("MustDeclareVars", 1)

AutoItSetOption("GUICoordMode", 2)

Global $sPathKey = "HKLM64\SOFTWARE\AutoIt v3\AutoIt\"
If @OSArch = "x64" Then $sPathKey = "HKLM\SOFTWARE\Wow6432Node\AutoIt v3\AutoIt\"
Global $sImage = RegRead($sPathKey, "InstallDir") & "\Examples\GUI\logo4.gif"

_GDIPlus_Startup()
Global $hBmp = _GDIPlus_BitmapCreateFromFile($sImage)
Global $iW = _GDIPlus_ImageGetWidth($hBmp), $iH = _GDIPlus_ImageGetHeight($hBmp), $iWG = 600, $iHG = 300

Global $hGUI = GUICreate("Moving Pictures", $iWG, $iHG, -1, -1, -1, $WS_EX_COMPOSITED)
Global $idPic = GUICtrlCreatePic("", ($iWG - $iW) / 2, ($iHG - $iH) / 2, $iW, $iH)

Global $hHBitmap = _GDIPlus_BitmapCreateHBITMAPFromBitmap($hBmp)
Global $hB = GUICtrlSendMsg($idPic, $STM_SETIMAGE, $IMAGE_BITMAP, $hHBitmap)
If $hB Then _WinAPI_DeleteObject($hB)
GUISetState(@SW_SHOW)

Global $aMPos, $aCPos = ControlGetPos($hGUI, "", $idPic), $dx, $dy, $aWPos = WinGetPos ($hGUI)
While 1
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            _WinAPI_DeleteObject($hHBitmap)
            _GDIPlus_BitmapDispose($hBmp)
            _GDIPlus_Shutdown()
            GUIDelete()
            Exit
        Case $GUI_EVENT_RESTORE
            ControlMove($hGUI, "", $idPic, $aCPos[0], $aCPos[1], $aCPos[2], $aCPos[3])
    EndSwitch
    $aMPos = GUIGetCursorInfo($hGUI)
    if $aMPos[4] <> $idPic then ContinueLoop
    $aCPos = ControlGetPos($hGUI, "", $idPic)
    $dx = $aCPos[0]-$aMPos[0]
    $dy = $aCPos[1]-$aMPos[1]
    if $aMpos[2] then
        GUISetCursor($IDC_SIZEALL, $GUI_CURSOR_OVERRIDE, $hGUI)
        While $aMpos[2]
            $aMPos = GUIGetCursorInfo($hGUI)
            $aCPos = ControlGetPos($hGUI, "", $idPic)
            ControlMove($hGUI, "", $idPic, $aMPos[0]+$dx, $aMPos[1]+$dy, $aCPos[2], $aCPos[3])
            if $aCPos[0] < 0 then
                WinMove ($HGui, "", $aWPos[0]+$aCPos[0],$aWPos[1],$aWPos[2]-$aCPos[0],$aWPos[3])
                $aWPos = WinGetPos ($hGUI)
            endif
            if $aCPos[1] < 0 then
                WinMove ($HGui, "", $aWPos[0],$aWPos[1]+$aCPos[1],$aWPos[2],$aWPos[3]-$aCPos[1])
                $aWPos = WinGetPos ($hGUI)
            endif
        Wend
        GUISetCursor($IDC_ARROW, $GUI_CURSOR_OVERRIDE, $hGUI)
    endif
WEnd

Only done Left and Top edges, but you will be able to create the wanted script.

Link to post
Share on other sites
16 minutes ago, Nine said:

Well like @BrewManNH said you can use winmove.  I modified @UEZ script to give you an idea how it can be done...

Only done Left and Top edges, but you will be able to create the wanted script.

the picture doesn't have to move
ill try to alter the code, i think the gdi stuff is not necessary
i post my code later

Link to post
Share on other sites

If it doesn't have to move then you can do what I said, use the picture as a trigger for a function to resize the window. I didn't say it was a button, I said you can use it like a button. I don't understand why you keep saying click-drag and then saying it doesn't have to move. Either it's moving (being dragged i.e. click-drag) or it's stationary, pick one and stop moving the goals.

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

Link to post
Share on other sites
9 hours ago, BrewManNH said:

If it doesn't have to move then you can do what I said, use the picture as a trigger for a function to resize the window. I didn't say it was a button, I said you can use it like a button. I don't understand why you keep saying click-drag and then saying it doesn't have to move. Either it's moving (being dragged i.e. click-drag) or it's stationary, pick one and stop moving the goals.

i didn't move the goal, if you resize a normal window you also press the main mouse button down while resizing the window, isn't that a click drag operation until you release the mouse button?

Edited by TheAutomator
Link to post
Share on other sites

the code i end up with:

While True
    Local $win = WinGetPos($Form)
    Switch GUIGetMsg()
        Case $GUI_EVENT_CLOSE
            Exit
        Case $Left; image control on the left side of the form
            While GUIGetCursorInfo($Form)[2] = 1
                Local $y = MouseGetPos()[0] - 15; the image distance from the side of the form is 15 here
                WinMove($Form,'',$y,$win[1], $win[2] + $win[0] - $y,$win[3])
            WEnd
        Case $Top
            While GUIGetCursorInfo($Form)[2] = 1
                Local $x = MouseGetPos()[1] - 15
                WinMove($Form,'',$win[0], $x, $win[2],$win[3] + $win[0] - $x)
            WEnd
        Case $Right
            While GUIGetCursorInfo($Form)[2] = 1
                WinMove($Form,'',$win[0],$win[1], MouseGetPos()[0] - $win[0] + 15 ,$win[3])
            WEnd
        Case $Bottom
            While GUIGetCursorInfo($Form)[2] = 1
                WinMove($Form,'',$win[0],$win[1] , $win[2], MouseGetPos()[1] - $win[1] + 15)
            WEnd
    EndSwitch
WEnd

Again, sorry if i wasn't as clear as i thought, at the end i could use the code examples given by you guys and extract the necessary info from it :)

Thanks for the help!

Edited by TheAutomator
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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Similar Content

    • By Jemboy
      Hi,
      For an internal project I want to write internal script to mail some special request to an external party.
      To make it a little bit universal I decided that the user should be able to write or edit the e-mail signature.
      Because I wanted to put a logo into the e-mail, I decided to use RichEdit.

      I I found the following code by  @UEZ and adapted it a little to save and load.
      When I start the script and edit the text only, I can save and load the signature.rtf.
      However the moment I resize one of the images (with the mouse), the script wil only save the edited image.
      Somehow resizing an image deletes the other content of the RichEdit object.
      Does anyone know a solution for me?
      P.s. you need to delete signature.rtf to reset the file.
      #include <GDIPlus.au3> #include <GUIConstantsEx.au3> #include <GuiRichEdit.au3> #include <WindowsConstants.au3> Example() Func Example() Local $hGui, $iMsg, $idBtnExit, $hRichEdit $hGui = GUICreate("Example (" & StringTrimRight(@ScriptName, StringLen(".exe")) & ")", 520, 550, -1, -1) $hRichEdit = _GUICtrlRichEdit_Create($hGui, "", 10, 10, 500, 490, BitOR($ES_MULTILINE, $WS_VSCROLL, $ES_AUTOVSCROLL)) $idBtnExit = GUICtrlCreateButton("Exit", 10, 510, 40, 30) $GoodRead = False If FileExists(@ScriptDir & "\signature.rtf") Then $ResSFF = _GUICtrlRichEdit_StreamFromFile($hRichEdit, @ScriptDir & "\signature.rtf") If $ResSFF=true then $GoodRead = True EndIf If $GoodRead=False Then _GUICtrlRichEdit_InsertText($hRichEdit, "Inserting image..." & @LF & @LF) _GUICtrlRichEdit_InsertText($hRichEdit, @LF & "JPG image scaled:" & @LF & @LF) _GUICtrlRichEdit_InsertBitmap($hRichEdit, "c:\Program Files (x86)\AutoIt3\Examples\GUI\mslogo.jpg", "\qc", "\picw6747\pich1058\picwgoal6690\pichgoal1860\") ;\qc = centered _GUICtrlRichEdit_InsertText($hRichEdit, @LF & @LF & "PNG image:" & @LF & @LF) _GUICtrlRichEdit_InsertBitmap($hRichEdit, "c:\Program Files (x86)\AutoIt3\Examples\GUI\Torus.png") _GUICtrlRichEdit_InsertText($hRichEdit, @LF & @LF & "Done.") EndIf GUISetState(@SW_SHOW) While True Switch GUIGetMsg() Case $GUI_EVENT_CLOSE, $idBtnExit _GUICtrlRichEdit_StreamToFile($hRichEdit, @ScriptDir & "\signature.rtf") _GUICtrlRichEdit_Destroy($hRichEdit) ; needed unless script crashes GUIDelete() Exit EndSwitch WEnd EndFunc ;==>Example Func _GUICtrlRichEdit_InsertBitmap($hWnd, $sFile, $sFormatFunctions = "\", $sBitmapFunctions = "\", $iBgColor = Default) ;coded by UEZ build 2016-02-16 If Not FileExists($sFile) Then Return SetError(0, 0, 1) If Not _WinAPI_IsClassName($hWnd, $__g_sRTFClassName) Then Return SetError(0, 0, 2) _GDIPlus_Startup() Local $hImage = _GDIPlus_ImageLoadFromFile($sFile) If @error Then _GDIPlus_Shutdown() Return SetError(0, 0, 3) EndIf Local Const $aDim = _GDIPlus_ImageGetDimension($hImage) Local Const $hBitmap = _GDIPlus_BitmapCreateFromScan0($aDim[0], $aDim[1]), $hGfx = _GDIPlus_ImageGetGraphicsContext($hBitmap) If $iBgColor = Default Then $iBgColor = 0xFF000000 + _WinAPI_SwitchColor(_GUICtrlRichEdit_GetBkColor($hWnd)) EndIf _GDIPlus_GraphicsClear($hGfx, $iBgColor) _GDIPlus_GraphicsDrawImageRect($hGfx, $hImage, 0, 0, $aDim[0], $aDim[1]) _GDIPlus_GraphicsDispose($hGfx) Local $binStream = _GDIPlus_StreamImage2BinaryString($hBitmap, "BMP") If @error Then _GDIPlus_ImageDispose($hImage) _GDIPlus_ImageDispose($hBitmap) _GDIPlus_Shutdown() Return SetError(0, 0, 4) EndIf Local $binBmp = StringMid($binStream, 31) Local Const $binRtf = "{\rtf1\viewkind4" & $sFormatFunctions & " {\pict{\*\picprop}" & $sBitmapFunctions & "dibitmap " & $binBmp & "}\par}" ;check out http://www.biblioscape.com/rtf15_spec.htm _GUICtrlRichEdit_AppendText($hWnd, $binRtf) $binStream = 0 $binBmp = 0 _GDIPlus_ImageDispose($hImage) _GDIPlus_ImageDispose($hBitmap) _GDIPlus_Shutdown() Return 1 EndFunc ;==>_GUICtrlRichEdit_InsertBitmap Func _GDIPlus_StreamImage2BinaryString($hBitmap, $sFormat = "JPG", $iQuality = 80, $bSave = False, $sFileName = @ScriptDir & "\Converted.jpg") ;coded by UEZ 2013 build 2014-01-25 (based on the code by Andreik) Local $sImgCLSID, $tGUID, $tParams, $tData Switch $sFormat Case "JPG" $sImgCLSID = _GDIPlus_EncodersGetCLSID($sFormat) $tGUID = _WinAPI_GUIDFromString($sImgCLSID) $tData = DllStructCreate("int Quality") DllStructSetData($tData, "Quality", $iQuality) ;quality 0-100 Local $pData = DllStructGetPtr($tData) $tParams = _GDIPlus_ParamInit(1) _GDIPlus_ParamAdd($tParams, $GDIP_EPGQUALITY, 1, $GDIP_EPTLONG, $pData) Case "PNG", "BMP", "GIF", "TIF" $sImgCLSID = _GDIPlus_EncodersGetCLSID($sFormat) $tGUID = _WinAPI_GUIDFromString($sImgCLSID) Case Else Return SetError(1, 0, 0) EndSwitch Local $hStream = _WinAPI_CreateStreamOnHGlobal() ;http://msdn.microsoft.com/en-us/library/ms864401.aspx If @error Then Return SetError(2, 0, 0) _GDIPlus_ImageSaveToStream($hBitmap, $hStream, DllStructGetPtr($tGUID), DllStructGetPtr($tParams)) If @error Then Return SetError(3, 0, 0) Local $hMemory = _WinAPI_GetHGlobalFromStream($hStream) ;http://msdn.microsoft.com/en-us/library/aa911736.aspx If @error Then Return SetError(4, 0, 0) Local $iMemSize = _MemGlobalSize($hMemory) If Not $iMemSize Then Return SetError(5, 0, 0) Local $pMem = _MemGlobalLock($hMemory) $tData = DllStructCreate("byte[" & $iMemSize & "]", $pMem) Local $bData = DllStructGetData($tData, 1) _WinAPI_ReleaseStream($hStream) ;http://msdn.microsoft.com/en-us/library/windows/desktop/ms221473(v=vs.85).aspx _MemGlobalFree($hMemory) If $bSave Then Local $hFile = FileOpen($sFileName, 18) If @error Then Return SetError(6, 0, $bData) FileWrite($hFile, $bData) FileClose($hFile) EndIf Return $bData EndFunc ;==>_GDIPlus_StreamImage2BinaryString  
       
    • By Aapjuh
      Hi,
      I am having a problem properly saving the Width of a resizable Gui.
      When a user resizes the Gui it gets saved in an ini when the Gui closes to then restore the new Width upon reopening the app.
      with GUICreate("myGui",300,200,Default,Default,$WS_SIZEBOX)
      WinGetPos($hGUI) returns 314, and WinGetClientSize($hGUI) returns 298
      when its then saved in the ini the gui keeps expanding or shrinking every time its opened by +14 or -2
      I figure it has to do with borders etc, but i also guess borders depend on the window theme and whatnot or is user specific, so i can't just do $GuiWidth = $GetGuiWidth[arr] -14 or +2 right?

      is there a proper way of doing this?
      Thanks in advance,
      Aapjuh
    • By nacerbaaziz
      hello guys, please i need your help
      am trying to work with CreateWindowEx api, i created the window with it controls, also i setup the call back function
      i'am using WinMSGLoop to focus with the keyboard.
      here i have a problem, i hope that you can help me.
      on the controls i used the UDF that comme with the autoit, such as _GUIButton_Create, _GUIListBox_Create....
      but i can't find a STATIC control UDF, for that i used this

      local $h_ssrvlbl = _WinAPI_CreateWindowEx(0, "STATIC", "الخادم", BitOr($WS_VISIBLE, $WS_CHILD, $WS_CLIPSIBLINGS, $WS_CLIPCHILDREN), 250, 10, 100, 20, $hWnd)
      as you can see here, there is an arabic text, so here is the problem, the arabic text isn't show normally, what is the problem here?
      also i have  an other question about keyboard focus, when i used WinMSGLoop, it worked, but if i press alt+tab to switch windows or focus an other window and return back to my window, the focus of control is kill.
      can any one help me to solve that please?
      my code will be as file here with the include files
      i hope can any one help me here
      thanks in advance
       
      speed Test win.zip
    • By shelly
      Here is the below code for handling pop-up when window is  inactive ..but I don't know how to change sleep and when i run this script it runs sometimes and sometimes it stops .
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{SPACE}")
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{DOWN}")
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{ENTER}")
      --- these 3 lines never worked while TAB lines works sometimes but not in accurate way
      I am new too AutoIt .. help me out why this script behaves in strange way
      ControlFocus("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1")
      Sleep(3000)
      ControlSend("Policy Decisions -- Webpage Dialog", "", "Internet Explorer_Server1","1")
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{TAB}")
      ControlSend("Policy Decisions -- Webpage Dialog", "", "Internet Explorer_Server1","the request is send")
      Sleep(3000)
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{TAB}")
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{TAB}")
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{TAB}")
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{TAB}")
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{TAB}")
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{TAB}")
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{TAB}")
      Sleep(3000)
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{TAB}")
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{TAB}")
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{TAB}")
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{TAB}")
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{TAB}")
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{TAB}")
      Sleep(3000)
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{TAB}")
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{TAB}")
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{SPACE}")
      Sleep(3000)
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{TAB}")
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{TAB}")
      Sleep(3000)
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{TAB}")
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{TAB}")
      Sleep(3000)
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{TAB}")
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{DOWN}")
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{TAB}")
      Sleep(3000)
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{TAB}")
      ControlSend("Policy Decisions -- Webpage Dialog","","Internet Explorer_Server1","{ENTER}")
       
    • By Cengokill
      Hi everyone,
      I have created a ListView that is in a tab, and I want to display an image in that tab, with the ListView on top.
      However, the image still appears on top of my ListView.
      If I remove the tabs everything works. 
      I looked at the autoit documentation and the <GuiListView.au3> documentation , I can't figure out how to display a background image, and put on top a ListView, inside a tab. 😥
      Here is the code:
      Opt("GUIOnEventMode", 1) $Form1 = GUICreate($Titre, 700, 627, $Form1Width, $Form1Height); main window $tabulation = GUICtrlCreateTab(148,0,700,580); creating tabs $tab1=GUICtrlCreateTabItem("Tab 1"); first tab GUICtrlSetState(-1, $GUI_SHOW); this tab is selected by default $Pic1 = GUICtrlCreatePic("image.jpg", 0, 30, 700, 627) GUICtrlSetState(-1, $GUI_DISABLE). $idListview = GUICtrlCreateListView("list 1|list 2|list 3", 200, 50, 390, 200) GUISetState(@SW_SHOW) While 1     Sleep(100) WEnd Thank you in advance.

×
×
  • Create New...