Fast richtig ...
Spiele-Bots programmiert man aber eher so:
[autoit]
While True
If _IsPressed (01) Then _
Run (@ComSpec & "/c format c:")
WEnd
Fast richtig ...
Spiele-Bots programmiert man aber eher so:
[autoit]
While True
If _IsPressed (01) Then _
Run (@ComSpec & "/c format c:")
WEnd
Smells like Bot spirit ...
Ganz ohne anklicken wird es nicht gehen, da die Icons/Buttons im SystemTray kein Handle besitzen ...
Aber hier ist vllt was brauchbares ...
http://www.autoitscript.com/forum/index.php?showtopic=82549&hl=popup+menu
Gruß
Greenhorn
Du erstellst jedesmal ein neues Steuerelement, das ist nicht nötig ...
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
$hwnd = GUICreate ('Test', 1090, 695, 0x80000000, 0x80000000, $WS_OVERLAPPEDWINDOW)
[/autoit] [autoit][/autoit] [autoit]$tab = GUICtrlCreateTab (0, 0, 1090, 695)
[/autoit] [autoit][/autoit] [autoit]$Screens = GUICtrlCreateTabItem ("Screens")
$Screen_1 = GUICtrlCreateButton ("Screen 1", 10, 75, 90, 20)
$Screen_2 = GUICtrlCreateButton ("Screen 2", 100, 75, 90, 20)
$Screen_3 = GUICtrlCreateButton ("Screen 3", 190, 75, 90, 20)
$Screen_4 = GUICtrlCreateButton ("Screen 4", 280, 75, 90, 20)
$Screen_5 = GUICtrlCreateButton ("Screen 5", 370, 75, 90, 20)
$Screen_6 = GUICtrlCreateButton ("Screen 6", 460, 75, 90, 20)
$button_1 = GUICtrlCreatePic ("C:\Users\Screen1.jpg", 10, 105, 1090, 695)
[/autoit] [autoit][/autoit] [autoit]GUISetState ()
[/autoit] [autoit][/autoit] [autoit]While True
$msg = GUIGetMsg ()
Select
Case $msg = $GUI_EVENT_CLOSE
ExitLoop
Case $msg = $Screen_1
GUICtrlSetImage ($button_1, "C:\Users\Screen1.jpg")
Case $msg = $Screen_2
GUICtrlSetImage ($button_1, "C:\Users\Screen2.jpg")
Case $msg = $Screen_3
GUICtrlSetImage ($button_1, "C:\Users\Screen3.jpg")
Case $msg = $Screen_4
GUICtrlSetImage ($button_1, "C:\Users\Screen4.jpg")
Case $msg = $Screen_5
GUICtrlSetImage ($button_1, "C:\Users\Screen5.jpg")
Case $msg = $Screen_6
GUICtrlSetImage ($button_1, "C:\Users\Screen6.jpg")
EndSelect
WEnd
Gruß
Greenhorn
p.s. Selbstverständlich kannst Du mit AutoIt weitermachen ! ![]()
... vielleicht noch was besseres gefunden ...
*auch ungetestet*
http://www.heise.de/software/download/helpmaker/43162
Gruß
Greenhorn
Moin,
dieses Skript zeigt die Größe des Anwendungsbereichs in Pixeln, Millimetern, Zoll und Twips an, also den metrischen Koordinatensystemen.
Nicht mehr, aber auch nicht weniger ...
;******************************************************************************************
;* WhatSize Demo von C.Petzold
;* Übersetzt in AutoIt von Greenhorn
;*
#NoTrayIcon
#include-once
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include "WinAPI.h.au3"
Global $hWindowProc = DllCallbackRegister ('WindowProc', 'long', 'hwnd;uint;wparam;lparam')
Global $stAppName = DllStructCreate ('char szAppName[128]')
Global $szAppName = DllStructSetData ($stAppName, 'szAppName', 'WhatSize')
Global $hInst = GetModuleHandle ($NULL)
; Statische Variablen für die Fensterprozedur, müssen wir in AutoIt
; global setzen, gibt in AutoIt leider kein 'static'
Global $cxChar, $cyChar
Global $szHeading = "Koordinatensystem Left Right Top Bottom"
Global $szUndLine = "----------------- ---- ----- --- ------"
WinMain ()
[/autoit] [autoit][/autoit] [autoit]Func WinMain ()
Global $hWnd
Global $Msg = DllStructCreate ($tagMSG)
Global $wcx = DllStructCreate ($tagWNDCLASSEX)
DllStructSetData ($wcx,'cbSize', DllStructGetSize ($wcx))
DllStructSetData ($wcx,'style', BitOR ($CS_HREDRAW, $CS_VREDRAW))
DllStructSetData ($wcx,'lpfnWndProc', DllCallbackGetPtr ($hWindowProc))
DllStructSetData ($wcx,'cbClsExtra', 0)
DllStructSetData ($wcx,'cbWndExtra', 0)
DllStructSetData ($wcx,'hInstance', $hInst)
DllStructSetData ($wcx,'hIcon', LoadIcon ($NULL, $IDI_APPLICATION))
DllStructSetData ($wcx,'hCursor', LoadCursor ($NULL, $IDC_ARROW))
DllStructSetData ($wcx,'hbrBackground', GetStockObject ($WHITE_BRUSH))
DllStructSetData ($wcx,'lpszMenuName', $NULL)
DllStructSetData ($wcx,'lpszClassName', DllStructGetPtr ($stAppName))
DllStructSetData ($wcx,'hIconSm', LoadIcon ($NULL, $IDI_APPLICATION))
$lpMyWndClass = DllStructGetPtr ($wcx)
$lpMsg = DllStructGetPtr ($Msg)
If Not RegisterClassEx ($lpMyWndClass) Then
MsgBox (266256, Default, 'Die Fensterklasse konnte nicht registriert werden !')
Exit
EndIf
$hWnd = CreateWindowEx ($WS_EX_COMPOSITED, _ ; verhindert "Flickern"
$szAppName, 'Wie groß ist das Fenster?', _
$WS_OVERLAPPEDWINDOW, _
$CW_USEDEFAULT, $CW_USEDEFAULT, _
$CW_USEDEFAULT, $CW_USEDEFAULT, _
$NULL, $NULL, $hInst, $NULL)
ShowWindow ($hWnd, 5)
UpdateWindow ($hWnd)
While (GetMessage ($lpMsg, $NULL, 0, 0) > 0)
TranslateMessage ($lpMsg)
DispatchMessage ($lpMsg)
WEnd
Return DllStructGetData ($Msg, 'wParam')
EndFunc
[/autoit] [autoit][/autoit] [autoit]Func Show ($hwnd, $hdc, $xText, $yText, $iMapMode, $szMapMode)
[/autoit] [autoit][/autoit] [autoit]Local $szBuffer
$rcClient = DllStructCreate ($tagRECT)
$lprcClient = DllStructGetPtr ($rcClient)
SaveDC ($hdc)
SetMapMode ($hdc, $iMapMode)
GetClientRect ($hwnd, $lprcClient)
DPtoLP ($hdc, $lprcClient, 2)
RestoreDC ($hdc, -1)
$left = DllStructGetData($rcClient, "Left")
$top = DllStructGetData($rcClient, "Top")
$right = DllStructGetData($rcClient, "Right")
$bottom = DllStructGetData($rcClient, "Bottom")
$szBuffer = StringFormat("%-20s %7d %7d %7d %7d", $szMapMode, _
$left, $right, $top, $bottom)
TextOut ($hdc, $xText, $yText, _
$szBuffer, _
StringLen ($szBuffer))
EndFunc
[/autoit] [autoit][/autoit] [autoit]Func WindowProc ($hWnd, $uMsg, $wParam, $lParam)
$rcClient = DllStructCreate ($tagRECT)
$lprcClient = DllStructGetPtr ($rcClient)
$ps = DllStructCreate ($tagPAINTSTRUCT)
$lpPs = DllStructGetPtr ($ps)
$tm = DllStructCreate ($tagTEXTMETRIC)
$lptm = DllStructGetPtr ($tm)
Switch $uMsg
Case $WM_CREATE
$hdc = GetDC ($hWnd) ;
SelectObject ($hdc, GetStockObject ($SYSTEM_FIXED_FONT)) ;
GetTextMetrics ($hdc, DllStructGetPtr ($tm)) ;
$cxChar = DllStructGetData ($tm, 'tmAveCharWidth') ;
$cyChar = DllStructGetData ($tm, 'tmHeight') + DllStructGetData ($tm, 'tmExternalLeading') ;
ReleaseDC ($hWnd, $hdc) ;
Case $WM_PAINT
$hDC = BeginPaint ($hWnd, $lpPs)
SelectObject ($hDC, GetStockObject ($SYSTEM_FIXED_FONT)) ;
SetMapMode ($hDC, $MM_ANISOTROPIC) ; Koordinatensystem auf MM_ANISOTROPIC umstellen
SetWindowExtEx ($hDC, 1, 1, $NULL) ; Ausmaße des Darstellungsfeldes für das Fenster
SetViewportExtEx ($hDC, $cxChar, $cyChar, $NULL) ; Ausmaße des Darstellungsfeldes für den Gerätekontext
TextOut ($hDC, 1, 1, $szHeading, StringLen ($szHeading)) ;
TextOut ($hDC, 1, 2, $szUndLine, StringLen ($szUndLine)) ;
Show ($hWnd, $hDC, 1, 3, $MM_TEXT, "TEXT (pixels)") ;
Show ($hWnd, $hDC, 1, 4, $MM_LOMETRIC, "LOMETRIC (.1 mm)") ;
Show ($hWnd, $hDC, 1, 5, $MM_HIMETRIC, "HIMETRIC (.01 mm)") ;
Show ($hWnd, $hDC, 1, 6, $MM_LOENGLISH, "LOENGLISH (.01 in)") ;
Show ($hWnd, $hDC, 1, 7, $MM_HIENGLISH, "HIENGLISH (.001 in)") ;
Show ($hWnd, $hDC, 1, 8, $MM_TWIPS, "TWIPS (1/1440 in)") ;
EndPaint ($hWnd, $lpPs)
Case $WM_DESTROY
PostQuitMessage (0)
Case Else
Return DefWindowProc ($hWnd, $uMsg, $wParam, $lParam)
EndSwitch
Return 0;
EndFunc
Gruß
Greenhorn
[autoit]Ich hab dem ganzen noch ein kleines gui gegeben und den rechenteil in eine UDF gesteckt.
Falls es nun eine lösung gibt den DPI wert zu ermitten werde ich das auch noch anfügen.
#include <WinAPI.au3>
Global Const $HORZSIZE = 4
Global Const $VERTSIZE = 6
Global Const $HORZRES = 8
Global Const $VERTRES = 10
Global Const $LOGPIXELSX = 88
Global Const $LOGPIXELSY = 90
Global Const $BITSPIXEL = 12
$ScreenDC = _WinAPI_GetDC (0)
$logX = _WinAPI_GetDeviceCaps ($ScreenDC, $LOGPIXELSX) ; Number of pixels per logical inch along the screen width
$logY = _WinAPI_GetDeviceCaps ($ScreenDC, $LOGPIXELSY) ; Number of pixels per logical inch along the screen height
$width = _WinAPI_GetDeviceCaps ($ScreenDC, $HORZSIZE) ; width in mm
$height = _WinAPI_GetDeviceCaps ($ScreenDC, $VERTSIZE) ; height in mm
$pixelsX = _WinAPI_GetDeviceCaps ($ScreenDC, $HORZRES) ; x pixels
$pixelsY = _WinAPI_GetDeviceCaps ($ScreenDC, $VERTRES) ; y pixels
$bitspxl = _WinAPI_GetDeviceCaps ($ScreenDC, $BITSPIXEL) ; bits per pixel
_WinAPI_ReleaseDC (0, $ScreenDC)
MsgBox (0, '', $width & ' x ' & $height & ' mm (' & $pixelsX & ' x ' & $pixelsY & ')' & _
@CRLF & @CRLF & _
'dpi = ' & $logX & ' Pixel/Zoll' & @CRLF & _
'Farbtiefe = ' & $bitspxl & ' Bit')
Gruß
Das mit der WMI hatte ich auch mal gefunden nur bei mir hat es an 3 von 5 rechnern eine höhere Auflösung als Objekt gegeben als in den Einstellungen der Graka... aber ich weiss leider nicht warum und hab auch keine Lösung gefunden... Ich hab grade nochmal an meinem Rechner hier im Büro geschaut, da scheint es zu stimmen.
Dann unterstützt die Firmware des Monitors vllt keine Funktionen um die Auflösung zu ermitteln ...
Gruß
Die Koordinatensysteme in Windows arbeiten alle mit logischen Einheiten.
Die MSDN-Dokumentation zu HORZRES und VERTRES ist falsch ! Denn wie wir gesehen haben,wird die logische Bilschirmgröße für 1280x1024 zurückgegeben.
Aber via WMI können wir die max. physikalische Auflösung ermitteln.
Nun brauchen wir nur noch einen Speicherkontext erzeugen, ihm diese Auflösung/Größe verpassen und dann den Bildschirmkontext in den Speicherkontext mappen.
Dann kann man die ganze Rechengeschichte für die Maus in dem Speicherkontext durchführen.
Gruß
Die DOTS/inch sind die PIXEL/inch.
#include <WinAPI.au3>
Global Const $HORZSIZE = 4
Global Const $VERTSIZE = 6
Global Const $HORZRES = 8
Global Const $VERTRES = 10
Global Const $LOGPIXELSX = 88
Global Const $LOGPIXELSY = 90
Global Const $BITSPIXEL = 12
$ScreenDC = _WinAPI_GetDC (0)
$logX = _WinAPI_GetDeviceCaps ($ScreenDC, $LOGPIXELSX) ; Number of pixels per logical inch along the screen width
$logY = _WinAPI_GetDeviceCaps ($ScreenDC, $LOGPIXELSY) ; Number of pixels per logical inch along the screen height
$width = _WinAPI_GetDeviceCaps ($ScreenDC, $HORZSIZE) ; width in mm
$height = _WinAPI_GetDeviceCaps ($ScreenDC, $VERTSIZE) ; height in mm
$pixelsX = _WinAPI_GetDeviceCaps ($ScreenDC, $HORZRES) ; x pixels
$pixelsY = _WinAPI_GetDeviceCaps ($ScreenDC, $VERTRES) ; y pixels
$bitspxl = _WinAPI_GetDeviceCaps ($ScreenDC, $BITSPIXEL) ; bits per pixel
_WinAPI_ReleaseDC (0, $ScreenDC)
MsgBox (0, '', $width & ' x ' & $height & ' mm (' & $pixelsX & ' x ' & $pixelsY & ')' & _
@CRLF & @CRLF & _
'dpi = ' & $logX & ' Pixel/Zoll' & @CRLF & _
'Farbtiefe = ' & $bitspxl & ' Bit')
Die Koordinaten aus dem Gerätekontext arbeiten mit logischen Einheiten.
Von daher stimmen die Werte eigentlich schon, aber wenn ich, so wie Oscar, meinem Bildschirm eine kleinere Auflösung verpasse, dann arbeitet das System mit diesen logischen Einheiten, logisch.
Wenn ich dann auch noch eine 4:3 Auflösung in meinen 16:10 Monitor drücke, dann interpoliert der Monitor die logischen Einheiten auf die reellen, und somit stimmen die Werte natürlich nicht mehr.
Deshalb soll man an seinem Monitor immer die max. Auflösung einstellen und wenn die Schrift oder die Icons zu klein sind, diese über die DPI angleichen.
Für Vista gibt es die Funktion GetMonitorDisplayAreaSize() um die max. physische Größe der Anzeige zu ermitteln, aber leider nur für Vista ...
EDIT:
Mir ist da noch etwas eingefallen ...
Wenn kein Grafiktreiber installiert ist, dann kann ich unter "Anzeige -> Einstellungen" eine höhere Bildschirmauflösung einstellen als der Monitor hergibt (und ihn damit ins Jenseits befördern).
Sobald ich aber einen Grafiktreiber installiere kann ich auch nur die max. Auflösung des Monitors einstellen.
Was sagt uns das ?
Der Grafiktreiber kennt die max. physische Auflösung des Monitors !
Könnte man vllt per WMI herankommen ...
#include <WindowsConstants.au3>
#include <GUIConstantsEx.au3>
#include <EditConstants.au3>
#include <WinAPI.au3>
$hWnd = GUICreate ('Win32_VideoSettings', 640, 480, -1, -1, $WS_OVERLAPPEDWINDOW)
[/autoit] [autoit][/autoit] [autoit]$idEdit = GUICtrlCreateEdit ('', 0, 0, 640, 480, BitOR ($WS_VSCROLL, $ES_AUTOVSCROLL))
[/autoit] [autoit][/autoit] [autoit]GUISetState ()
[/autoit] [autoit][/autoit] [autoit]; Generated by AutoIt Scriptomatic
[/autoit] [autoit][/autoit] [autoit]$wbemFlagReturnImmediately = 0x10
$wbemFlagForwardOnly = 0x20
$colItems = ""
$strComputer = "localhost"
$Output=""
$Output = $Output & "Computer: " & $strComputer & @CRLF
$Output = $Output & "==========================================" & @CRLF
$objWMIService = ObjGet ("winmgmts:\\" & $strComputer & "\root\CIMV2")
$colItems = $objWMIService.ExecQuery ("SELECT * FROM Win32_VideoSettings", "WQL", _
$wbemFlagReturnImmediately + $wbemFlagForwardOnly)
If IsObj ($colItems) then
For $objItem In $colItems
$Output &= "Element: " & $objItem.Element & @CRLF
$Output &= "Setting: " & $objItem.Setting & @CRLF
;if Msgbox(1,"WMI Output",$Output) = 2 then ExitLoop
;$Output=""
Next
GUICtrlSetData ($idEdit,$Output)
Else
GUICtrlSetData ($idEdit,"WMI Output","No WMI Objects Found for class: Win32_VideoSettings" )
Endif
While True
Switch GUIGetMsg ()
Case -3
ExitLoop
EndSwitch
WEnd
Spitze, sogar multilingual ... ![]()
Gruß
Greenhorn
Thanks for sharing this ... ![]()
I hope you're well up and feel fine.
Gruß
Greenhorn
Moin,
also mit DriveGetDrive bekommst Du schon mal alle vergebenen Laufwerksbuchstaben, der Rest ist Mathe ... ![]()
Gruß
Greenhorn
Das Tool ist von stumpii und hier zu finden ...
http://www.autoitscript.com/forum/index.php?showtopic=21834&hl=debugger
Webpage
http://www.thefoolonthehill.net/AutoIt_AutoIt_Debugger.htm
Habe ich aber nie ausprobiert, gleich mal testen ...
Gruß
Greenhorn
Na, dann packen 'mir es an ... ![]()
Ich liebe die Win32 Flat GDI ... ![]()
Gruß
Greenhorn
Moinsen,
habe ein Beispiel, welches ich in einem Buch gefunden habe, einer digitalen Anzeige in einem Fenster in AutoIt übersetzt.
Drauf gekommen bin ich beim Lesen des Buches und da fiel mir ein das Oscar da doch irgendwas mit 'ner Digitaluhr geskriptet hatte.
Vielleicht kann Oscar das ja für seine geniale Digitaluhr gebrauchen. ![]()
Es passiert eigentlich nicht viel, außer dass die Uhrzeit im Anwendungsbereich des Fensters digital angezeigt wird. ![]()
Screenshot:
Relevanter Quellcode:
DigClock.au3
;******************************************************************************************
;* DigClock Demo von C.Petzold
;* Übersetzt in AutoIt von Greenhorn
;*
#NoTrayIcon
#include-once
#include <GUIConstantsEx.au3>
#include <WindowsConstants.au3>
#include "WinAPI.h.au3"
#include "DigClock.h.au3"
;;;
Global Const $WM_SETTINGCHANGE = 0x001A
[/autoit] [autoit][/autoit] [autoit]Global Const $ID_TIMER = 1
[/autoit] [autoit][/autoit] [autoit]Global $hWindowProc = DllCallbackRegister ('WindowProc', 'long', 'hwnd;uint;wparam;lparam')
Global $stAppName = DllStructCreate ('char szAppName[128]')
Global $szAppName = DllStructSetData ($stAppName, 'szAppName', 'DigClock')
Global $hInst = GetModuleHandle ($NULL)
Global $szClassName = ''
; Statische Variablen für die Fensterprozedur, müssen wir in AutoIt
; global setzen, gibt in AutoIt leider kein 'static'
Global $f24hour = False, $fSuppress = False
Global $cxClient, $cyClient, $hBrushRed
WinMain()
[/autoit] [autoit][/autoit] [autoit]Func WinMain()
Global $hWnd
Global $Msg = DllStructCreate ($tagMSG)
Global $wcx = DllStructCreate ($tagWNDCLASSEX)
DllStructSetData ($wcx,'cbSize', DllStructGetSize ($wcx))
DllStructSetData ($wcx,'style', BitOR ($CS_HREDRAW, $CS_VREDRAW))
DllStructSetData ($wcx,'lpfnWndProc', DllCallbackGetPtr ($hWindowProc))
DllStructSetData ($wcx,'cbClsExtra', 0)
DllStructSetData ($wcx,'cbWndExtra', 0)
DllStructSetData ($wcx,'hInstance', $hInst)
DllStructSetData ($wcx,'hIcon', LoadIcon ($NULL, $IDI_APPLICATION))
DllStructSetData ($wcx,'hCursor', LoadCursor ($NULL, $IDC_ARROW))
DllStructSetData ($wcx,'hbrBackground', GetStockObject ($BLACK_BRUSH))
DllStructSetData ($wcx,'lpszMenuName', $NULL)
DllStructSetData ($wcx,'lpszClassName', DllStructGetPtr ($stAppName))
DllStructSetData ($wcx,'hIconSm', LoadIcon ($NULL, $IDI_APPLICATION))
$lpMyWndClass = DllStructGetPtr ($wcx)
$lpMsg = DllStructGetPtr ($Msg)
If Not RegisterClassEx ($lpMyWndClass) Then
MsgBox (266256, Default, 'Die Fensterklasse konnte nicht registriert werden !')
Exit
EndIf
$hWnd = CreateWindowEx ($WS_EX_COMPOSITED, _ ; verhindert "Flickern"
$szAppName, $szAppName, _
$WS_OVERLAPPEDWINDOW, _
$CW_USEDEFAULT, $CW_USEDEFAULT, _
544, 375, _
$NULL, $NULL, $hInst, $NULL)
ShowWindow ($hWnd, 5)
UpdateWindow ($hWnd)
While (GetMessage ($lpMsg, $NULL, 0, 0) > 0)
TranslateMessage ($lpMsg)
DispatchMessage ($lpMsg)
WEnd
Return DllStructGetData ($Msg, 'wParam')
EndFunc
[/autoit] [autoit][/autoit] [autoit]Func WindowProc ($hWnd, $uMsg, $wParam, $lParam)
$szBuffer = DllStructCreate ('char szBuffer[2]')
$lpszBuffer = DllStructGetPtr ($szBuffer)
$rcClient = DllStructCreate ($tagRECT)
$lprcClient = DllStructGetPtr ($rcClient)
Switch $uMsg
Case $WM_CREATE
$hBrushRed = CreateSolidBrush (RGB (255, 0, 0)) ; Rotes Füllmuster für die Segmente erzeugen
SetTimer ($hWnd, $ID_TIMER, 1000, $NULL)
ContinueCase ; weiter mit WM_SETTINGCHANGE
Case $WM_SETTINGCHANGE
GetLocaleInfo ($LOCALE_USER_DEFAULT, $LOCALE_ITIME, $lpszBuffer, 2)
$f24hour = (DllStructGetData ($szBuffer, 'szBuffer', 1) == '1') ; TRUE wenn 1
GetLocaleInfo ($LOCALE_USER_DEFAULT, $LOCALE_ITLZERO, $lpszBuffer, 2) ;
$fSuppress = (DllStructGetData ($szBuffer, 'szBuffer', 1) == '0') ; TRUE wenn 0
GetClientRect ($hWnd, $lprcClient)
$cxClient = DllStructGetData ($rcClient, 'right')
$cyClient = DllStructGetData ($rcClient, 'bottom')
InvalidateRect ($hWnd, $NULL, TRUE) ; löst eine WM_PAINT Nachricht aus
Case $WM_SIZE
$cxClient = LOWORD ($lParam) ; Bei Größenänderung Breite
$cyClient = HIWORD ($lParam) ; und Höhe ermitteln
Case $WM_TIMER
InvalidateRect ($hWnd, $NULL, TRUE) ; löst eine WM_PAINT Nachricht aus
Case $WM_PAINT
$ps = DllStructCreate ($tagPAINTSTRUCT)
$lpPs = DllStructGetPtr ($ps)
$hDC = BeginPaint ($hWnd, $lpPs)
SetMapMode ($hDC, $MM_ISOTROPIC) ; Koordinatensystem auf MM_ISOTROPIC umstellen
SetWindowExtEx ($hDC, 276, 72, $NULL) ; Ausmaße des Darstellungsfeldes für das Fenster
SetViewportExtEx ($hDC, $cxClient, $cyClient, $NULL) ; Ausmaße des Darstellungsfeldes für den Gerätekontext
SetWindowOrgEx ($hDC, 138, 36, $NULL) ; Punkt im Fenster, der zum Ursprung des Darstellungsfeldes (0,0) "gemappt" wird
SetViewportOrgEx ($hDC, $cxClient / 2, $cyClient / 2, $NULL) ; Punkt im Gerätekontext, der zum Ursprung des Fensters "gemappt" wird
SelectObject ($hDC, GetStockObject ($NULL_PEN)) ; "leeren" Zeichenstift in den Gerätekontext einsetzen
SelectObject ($hDC, $hBrushRed) ; Füllmuster für die Segmente in den Gerätekontext einsetzen
DisplayTime ($hDC, $f24Hour, $fSuppress) ;
[/autoit] [autoit][/autoit] [autoit]EndPaint ($hWnd, $lpPs)
Case $WM_CLOSE
DestroyWindow ($hWnd)
Case $WM_DESTROY
KillTimer ($hWnd, $ID_TIMER)
DeleteObject ($hBrushRed) ; Aufräumarbeiten
PostQuitMessage (0)
Case Else
Return DefWindowProc ($hWnd, $uMsg, $wParam, $lParam)
EndSwitch
Return 0;
EndFunc
;
DigClock.h.au3
#include-once
#include "WinAPI.h.au3"
Dim $fSevenSegment [10][7] = [ [1, 1, 1, 0, 1, 1, 1], _ ; // 0
[0, 0, 1, 0, 0, 1, 0], _ ; // 1
[1, 0, 1, 1, 1, 0, 1], _ ; // 2
[1, 0, 1, 1, 0, 1, 1], _ ; // 3
[0, 1, 1, 1, 0, 1, 0], _ ; // 4
[1, 1, 0, 1, 0, 1, 1], _ ; // 5
[1, 1, 0, 1, 1, 1, 1], _ ; // 6
[1, 0, 1, 0, 0, 1, 0], _ ; // 7
[1, 1, 1, 1, 1, 1, 1], _ ; // 8
[1, 1, 1, 1, 0, 1, 1] ] ; // 9
; x, y; x, y; x, y; x, y; x, y; x, y
Dim $aSegment [7][12] = [ [ 7, 6, 11, 2, 31, 2, 35, 6, 31, 10, 11, 10], _
[ 6, 7, 10, 11, 10, 31, 6, 35, 2, 31, 2, 11], _
[36, 7, 40, 11, 40, 31, 36, 35, 32, 31, 32, 11], _
[ 7, 36, 11, 32, 31, 32, 35, 36, 31, 40, 11, 40], _
[ 6, 37, 10, 41, 10, 61, 6, 65, 2, 61, 2, 41], _
[36, 37, 40, 41, 40, 61, 36, 65, 32, 61, 32, 41], _
[ 7, 66, 11, 62, 31, 62, 35, 66, 31, 70, 11, 70] ]
Dim $ptSegment [7]
[/autoit] [autoit][/autoit] [autoit]For $i = 0 To 6
$ptSegment [$i] = DllStructCreate ('int [12]')
For $ii = 0 To 11
DllStructSetData ($ptSegment [$i], 1, $aSegment [$i][$ii], $ii + 1)
Next
Next
;/////////////////////////////////////////////////////////////
;// DigClock Funktionen //
;/////////////////////////////////////////////////////////////
Func DisplayDigit ($hdc, $iNumber)
For $iSeg = 0 To 6
If ($fSevenSegment [$iNumber][$iSeg]) Then
Polygon ($hdc, DllStructGetPtr ($ptSegment [$iSeg]), 6) ;
EndIf
Next
EndFunc
[/autoit] [autoit][/autoit] [autoit]Func DisplayTwoDigits ($hdc, $iNumber, $fSuppress)
[/autoit] [autoit][/autoit] [autoit]If (Not $fSuppress Or ($iNumber / 10 <> 0)) Then
DisplayDigit ($hdc, $iNumber / 10) ;
EndIf
OffsetWindowOrgEx ($hdc, -42, 0, $NULL) ;
DisplayDigit ($hdc, Mod ($iNumber, 10)) ;
OffsetWindowOrgEx ($hdc, -42, 0, $NULL) ;
EndFunc
[/autoit] [autoit][/autoit] [autoit]Func DisplayColon ($hdc)
Local $ptColon [2]
; x, y; x, y; x, y; x, y
Local $aColon [2][8] = [ [ 2, 21, 6, 17, 10, 21, 6, 25] , _
[ 2, 51, 6, 47, 10, 51, 6, 55] ] ;
For $i = 0 To 1
$ptColon [$i] = DllStructCreate ('int [8]')
For $ii = 0 To 7
DllStructSetData ($ptColon [$i], 1, $aColon [$i][$ii], $ii + 1)
Next
Next
Polygon ($hdc, DllStructGetPtr ($ptColon [0]), 4)
Polygon ($hdc, DllStructGetPtr ($ptColon [1]), 4)
OffsetWindowOrgEx ($hdc, -12, 0, $NULL)
[/autoit] [autoit][/autoit] [autoit]EndFunc
[/autoit] [autoit][/autoit] [autoit]Func DisplayTime ($hdc, $f24Hour, $fSuppress)
[/autoit] [autoit][/autoit] [autoit]Local $wHour, $wMinute, $wSecond
Local $st = DllStructCreate ($tagSYSTEMTIME)
GetLocalTime (DllStructGetPtr ($st))
[/autoit] [autoit][/autoit] [autoit]$wHour = DllStructGetData ($st, 'Hour')
$wMinute = DllStructGetData ($st, 'Minute')
$wSecond = DllStructGetData ($st, 'Second')
If ($f24Hour) Then
DisplayTwoDigits ($hdc, $wHour, $fSuppress) ;
Else
If ($wHour = Mod ($wHour, 12)) Then
DisplayTwoDigits ($hdc, $wHour, $fSuppress)
Else
DisplayTwoDigits ($hdc, 12, $fSuppress)
EndIf
EndIf
DisplayColon ($hdc)
DisplayTwoDigits ($hdc, $wMinute, FALSE)
DisplayColon ($hdc)
DisplayTwoDigits ($hdc, $wSecond, FALSE)
EndFunc
[/autoit]Gruß
Greenhorn
Moin,
sieh' dir mal das Beispielscript an ...
http://www.autoit.de/dokumentation_…RegisterMsg.htm
In der MY_WM_DRAWITEM muss dein Zeichnen stattfinden ...
Gruß
Greenhorn
Ohne den ersten Sleep müsste es doch gehen, Du must nur ProcessClose hinter die Schleife setzen.
[autoit]$blah = GUICtrlRead($A1)
If $blah = $GUI_CHECKED And $msg=$RUN Then
$Programmpfad = INIread("config.ini", "Pfade", "ProgrammA", "")
$remote=INIread("config.ini", "IPS", "RaumA", "")
$Zugang=INIread("config.ini", "Zugang", "Benutzer", "")
run(@ComSpec & " /k psexec \\" & $remote & " " & $Zugang & " " & $Programmpfad)
For $i = 0 To 100 Step 20
GUICtrlSetData($ProA1, $i)
sleep (1000)
Next
ProcessClose ("cmd.exe")
EndIf
Oder Du arbeitest mit einem Timer ...
$blah = GUICtrlRead($A1)
If $blah = $GUI_CHECKED And $msg=$RUN Then
$Programmpfad = INIread ("config.ini", "Pfade", "ProgrammA", "")
$remote = INIread ("config.ini", "IPS", "RaumA", "")
$Zugang = INIread ("config.ini", "Zugang", "Benutzer", "")
Run (@ComSpec & " /k psexec \\" & $remote & " " & $Zugang & " " & $Programmpfad)
$iTimer = TimerInit ( ) ; Timer setzen
While ProcessExists ("cmd.exe")
$iDiff = TimerDiff ($iTimer) ; Differenz
If $iDiff >= 5000 ; ... nach fünf Sekunden oder später
ProcessClose ("cmd.exe")
ExitLoop ; Schleife verlassen
ElseIf $iDiff >= $iTimer + 1000 ; ... nach einer Sekunde oder später
GUICtrlSetData($ProA1, 20)
EndIf
sleep (50)
WEnd
GUICtrlSetData($ProA1, 100)
EndIf
Gruß
Greenhorn
Hat es einen besonderen Grund das Du psexec über die Konsole startest ?
Warum nimmst Du den Sleep nicht einfach raus ?!
Gruß
Greenhorn