Jump to content

Autoitte Taşınabilir Pencere Nasıl Yapılır?


x_files_x
 Share

Recommended Posts

Mrb arkadaşlar ben bu örneği deneme olarak yaptım bişi için, ancak bunu nasıl istedigim zaman taşıma özelligi koyucam, pencere sabit hareket etmiyor birde scripti açınca alttaki görev cubugunda olmasın istiyorum, yardım edebilecek varmı acaba?

#include <GUIConstants.au3>
#include <WindowsConstants.au3>

GUICreate('Defuse', 75, 67, 1200, 200, $WS_POPUP, $WS_EX_TOPMOST)
    $gob = GUICtrlCreateButton('Kapat', 2, 2, 70, 62)
    GUISetState()

While 1
	While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $gob
			Exit
	EndSwitch
WEnd
WEnd
Edited by x_files_x
Link to comment
Share on other sites

#include <GUIConstants.au3>
#include <WindowsConstants.au3>

#NoTrayIcon

GUICreate('Defuse', 75, 67, 1200, 200, "", $WS_EX_TOPMOST)
    $gob = GUICtrlCreateButton('Kapat', 2, 2, 70, 62)
    GUISetState()

While 1
	While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $GUI_EVENT_CLOSE
			Exit
		Case $gob
			Exit
	EndSwitch
WEnd
WEnd
Link to comment
Share on other sites

Senin sorunun cevabı burada 

http://www.tnctr.com/topic/201260-tathynabilir-pencere-nasyl-yapylyr/

 

veya

#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate('Defuse', 75, 67, 1200, 200, _
BitOR($WS_SIZEBOX, $WS_POPUP), BitOR($WS_EX_DLGMODALFRAME, $WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
$gob = GUICtrlCreateButton('Kapat', 2, 2, 70, 62)
GUIRegisterMsg(0x0201, "moveGUI")
GUISetState(@SW_SHOW)
GUISetBkColor(0x3CC2BD)


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

Func MoveGUI($hW)
DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $Form1, "uint", 0x0112, "wparam", 0xF012, "lparam", 0)
EndFunc
Edited by MeHMeTBeN
Link to comment
Share on other sites

#NoTrayIcon
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$Form1 = GUICreate('Defuse', 75, 67, 1200, 200, _
		BitOR($WS_SIZEBOX, $WS_POPUP), BitOR($WS_EX_DLGMODALFRAME, $WS_EX_DLGMODALFRAME, $WS_EX_CLIENTEDGE, $WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))
$gob = GUICtrlCreateButton('Kapat', 2, 2, 70, 62)
GUIRegisterMsg(0x0201, "MoveGUI")
GUISetState(@SW_SHOW)
GUISetBkColor(0x3CC2BD)


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

Func MoveGUI()
	DllCall('user32.dll', 'int', 'SendMessage', 'hWnd', $Form1, 'int', 0x00A1, 'int', 2, 'int', 0)
EndFunc   ;==>MoveGUI

VEYA


#include <GUIConstants.au3>
#include <WindowsConstants.au3>

$GUI = GUICreate('Defuse', 75, 67, 1200, 200, $WS_POPUP, $WS_EX_TOPMOST)
$gob = GUICtrlCreateButton('Kapat', 2, 2, 70, 62)
GUIRegisterMsg($WM_NCHITTEST, "WM_NCHITTEST")
GUISetState()


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

	EndSwitch
WEnd


Func WM_NCHITTEST($hWnd, $iMsg, $iwParam, $ilParam)
	If ($hWnd = $GUI) And ($iMsg = $WM_NCHITTEST) Then Return $HTCAPTION
EndFunc   ;==>WM_NCHITTEST

 
 
Yeni farkettim MostWanted ın dediği gibi ucundan sürekleyerek oluyor maalesef.

Edited by SimpsoN_Bart
Link to comment
Share on other sites

Taşınabiliyor. Diğeri sadece kenarlık ekledi falan deme onları kaldırabilirsin.Hiç GuiCreate'in attiributelarına bakmıyor musun?

#include <GUIConstants.au3>
#include <WindowsConstants.au3>

$hGUI=GUICreate('Defuse', 105, 67, 1200, 200,$WS_POPUP, BitOR($WS_EX_TOPMOST, $WS_EX_TOOLWINDOW))

$gob = GUICtrlCreateButton('Kapat', 2, 2, 70, 62)
GUIRegisterMsg(0x0201, "moveGUI")
GUISetState(@SW_SHOW)
GUISetState()

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

Func MoveGUI($hW)
DllCall("user32.dll", "lresult", "SendMessageW", "hwnd", $hGUI, "uint", 0x0112, "wparam", 0xF012, "lparam", 0)
EndFunc

