Hallo Zusammen,
ich habe mal ein altes Script ausgekrahmt, mit dem man über einen Button in der GUI Titelleiste machen kann! Ähnlich dem Programm Hardcopy!
Hier sind noch paar schönheitsfehler drin!
- wenn die button [min/max/close] nicht da sind, springt die hardcopy button außerhalb der gui!
- der zusätzliche button braucht manchmal etwas, bis er an der richtigen stelle sitzt!
nun die frage, wie kann man das am einfachsten lösen?
Spoiler anzeigen
#include <GUIConstants.au3>
#include <ButtonConstants.au3>
#include <WindowsConstants.au3>
#include <WinAPI.au3>
#include <Constants.au3>
#include <File.au3>
#include <ScreenCapture.au3>
#include <GUIConstantsEx.au3>
#include <GuiButton.au3>
;#NoTrayIcon
[/autoit] [autoit][/autoit] [autoit];DllCall("UxTheme.dll","int","SetThemeAppProperties","dword",0)
$GUI = GUICreate('',16,16,-1,-1,$WS_POPUP,$WS_EX_TOPMOST+$WS_EX_TOOLWINDOW)
GUISetBkColor(_WinAPI_GetSysColor($COLOR_ACTIVEBORDER))
$Button = GUICtrlCreateButton("2",1,2,14,14,$BS_CENTER)
;$Button = GUICtrlCreateButton("",1,2,30,14,$BS_CENTER +$BS_ICON)
;_GUICtrlButton_SetImage($Button, "shell32.dll", 181, True)
GUICtrlSetFont($Button,12,400,0,"Wingdings")
;DllCall("UxTheme.dll","int","SetThemeAppProperties","dword",3)
GUISetState(@SW_SHOWNOACTIVATE)
;Opt("TrayMenuMode",1)
;TrayTip("ScreenShot-Tool:", "zum Erstellen von Windows ScreenShots.", 5, 1)
;TraySetIcon("shell32.dll", 181)
TraySetState()
$hwnd = -1
$w = 0
CheckWin()
AdlibRegister("CheckWin",10)
While 1
$msg = GUIGetMsg()
Select
Case $msg = $GUI_EVENT_CLOSE
AdlibUnRegister("CheckWin")
Exit
Case $msg = $Button
;MsgBox(0, '', "hi")
Capture() ; erstellt screenshot
[/autoit] [autoit][/autoit] [autoit]WinActivate($hwnd)
Case $hwnd <> $GUI And WinExists($hwnd)
$pos = WinGetPos($hwnd)
WinMove($GUI,"",$pos[0]+$pos[2]-$w,$pos[1]+4)
EndSelect
WEnd
Func CheckWin()
Local $hwnd1 = WinGetHandle("")
If $hwnd1 <> $GUI And $hwnd <> $hwnd1 Then
Global $hwnd = $hwnd1
$Style = _WinAPI_GetWindowLong($hwnd,$GWL_STYLE)
$w = 5
If BitAND($Style,$WS_MINIMIZEBOX) Then $w += 30
If BitAND($Style,$WS_SYSMENU) Then $w += 35
If BitAND($Style,$WS_MAXIMIZEBOX) Then $w += 30
EndIf
EndFunc
; function capture screenshot
Func Capture()
; Capture full screen
If FileExists(@MyDocumentsDir & "\screenshot") Then
;MsgBox(4096, "C:\autoexec.bat File", "Exists")
Else
;MsgBox(4096,"C:\autoexec.bat File", "Does NOT exists")
DirCreate(@MyDocumentsDir & "\screenshot")
EndIf
;FileDelete(@MyDocumentsDir & "\Printscreen*.*"
_ScreenCapture_Capture(@MyDocumentsDir & "\screenshot\screenshot.jpg")
;MsgBox(0, "", "Screenshot erstellt!", 1)
EndFunc ;==>Capture_start
[/autoit]danke
gruß gmmg