Sign in to follow this  
Followers 0
zeroZshadow

Picture gui

13 posts in this topic

Question: is it possible to make a GUI like the wmp in my screenshot here.

if so, HOW??

p.s. nice skin he :)


*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

well i made something little, but the problem is that i just can't move it.

anyone a sollution??

GUIV1.zip

Edited by zeroZshadow

*If u thought life couldn't get worse, u meet me *<guy> What would you give my little sister to unzip ?<friend> 10 bucks<guy> No, i mean like Winzip...

Share this post


Link to post
Share on other sites

well i made something little, but the problem is that i just can't move it.

anyone a sollution??

GUIV1.zip

<{POST_SNAPBACK}>

;// Constants
$HTCAPTION = 2
$WM_NCLBUTTONDOWN = 0xA1

Calls

DllCall ("user32.dll", "int", "ReleaseCapture")
DllCall ("user32.dll", "int", "SendMessage", "hwnd", $HandleWindow, "int", $WM_NCLBUTTONDOWN, "int", $HTCAPTION, "int", 0)

Share this post


Link to post
Share on other sites

Nice one Josbe !

I was searching for that func for a couple of days ago.

Thanks !

Share this post


Link to post
Share on other sites

I've had that one in one of my scripts for awhile, not sure who the original creator is though :)


FootbaG

Share this post


Link to post
Share on other sites

;// Constants
$HTCAPTION = 2
$WM_NCLBUTTONDOWN = 0xA1

Calls

DllCall ("user32.dll", "int", "ReleaseCapture")
DllCall ("user32.dll", "int", "SendMessage", "hwnd", $HandleWindow, "int", $WM_NCLBUTTONDOWN, "int", $HTCAPTION, "int", 0)

<{POST_SNAPBACK}>

I am not sure where to put this fabulous piece of code int the attach code :)

Share this post


Link to post
Share on other sites

I am not sure where to put this fabulous piece of code int the attach code :)

<{POST_SNAPBACK}>

Const $HTCAPTION = 2

Const $WM_NCLBUTTONDOWN = 0xA1

GUISetOnEvent ($GUI_EVENT_PRIMARYDOWN, "Drag" )

Func Drag()

dllcall("user32.dll","int","ReleaseCapture")

dllcall("user32.dll","int","SendMessage","hWnd", $gui,"int",$WM_NCLBUTTONDOWN,"int", $HTCAPTION,"int", 0)

EndFunc

I'm using it this way, so maybe UDF function with similar name _Drag()

somewhere in INCLUDE directory

and maybe as parameter should be window to drag

and maybe constants inside this function ...

Share this post


Link to post
Share on other sites

Const $HTCAPTION = 2

Const $WM_NCLBUTTONDOWN = 0xA1

GUISetOnEvent ($GUI_EVENT_PRIMARYDOWN, "Drag" )

Func Drag()

    dllcall("user32.dll","int","ReleaseCapture")

    dllcall("user32.dll","int","SendMessage","hWnd", $gui,"int",$WM_NCLBUTTONDOWN,"int", $HTCAPTION,"int", 0)

EndFunc

I'm using it this way, so maybe UDF function with similar name _Drag()

somewhere in INCLUDE directory

and maybe as parameter should be window to drag

and maybe constants inside this function ...

<{POST_SNAPBACK}>

Funny you need to click on the button to drag ... Then it suppresse the quit function

Share this post


Link to post
Share on other sites

Funny you need to click on the button to drag ... Then it suppresse the quit function

<{POST_SNAPBACK}>

Just dont use the opt(OnEventMode,1)

#include <GUIConstants.au3>
Global Const $HTCAPTION = 2
Global Const $WM_NCLBUTTONDOWN = 0xA1
;GUI
$guiwin = GUICreate("GuiTest", 300,300,30,30,$WS_POPUP,0x00080000)

$B2 = GUICtrlCreateButton("quit",200,100,50,50,-1,0x00000020)
$Background = GUICtrlCreatePic("Back.gif",0,0,300,300,-1,0x00000020)
GUISetState(@SW_SHOW)


GuiCtrlSetState($B2,$GUI_FOCUS)

While 1
    $msg = GUIGetMsg()
    Select
        Case $msg = $B2
            Exit
        Case $msg = $Background
            _GUISkinnedMove($Background,$guiwin)
    EndSelect
    sleep(10)
WEnd

;===============================================================================
;
; Description:      _GUISkinnedMove
; Parameter(s):     $ControlID
;                   $hwnd
; Requirement:      None
; Return Value(s):  None
; User CallTip:     Event to handle the moving of a gui (for use of a _GUISkinnedCtrlCreateCaptionBar control)
; Author(s):        TumbleWeed (tumbleweed_0999@hotmail.com)
; Note(s):          None
;
;===============================================================================
Func _GUISkinnedMove($ControlID,$hwnd)
    ConsoleWrite('@@ (227) :(' & @MIN & ':' & @SEC & ') _GUISkinnedMove()' & @CR);### Trace Function 
    $CursorInf = GUIGetCursorInfo($hwnd)
    While $CursorInf[2]
        DllCall("user32.dll", "long", "ReleaseCapture")
        DllCall("user32.dll", "long", "SendMessage", "hwnd", $hwnd, "int", $WM_NCLBUTTONDOWN, "int", $HTCAPTION, "int", 0)
        $CursorInf = GUIGetCursorInfo($hwnd)
    WEnd
EndFunc  ;==>_GUISkinnedMove

I'm making a GUISkinned UDF, the opt(OnEventMode,1) is to limmited for some stuff (this func is one off the 21 funcs i have now, some not woking the way i want it)

Working on this for a while (somtimes that is :) )

Share this post


Link to post
Share on other sites

Thanks

Good luck with yours UDFs :)

Share this post


Link to post
Share on other sites

I dont know why you need to use the "ReleaseCapture" but it work without.

the 0x00000020 does not have any effect it is the transparency of the .gif which do the job.

It is a good habit to use the GuiConstants.au3 when they exist so

0x00080000 can be replaced by $WS_EX_LAYERED which is exactly what GUICtrlCreatePic doc say. :)

Share this post


Link to post
Share on other sites

I dont know why you need to use the "ReleaseCapture" but it work without.

the 0x00000020 does not have any effect it is the transparency of the .gif which do the job.

It is a good habit to use the GuiConstants.au3 when they exist so

0x00080000 can be replaced by $WS_EX_LAYERED which is exactly what GUICtrlCreatePic doc say. :)

<{POST_SNAPBACK}>

was just a quick copy of zeroZshadow's code + my function

The "ReleaseCapture" is there because i grabed the code from the net (some VB code), it was used there and i dont know the purpose of it and never tested without. Maybe it has it's use in VB and not in AutoIt

MSDN Doc's say:

The ReleaseCapture function releases the mouse capture from a window in the current thread and restores normal mouse input processing. A window that has captured the mouse receives all mouse input, regardless of the position of the cursor, except when a mouse button is clicked while the cursor hot spot is in the window of another thread.

Share this post


Link to post
Share on other sites

Funny you need to click on the button to drag ... Then it suppresse the quit function

<{POST_SNAPBACK}>

You are right.

I used it only with my very simple GUI only with progress control and without

any window title bar or another controls. It's a part of my tray based application.

So in my simple app it's working fine, but in more complicated apps

it must be more exactly handled as TuMbLeWeEd wrote.

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