Burdaki tek sorun şu ki sadece objeye tutularak taşınamıyor.Yani Gui'de sadece buton objesi olunca sağa sola sürükleyemiyorsun onu azıcık ucundan boşluk olmalı ki ordan sürükleyebilesin.Sorununu çözebilecek bir örnek vardı hatırlıyorum fakat araştırmam gerekli.

Link to comment
Share on other sites

#NoTrayIcon
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>
Global $form1 = GUICreate("Defuse", 75, 67, 1200, 200, -2146959360, $WS_EX_TOOLWINDOW)
$gob = GUICtrlCreateButton('Kapat', 2, 2, 70, 62)
GUIRegisterMsg(0x0201, "mehmetben_WinMove1")
WinSetTrans($form1, "", 170)
WinSetOnTop($form1, "", 1)
GUISetState(@SW_SHOW)
GUISetBkColor (0xffffff)
While 1
	$nMsg = GUIGetMsg()
	Switch $nMsg
		Case $gob, -3
			Exit
               EndSwitch
 WEnd
Func mehmetben_WinMove1($hwnd)
	If BitAND(WinGetState($hwnd), 32) Then Return "GUI_RUNDEFMSG"
	DllCall("user32.dll", "long", "SendMessage", "hwnd", $hwnd, "int", 0x0112, "int", 0xF009, "int", 0)
EndFunc

istediğin bu sanırım   :)

Edited by MeHMeTBeN
Link to comment
Share on other sites

Üstte yazılanlarla aynı işi yapıyor mehmetben yani bi farkı yok arkadaşın isteği direk butonun taşınması ucundan tutulup taşınması değil yani bu fonksiyonu da hatırlıyorum sanki genelde bluelife "GUI_RUNDEFMSG" kullanır da :D

Link to comment
Share on other sites

@reyiz dediğin doğru çünkü default değerler buna izin veriyor ama arkadaşın guisi özel bir gui onda taşınamıyor.

 

@mehmetben zaten o kodlar yukarda verilmiş.

 

Edit:Simpson zaten söylemiş neyse.

Edited by MostWanted
Link to comment
Share on other sites

Üstte yazılanlarla aynı işi yapıyor mehmetben yani bi farkı yok arkadaşın isteği direk butonun taşınması ucundan tutulup taşınması değil yani bu fonksiyonu da hatırlıyorum sanki genelde bluelife "GUI_RUNDEFMSG" kullanır da :D

bence objeyi tutarak taşıyamaz formdaki  objeler çalışmaz ozaman yani eğer öyle bir fonksiyon katılırsa :(

Link to comment
Share on other sites

Taşınıyormuş  :facepalm:

#include <GuiconstantsEx.au3>
 #include <WindowsConstants.au3>
 
 HotKeySet("{ESC}", "On_Exit")
 
 $hGUI = GUICreate("X", 100, 100, -1, -1, $WS_POPUP)
 GUISetBkColor(0xFF0000, $hGUI)
 $hLabel = GUICtrlCreateLabel("", 0, 0, 100, 50, -1, $GUI_WS_EX_PARENTDRAG)
 GUICtrlSetBkColor(-1, 0x00FF00)
 ;GUICtrlSetState(-1, $GUI_DISABLE)
 $hButton = GUICtrlCreateButton("Test", 10, 35, 80, 30)
 GUISetState()
 
 While 1
     Switch GUIGetMsg()
         Case $hButton
             On_Button()
     EndSwitch
 WEnd
 
 Func On_Button()
     MsgBox(0, "Hi", "Button Pressed")
 EndFunc   ;==>On_Button
 
 Func On_Exit()
     Exit
 EndFunc   ;==>On_Exit
Link to comment
Share on other sites

Hepinize cevaplarınız için tşk ederim, kuusra bakmayın ben acemi oldugum icin bilmedigim cok sey var, tıpkı guicreat in o yanındakilerin ne anlama geldikleri gibi, bilseydim zaten ben ordan yapardım, yardımlarınız icin tşk ederim, sanırım buton tutularak taşınmıyormus, bunuda öğrenmiş oldum

Link to comment
Share on other sites

#include <GuiconstantsEx.au3>
 #include <WindowsConstants.au3>

 HotKeySet("{ESC}", "On_Exit")

 $hGUI = GUICreate("X", 100, 100, -1, -1, $WS_POPUP)
 GUISetBkColor(2368804, $hGUI)
 $hLabel = GUICtrlCreateLabel("", 0, 0, 100, 20, -1, $GUI_WS_EX_PARENTDRAG)
;~  GUICtrlSetBkColor(-1, 0x00)
 ;GUICtrlSetState(-1, $GUI_DISABLE)
 $hButton = GUICtrlCreateButton("Test", 2, 2, 95, 95)
 GUISetState()

 While 1
     Switch GUIGetMsg()
         Case $hButton
             On_Button()
     EndSwitch
 WEnd

 Func On_Button()
     Exit
 EndFunc   ;==>On_Button

 Func On_Exit()
     Exit
 EndFunc   ;==>On_Exit

 

böyle bişi yaptım üstten taşınıyor

Link to comment
Share on other sites

Arkadaslar buldum, eğer lazım olur die düsünüyorsanız buyrun, hepinize çok tşk ederim,

#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <Misc.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Global Const $SC_DRAGMOVE = 0xF012

HotKeySet('{ESC}', '_Exit')

Example()

Func Example()
    Local $hGUI = GUICreate('', 100, 100, Default, Default, $WS_POPUP)
    _WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF)

    Local $iButton = GUICtrlCreateButton('Drag me', 0, 0, 100, 100)
    GUISetState(@SW_SHOW, $hGUI)

    Local $aCtrlCursor = 0, $aMousePos = 0, _
            $fMove = False, _
            $iBefore = 0
    While 1
        Switch GUIGetMsg()
            Case $iButton
                MsgBox($MB_SYSTEMMODAL, '', 'Button click')
                ; ExitLoop

            Case $GUI_EVENT_PRIMARYDOWN
                $aCtrlCursor = GUIGetCursorInfo($hGUI)
                $aMousePos = MouseGetPos()
                $fMove = False
                $iBefore = $aMousePos[0] + $aCtrlCursor[0] + $aMousePos[1] + $aCtrlCursor[1] ; Detect the co-ordinates before.

                While _IsPressed(01)
                    WinMove($hGUI, '', $aMousePos[0] - $aCtrlCursor[0], $aMousePos[1] - $aCtrlCursor[1])
                    ; _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, False)
                    ; If the co-ordinates are different then it moved.
                    $fMove = Not ($aMousePos[0] + $aCtrlCursor[0] + $aMousePos[1] + $aCtrlCursor[1] = $iBefore)
                    $aMousePos = MouseGetPos()
                    If @error Then ExitLoop
                WEnd

                ; If it moved clear the button message.
                If $fMove Then
                    Do ; Clear the button message.
                    Until GUIGetMsg() = 0
                EndIf

        EndSwitch
    WEnd

    GUIDelete($hGUI)
EndFunc   ;==>Example

Func _Exit()
    Exit
EndFunc   ;==>_Exit
Link to comment
Share on other sites

  • 1 yıl yıl...

 

Arkadaslar buldum, eğer lazım olur die düsünüyorsanız buyrun, hepinize çok tşk ederim,

#include <Constants.au3>
#include <GUIConstantsEx.au3>
#include <Misc.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>

Global Const $SC_DRAGMOVE = 0xF012

HotKeySet('{ESC}', '_Exit')

Example()

Func Example()
    Local $hGUI = GUICreate('', 100, 100, Default, Default, $WS_POPUP)
    _WinAPI_SetLayeredWindowAttributes($hGUI, 0xABCDEF)

    Local $iButton = GUICtrlCreateButton('Drag me', 0, 0, 100, 100)
    GUISetState(@SW_SHOW, $hGUI)

    Local $aCtrlCursor = 0, $aMousePos = 0, _
            $fMove = False, _
            $iBefore = 0
    While 1
        Switch GUIGetMsg()
            Case $iButton
                MsgBox($MB_SYSTEMMODAL, '', 'Button click')
                ; ExitLoop

            Case $GUI_EVENT_PRIMARYDOWN
                $aCtrlCursor = GUIGetCursorInfo($hGUI)
                $aMousePos = MouseGetPos()
                $fMove = False
                $iBefore = $aMousePos[0] + $aCtrlCursor[0] + $aMousePos[1] + $aCtrlCursor[1] ; Detect the co-ordinates before.

                While _IsPressed(01)
                    WinMove($hGUI, '', $aMousePos[0] - $aCtrlCursor[0], $aMousePos[1] - $aCtrlCursor[1])
                    ; _SendMessage($hGUI, $WM_SYSCOMMAND, $SC_DRAGMOVE, False)
                    ; If the co-ordinates are different then it moved.
                    $fMove = Not ($aMousePos[0] + $aCtrlCursor[0] + $aMousePos[1] + $aCtrlCursor[1] = $iBefore)
                    $aMousePos = MouseGetPos()
                    If @error Then ExitLoop
                WEnd

                ; If it moved clear the button message.
                If $fMove Then
                    Do ; Clear the button message.
                    Until GUIGetMsg() = 0
                EndIf

        EndSwitch
    WEnd

    GUIDelete($hGUI)
EndFunc   ;==>Example

Func _Exit()
    Exit
EndFunc   ;==>_Exit

 

 

gerçekten kullanışlı,

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...