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

Beiträge von AspirinJunkie

  • Windows Explorer (Dateiexplorer) zum schliessen überreden

    • AspirinJunkie
    • 3. August 2009 um 13:35

    Folgendes sollte unahängig von der Windows-Version funktionieren:

    Spoiler anzeigen
    [autoit]

    Opt("WinTitleMatchMode", 4)
    Global $ShellObject = ObjCreate("Shell.Application")
    Global $Pfade = ''

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

    $WinList = WinList('[REGEXPCLASS:(Cabinet|Explore)WClass]')
    For $i = 1 To $WinList[0][0]
    $Pfade &= _GetExplorerWinOpenedPath($WinList[$i][1], $ShellObject) & @CRLF
    Next

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

    MsgBox(0, "", "Pfade geöffneter Explorer-Fenster:" & @CRLF & @CRLF & $Pfade)

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

    Func _GetExplorerWinOpenedPath($WinHandle, ByRef $ShellObject)
    If (Not IsObj($ShellObject)) And (Not ObjName($ShellObject) == 'IShellDispatch4') Then Return SetError(1, 0, '')

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

    For $Window In $ShellObject.Windows
    If ObjName($Window) = 'IWebBrowser2' Then
    If $Window.HWND = $WinHandle Then
    Return StringReplace(StringReplace(StringReplace($Window.LocationURL, 'file:///', ''), '/', '\'), '%20', ' ')
    EndIf
    EndIf
    Next

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

    Return SetError(2, 0, '')
    EndFunc

    [/autoit]


    Aber wie Progandy schon schrieb - es sollte auch ohne vorheriges Schließen klappen.

  • Regread Schlüssel Abfragen

    • AspirinJunkie
    • 28. Juli 2009 um 11:41

    Mit >>RegEnumKey<< gehst du alle SubKeyNames in einem Schlüssel durch.
    Schau dir dazu am besten mal das Beispiel an.

  • Pfad von einen process heruasfinden?

    • AspirinJunkie
    • 28. Juli 2009 um 10:27

    Also ich habe Vista und bei mir funktioniert folgendes problemlos:

    Spoiler anzeigen
    [autoit]

    #RequireAdmin

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

    Global $hPsAPI = DllOpen("Psapi.dll")
    Global $hKernel = DllOpen("Kernel32.dll")

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

    MsgBox(0,"", "Explorer:" & @CRLF & _ProcessGetPath("Explorer.exe"))

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

    Func _ProcessGetPath($hPID)
    If IsString($hPID) Then $hPID = ProcessExists($hPID)
    If $hPID = 0 Then Return SetError(1,0,'')
    Local $sPath = DllStructCreate("char[1000]")
    Local $hProcess = DllCall($hKernel, "int", "OpenProcess", "dword", 0x0400 + 0x0010, "int", 0, "dword", $hPID)
    DllCall($hPsAPI, "long", "GetModuleFileNameEx", "long", $hProcess[0], "int", 0, "ptr", DllStructGetPtr($sPath), "long", DllStructGetSize($sPath))
    DllCall($hKernel, "int", "CloseHandle", "hwnd", $hProcess[0])
    Return DllStructGetData($sPath, 1)
    EndFunc

    [/autoit]


    Hast du auch an das @RequireAdmin gedacht?
    Die Funktion ist nämlich deutlich schneller als die WMI-Lösung.

  • RUN() Errorcode auslesen

    • AspirinJunkie
    • 9. Juli 2009 um 08:33

    Und StdErrRead() ist nicht das was du brauchst?

  • Maschinen GUID mit AutoIt erstellen

    • AspirinJunkie
    • 28. Juni 2009 um 19:05

    Vielleicht meint er ja auch diese hier:

    Spoiler anzeigen
    [autoit]

    MsgBox(0,"", "UUID: " & GetMachineGUID())

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

    Func GetMachineGUID()
    Local $oWMI = ObjGet("winmgmts:\\.\root\CIMV2")
    For $x In $oWMI.ExecQuery("SELECT UUID FROM Win32_ComputerSystemProduct", "WQL", 0x30)
    Return $x.UUID
    Next
    EndFunc

    [/autoit]


    Aber auch die ist nicht garantiert eindeutig.

  • Position des 2 Monitors

    • AspirinJunkie
    • 27. Juni 2009 um 14:21

    Da sich die Auflösung aus der Position berechnet ist das eigentlich nur eine kleine Änderung:

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>

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

    $Monitore = _GetMonitors()
    If Not @error Then _ArrayDisplay($Monitore)

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

    Func _GetMonitors()
    Local $cbMonitorEnumProc = DllCallbackRegister("MonitorEnumProc", "ubyte", "ptr;ptr;ptr;int")
    If @error Then Return SetError(1, 0, False)
    Local $strctCount = DllStructCreate("uint Count;uint Width[12];uint Height[12];int left[12];int top[12]")
    If @error Then Return SetError(2, @error, False)
    Local $iCount

    DllStructSetData($strctCount, "Count", 0)

    $Ret = DllCall("User32.dll", "ubyte","EnumDisplayMonitors","ptr", 0,"ptr", 0, "ptr", DllCallbackGetPtr($cbMonitorEnumProc), "ptr", DllStructGetPtr($strctCount))
    If @error Or $Ret[0] = 0 Then Return SetError(3, @error, False)

    DllCallbackFree($cbMonitorEnumProc)

    $iCount = Int(DllStructGetData($strctCount, "Count"))

    Local $aMonitors[$iCount+1][4] = [[$iCount]]

    For $i = 1 To $iCount
    $aMonitors[$i][0] = Int(DllStructGetData($strctCount, "Width",$i))
    $aMonitors[$i][1] = Int(DllStructGetData($strctCount, "Height",$i))
    $aMonitors[$i][2] = Int(DllStructGetData($strctCount, "left",$i))
    $aMonitors[$i][3] = Int(DllStructGetData($strctCount, "top",$i))
    Next

    Return $aMonitors
    EndFunc

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

    Func MonitorEnumProc($hMonitor, $hdcMonitor, $lprcMonitor, $dwData)
    Local $strctRECT = DllStructCreate("long left;long top;long right;long bottom", $lprcMonitor)
    Local $strctCount = DllStructCreate("uint Count;uint Width[12];uint Height[12];int left[12];int top[12]", $dwData)
    Local $iNumber = DllStructGetData($strctCount, "Count")
    Local $Height = Int(DllStructGetData($strctRECT, "bottom"))-Int(DllStructGetData($strctRECT, "top"))
    Local $Width = Int(DllStructGetData($strctRECT, "right"))-Int(DllStructGetData($strctRECT, "left"))

    DllStructSetData($strctCount, "Width", $Width, $iNumber+1)
    DllStructSetData($strctCount, "Height", $Height, $iNumber+1)
    DllStructSetData($strctCount, "left", Int(DllStructGetData($strctRECT, "left")), $iNumber+1)
    DllStructSetData($strctCount, "top", Int(DllStructGetData($strctRECT, "top")), $iNumber+1)
    DllStructSetData($strctCount, "Count", $iNumber+1)
    Return True
    EndFunc

    [/autoit]


    Zusätzlich zur Auflösung wird dir jetzt noch die Koordinate der linken oberen Ecke des jeweiligen Monitors angezeigt.

  • Auflösung des 2ten Monitors

    • AspirinJunkie
    • 27. Juni 2009 um 12:19

    Teste das mal (kann nicht testen - hab nur einen Monitor):

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>

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

    $Monitore = _GetMonitors()
    If Not @error Then _ArrayDisplay($Monitore)

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

    Func _GetMonitors()
    Local $cbMonitorEnumProc = DllCallbackRegister("MonitorEnumProc", "ubyte", "ptr;ptr;ptr;int")
    If @error Then Return SetError(1, 0, False)
    Local $strctCount = DllStructCreate("uint Count;uint Width[12];uint Height[12]")
    If @error Then Return SetError(2, @error, False)
    Local $iCount

    DllStructSetData($strctCount, "Count", 0)

    $Ret = DllCall("User32.dll", "ubyte","EnumDisplayMonitors","ptr", 0,"ptr", 0, "ptr", DllCallbackGetPtr($cbMonitorEnumProc), "ptr", DllStructGetPtr($strctCount))
    If @error Or $Ret[0] = 0 Then Return SetError(3, @error, False)

    DllCallbackFree($cbMonitorEnumProc)

    $iCount = Int(DllStructGetData($strctCount, "Count"))

    Local $aMonitors[$iCount+1][2] = [[$iCount,0]]

    For $i = 1 To $iCount
    $aMonitors[$i][0] = DllStructGetData($strctCount, "Width",$i)
    $aMonitors[$i][1] = DllStructGetData($strctCount, "Height",$i)
    Next

    Return $aMonitors
    EndFunc

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

    Func MonitorEnumProc($hMonitor, $hdcMonitor, $lprcMonitor, $dwData)
    Local $strctRECT = DllStructCreate("long left;long top;long right;long bottom", $lprcMonitor)
    Local $strctCount = DllStructCreate("uint Count;uint Width[12];uint Height[12]", $dwData)
    Local $iNumber = DllStructGetData($strctCount, "Count")
    Local $Height = Int(DllStructGetData($strctRECT, "bottom"))-Int(DllStructGetData($strctRECT, "top"))
    Local $Width = Int(DllStructGetData($strctRECT, "right"))-Int(DllStructGetData($strctRECT, "left"))

    DllStructSetData($strctCount, "Width", $Width, $iNumber+1)
    DllStructSetData($strctCount, "Height", $Height, $iNumber+1)
    DllStructSetData($strctCount, "Count", $iNumber+1)
    Return True
    EndFunc

    [/autoit]
  • Wie kann man abfragen ob ein zweiter Monitor angeschaltet ist?

    • AspirinJunkie
    • 27. Juni 2009 um 11:55

    Probier das mal:

    Spoiler anzeigen
    [autoit]

    $Anzahl = _GetMonitorCount()
    If Not @error Then MsgBox(Default,Default, "Anzahl Monitore: " & $Anzahl)

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

    Func _GetMonitorCount()
    Local $cbMonitorEnumProc = DllCallbackRegister("MonitorEnumProc", "ubyte", "ptr;ptr;ptr;int")
    If @error Then Return SetError(1, 0, False)
    Local $strctCount = DllStructCreate("int Count")
    If @error Then Return SetError(2, @error, False)

    DllStructSetData($strctCount, "Count", 0)

    $Ret = DllCall("User32.dll", "ubyte","EnumDisplayMonitors","ptr", 0,"ptr", 0, "ptr", DllCallbackGetPtr($cbMonitorEnumProc), "ptr", DllStructGetPtr($strctCount))
    If @error Or $Ret[0] = 0 Then Return SetError(3, @error, False)

    DllCallbackFree($cbMonitorEnumProc)

    Return Int(DllStructGetData($strctCount, "Count"))
    EndFunc

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

    Func MonitorEnumProc($hMonitor, $hdcMonitor, $lprcMonitor, $dwData)
    Local $strctCount = DllStructCreate("int", $dwData)
    DllStructSetData($strctCount, 1, DllStructGetData($strctCount, 1)+1)
    Return True
    EndFunc

    [/autoit]


    Kann es nur nicht wirklich testen da ich nur einen Monitor habe ;)

  • Prozess mit Leerzeichen ?!

    • AspirinJunkie
    • 26. Juni 2009 um 15:08

    Hehe - hab mich auch grad mal hingesetzt - so hat er jetzt 2 Möglichkeiten :) :

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    Global $asProcs[1][3]
    Global $hVdmdbgDLL = DllOpen("vdmdbg.dll")
    Global $hProcessTasks = DllCallbackRegister("ProcessTasks", "int", "dword;ushort;ushort;str;str;lparam")
    Global $hProcessVDMs = DllCallbackRegister("ProcessVDMs", "int", "dword;dword;lparam")

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

    _GetDOSTasks()
    _ArrayDisplay($asProcs)

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

    Func _GetDOSTasks()
    DllCall($hVdmdbgDLL, "int", "VDMEnumProcessWOW", "ptr", DllCallbackGetPtr($hProcessVDMs), "lparam", 0)
    EndFunc

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

    ;----------------------CallBack-Funktionen--------------------------------------------------
    Func ProcessTasks($dwThreadID, $hMod16, $hTask16, $pszModName, $pszFileName, $lpUserDefined)
    Local $x = UBound($asProcs,1)
    ReDim $asProcs[$x+1][3]
    $asProcs[$x][0] = $pszFileName ;Dateiname
    $asProcs[$x][1] = $pszModName ;Modulname
    $asProcs[$x][2] = $lpUserDefined ;ProzessID der aufgerufenen ntvdm.exe
    $asProcs[0][0] = $asProcs[0][0]+1
    Return False
    EndFunc

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

    Func ProcessVDMs($dwProcessId, $dwAttributes, $lpUserDefined)
    DllCall($hVdmdbgDLL, "int", "VDMEnumTaskWOWEx", "dword", $dwProcessId, "ptr", DllCallbackGetPtr($hProcessTasks), "lparam", $dwProcessId)
    EndFunc
    ;--------------------------------------------------------------------------------------------

    [/autoit]
  • Prozess mit Leerzeichen ?!

    • AspirinJunkie
    • 26. Juni 2009 um 14:08

    Das ist ein uraltes 16-Bit Tool.
    Das läuft also nicht direkt auf Windows sondern in einer 16-Bit Emulation.
    Bei Windows ist das die Windows NT Virtual DOS Machine: NTVDM.
    Eine gewisse Wahrscheinlichkeit das dein Prozess läuft könntest du also anhand der Existenz des Prozesses ntvdm.exe ableiten.
    Allerdings ist mir nicht bekannt wie man darin das ausgeführte Programm herausfinden kann bzw. bleibt der Prozess auch erhalten auch wenn das 16-Bit Programm schon geschlossen wurde.

    Edit: >>Damit<< sollte man rausbekommen können welche Prozesse in der Virtual DOS Machine laufen.
    Brauchst aber bisschen Ahnung von DLL-Aufrufen in AutoIt und der Windows-API

  • problem mit @error

    • AspirinJunkie
    • 23. Juni 2009 um 00:18

    Nix mit @error - hat dort nichts zu suchen.
    Du machst einen Vergleich baust ihn aber nicht in eine Bedingung ein - damit kann AutoIt ja nichts anfangen.
    Machs so:

    [autoit]

    If $Value[1] < 25000 Then
    Send ("{0}")
    Else
    Send ("{1}")
    EndIf

    [/autoit]
  • Benchmarks

    • AspirinJunkie
    • 15. Juni 2009 um 19:54

    Könntest du mir das mit der "Zeitscheibe" bitte nochmal genauer erklären.
    Hab das jetzt so interpretiert das du damit immer einen neuen Tick erzwingen willst um den systematischen Fehler von TimerInit/TimerDiff zu minimieren.
    Aber wenn ich das mal teste komme ich auf gleiche Werte:

    Spoiler anzeigen
    [autoit]

    Global Const $N = 100000
    Global $Sum = 0

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

    For $i = 1 To $N
    $Sum += TimerDiff(TimerInit())
    Next

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

    ConsoleWrite(StringFormat("TimerDiff systematischer Fehler ohne Sleep(0) Durchschnitt: %.5f ms", $Sum / $N) & @CRLF)

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

    $Sum = 0

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

    For $i = 1 To $N
    Sleep(0)
    $Sum += TimerDiff(TimerInit())
    Next

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

    ConsoleWrite(StringFormat("TimerDiff systematischer Fehler mit Sleep(0) Durchschnitt: %.5f ms", $Sum / $N) & @CRLF

    [/autoit]


    Mal abgesehen davon das der systematische Fehler von TimerInit/TimerDiff im Vergleich zu den anderen Messwerten vernachlässigbar klein ist, vor allem weil er bei meinem oben angegebenen Skript nur zu 1/$N eingeht.

    Aber vielleicht meintest du ja auch was anderes mit der "Zeitscheibe".

    Edit: Ach ja ich konnte natürlich Wikipedia entlocken was mit "Zeitscheibe" gemeint ist.
    Meine Frage ist eher welchen Einfluss das auf unsere Messwerte haben sollte.

  • Benchmarks

    • AspirinJunkie
    • 13. Juni 2009 um 12:52

    Der Unterschied geht auch tatsächlich gegen null.
    Dein Messverfahren ist lediglich ungenügend.
    Die einzelnen Durchläufe sind stark variant so das eine einzelne Zeitmessung nicht repräsentativ ist.
    Man muss schon mehrere Durchläufe machen und einen Mittelwert bilden um ein erstmal halbwegs vernünftiges Ergebnis zu erhalten.
    Später sollte man dann auch noch die Varianzen mit messen um eine Aussage über die erreichte Genauigkeit abzuschätzen.
    Aber im einfachsten Fall würde das so aussehen:

    Spoiler anzeigen
    [autoit]

    Global Const $iN = 10000

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

    $Time = TimerInit()
    For $t = 1 To $iN
    $i = 0
    While $i < 1000
    $i += 1
    WEnd
    Next
    $Time = TimerDiff($Time) / $iN

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

    ConsoleWrite(StringFormat("Durchschnittliche Dauer While: %.5f ms", $Time) & @CRLF)

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

    $Time = TimerInit()
    For $t = 1 To $iN
    $i = 0
    Do
    $i += 1
    Until $i = 1000
    Next
    $Time = TimerDiff($Time) / $iN
    ConsoleWrite(StringFormat("Durchschnittliche Dauer Do-Until: %.5f ms", $Time) & @CRLF)

    [/autoit]
  • StringFormat() Problem!

    • AspirinJunkie
    • 10. Juni 2009 um 12:50
    [autoit]

    printf("%%" & $d & "s = [%" & $d & "s]\n", $s);

    [/autoit]


    Der Parameter "format control" ist ja lediglich ein String.
    Und um dort Variablen in den String einzubauen geht man wie gewohnt via "&"-Zeichen vor um Einzelstrings zu verknüpfen.

  • Installierte Schriftarten + StringRegExpReplace

    • AspirinJunkie
    • 10. Juni 2009 um 11:54

    Vielleicht ist es so etwas überschaubarer?:

    Spoiler anzeigen
    [autoit]

    #include <Array.au3>
    Global $aFonts[1]

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

    _GetSystemFonts()

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

    _ArrayDisplay($aFonts)

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

    Func _GetSystemFonts()
    Local Const $LOGFONT = "long lfHeight;long lfWidth;long lfEscapement;long lfOrientation;long lfWeight;byte lfItalic;byte lfUnderline; byte lfStrikeout;byte lfCharSet;byte lfOutPrecision;byte lfClipPrecision;byte lfQuality;byte lfPitchAndFamily;char lfFaceName[32]"
    Local $hGDI32 = DllOpen("Gdi32.dll"), $hUser32 = DllOpen("user32.dll")
    Local $hDesktop, $hDC, $iReturn
    Local $hCBFunc = DllCallbackRegister("EnumFontFamExProc", "long", "ptr;ptr;dword;lparam")
    Local $strctLOGFONT = DllStructCreate($LOGFONT)

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

    DllStructSetData($strctLOGFONT, "lfCharset", 1)

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

    $hDesktop = DllCall($hUser32, "hwnd", "GetDesktopWindow")
    $hDC = DllCall($hUser32, "ptr", "GetWindowDC", "hwnd", $hDesktop[0])

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

    DllCall($hGDI32, "long", "EnumFontFamiliesEx", "ptr", $hDC[0], "ptr", DllStructGetPtr($strctLOGFONT), "ptr", DllCallbackGetPtr($hCBFunc), "lparam", 10, "DWORD", 0)

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

    $aFonts = _ArrayUnique($aFonts, 1, 1)
    _ArraySort($aFonts, 0,1)

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

    DllCall($hUser32, "int", "ReleaseCapture")
    DllCallbackFree($hCBFunc)
    DllClose($hGDI32)
    DllClose($hUser32)
    EndFunc ;==>_GetSystemFonts

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

    Func EnumFontFamExProc($pLOGFONT, $TEXTMETRIC, $dwType, $lpData)
    Local Const $LOGFONT = "long lfHeight;long lfWidth;long lfEscapement;long lfOrientation;long lfWeight;byte lfItalic;byte lfUnderline; byte lfStrikeout;byte lfCharSet;byte lfOutPrecision;byte lfClipPrecision;byte lfQuality;byte lfPitchAndFamily;char lfFaceName[32]"

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

    ReDim $aFonts[UBound($aFonts)+1]
    $aFonts[UBound($aFonts)-1] = DllStructGetData(DllStructCreate($LOGFONT, $pLOGFONT), "lfFaceName")

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

    Return 1
    EndFunc ;==>EnumFontFamExProc

    [/autoit]

    Wobei ich hier die Sache mit dem ReDim, ArrayUnique und ArraySort nicht als güngstigste Lösung ansehe.
    Ist nur zu Anschauungszwecken.
    Wenn es performant werden soll dann würde ich auf eine Arraylist oder Dictionary ausweichen.

    Edit: Z.B. so:

    Spoiler anzeigen
    [autoit]

    Global $oAList = ObjCreate("System.Collections.ArrayList")

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

    _GetSystemFonts()

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

    For $FontName in $oAList
    ConsoleWrite( $FontName & @CRLF)
    Next

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

    Func _GetSystemFonts()
    Local Const $LOGFONT = "long lfHeight;long lfWidth;long lfEscapement;long lfOrientation;long lfWeight;byte lfItalic;byte lfUnderline; byte lfStrikeout;byte lfCharSet;byte lfOutPrecision;byte lfClipPrecision;byte lfQuality;byte lfPitchAndFamily;char lfFaceName[32]"
    Local $hGDI32 = DllOpen("Gdi32.dll"), $hUser32 = DllOpen("user32.dll")
    Local $hDesktop, $hDC, $iReturn
    Local $hCBFunc = DllCallbackRegister("EnumFontFamExProc", "long", "ptr;ptr;dword;lparam")
    Local $strctLOGFONT = DllStructCreate($LOGFONT)

    $oAList.Clear()

    DllStructSetData($strctLOGFONT, "lfCharset", 1)

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

    $hDesktop = DllCall($hUser32, "hwnd", "GetDesktopWindow")
    $hDC = DllCall($hUser32, "ptr", "GetWindowDC", "hwnd", $hDesktop[0])

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

    DllCall($hGDI32, "long", "EnumFontFamiliesEx", "ptr", $hDC[0], "ptr", DllStructGetPtr($strctLOGFONT), "ptr", DllCallbackGetPtr($hCBFunc), "lparam", 10, "DWORD", 0)

    $oAList.Sort

    DllCall($hUser32, "int", "ReleaseCapture")
    DllCallbackFree($hCBFunc)
    DllClose($hGDI32)
    DllClose($hUser32)
    EndFunc ;==>_GetSystemFonts

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

    Func EnumFontFamExProc($pLOGFONT, $TEXTMETRIC, $dwType, $lpData)
    Local Const $LOGFONT = "long lfHeight;long lfWidth;long lfEscapement;long lfOrientation;long lfWeight;byte lfItalic;byte lfUnderline; byte lfStrikeout;byte lfCharSet;byte lfOutPrecision;byte lfClipPrecision;byte lfQuality;byte lfPitchAndFamily;char lfFaceName[32]"
    Local $sFontName = DllStructGetData(DllStructCreate($LOGFONT, $pLOGFONT), "lfFaceName")

    If Not $oAList.Contains($sFontName) Then $oAList.Add ($sFontName)

    Return 1
    EndFunc ;==>EnumFontFamExProc

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit][/autoit]
  • Habe ein Problem bei Matheformeln in einer Gui

    • AspirinJunkie
    • 8. Juni 2009 um 20:43

    Du hast Opt('MustDeclareVars', 1) gesetzt - warum?
    Nun ist zwar schöner Stil sich zu zwingen unbedingt alle Variablen zu deklarieren aber man muss das dann halt auch einfach durchziehen.
    Also entweder deklarierst du vorher noch alle vorkommenden Variablen (mit Global oder Local - je nach Verwendung) oder du lässt die Option 'MustDeclareVars' weg.

  • wie viel ram verbraucht ein prozess

    • AspirinJunkie
    • 31. Mai 2009 um 13:42
    [autoit]

    Global $hPsAPI = DllOpen("Psapi.dll")
    Global $hKernel = DllOpen("Kernel32.dll")
    Global $Prozessname, $PMemInfo, $Text

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

    $Prozessname = "explorer.exe"
    $PMemInfo = _GetProcessMemInfo($Prozessname)

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

    $Text = $Prozessname & @CRLF & @CRLF & _
    "PeakWorkingSetSize: " & $PMemInfo[0] & ' kb' & @CRLF & _
    "WorkingSetSize: " & $PMemInfo[1] & ' kb' & @CRLF & _
    "QuotaPeakPagedPoolUsage: " & $PMemInfo[2] & ' kb' & @CRLF & _
    "QuotaPagedPoolUsage: " & $PMemInfo[3] & ' kb' & @CRLF & _
    "QuotaPeakNonPagedPoolUsage: " & $PMemInfo[4] & ' kb' & @CRLF & _
    "QuotaNonPagedPoolUsage: " & $PMemInfo[5] & ' kb' & @CRLF & _
    "PagefileUsage: " & $PMemInfo[6] & ' kb' & @CRLF & _
    "PeakPagefileUsage: " & $PMemInfo[7] & ' kb' & @CRLF & _
    "PrivateUsage: " & $PMemInfo[8] & ' kb'

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

    MsgBox(0,"", $Text)

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

    Func _GetProcessMemInfo($PID)
    Local $PROCESS_MEMORY_COUNTERS_EX, $hProcess
    Local $aReturn[9]

    If IsString($PID) Then $PID = ProcessExists($PID)
    If $PID < 1 Then Return SetError(1,1,$aReturn)

    $hProcess = DllCall($hKernel,"int", "OpenProcess","dword",0x0400 + 0x0010,"int",0,"dword",$PID)
    If @error Or Not $hProcess[0] Then Return SetError(2,2,$aReturn)

    $PROCESS_MEMORY_COUNTERS_EX = DllStructCreate("dword; dword; uint; uint; uint; uint; uint; uint; uint; uint; uint")

    DllCall($hPsAPI, "int", "GetProcessMemoryInfo", "hwnd", $hProcess[0], "ptr", DllStructGetPtr($PROCESS_MEMORY_COUNTERS_EX), "dword", DllStructGetSize($PROCESS_MEMORY_COUNTERS_EX))
    DllCall($hKernel, "int", "CloseHandle", "hwnd", $hProcess[0])

    For $i = 0 To 8
    $aReturn[$i] = DllStructGetData($PROCESS_MEMORY_COUNTERS_EX, $i + 2) / 1024
    Next

    Return $aReturn
    EndFunc

    [/autoit]
  • Installation im Hintergrund (oder zumindest Fenster minimieren)

    • AspirinJunkie
    • 25. Mai 2009 um 16:35

    Naja - man kann ja auch einfach einen Screenshot vor der Installation anlegen und diesen während des Setups darüberlegen.
    Mal als Beispiel:

    [autoit]

    #include <WindowsConstants.au3>
    #include <GuiConstantsEx.au3>
    #include <GDIPlus.au3>
    #include <ScreenCapture.au3>

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

    $hHide = _StartHiddenMode()

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

    ;----------Dein Skript---------
    ; |
    ; |
    ; |
    ;--------------------------------

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

    _StopHiddenMode($hHide)

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

    Func _StartHiddenMode()
    Local $hGUI, $hBMP, $hGraphic, $hBackground

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

    $hBMP = _ScreenCapture_Capture()

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

    $hGUI = GUICreate("ScreenShot", @DesktopWidth, @DesktopHeight, 0, 0, $WS_POPUP,$WS_EX_TOPMOST)
    GUISetState()

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

    _GDIPlus_Startup()

    $hBitmap = _GDIPlus_BitmapCreateFromHBITMAP ($hBMP)
    $hGraphic = _GDIPlus_GraphicsCreateFromHWND ($hGUI)
    _GDIPlus_GraphicsDrawImage ($hGraphic, $hBitmap, 0, 0)

    _GDIPlus_GraphicsDispose ($hGraphic)
    _GDIPlus_ImageDispose ($hBitmap)
    _WinAPI_DeleteObject ($hBMP)
    _GDIPlus_ShutDown ()

    Return $hGUI
    EndFunc ;==>_StartHiddenMode

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

    Func _StopHiddenMode($hGUI)
    GUIDelete($hGUI)
    EndFunc ;==>_StopHiddenMode

    [/autoit]
  • Anwendungspfad anhand der PID ermitteln

    • AspirinJunkie
    • 24. Mai 2009 um 17:01

    Und mit @RequireAdmin?
    Ansonsten versuchs mal mit dieser (ungetestet - hab gerade kein AutoIt zur Hand):

    Spoiler anzeigen
    [autoit]

    Global $hPsAPI = DllOpen("Psapi.dll")
    Global $hKernel = DllOpen("Kernel32.dll")

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

    Func _ProcessGetPath($hPID)
    Local $sPath = DllStructCreate("char[1000]")
    Local $hProcess = DllCall($hKernel,"int", "OpenProcess","dword",0x0400 + 0x0010,"int",0,"dword",$hPID)
    DllCall($hPsAPI,"long","GetModuleFileNameEx","long",$hProcess[0],"int",0,"ptr",DllStructGetPtr($sPath),"long",DllStructGetSize($sPath))
    DllCall($hKernel,"int", "CloseHandle","hwnd",$hProcess[0])
    Return DllStructGetData($sPath,1)
    EndFunc

    [/autoit]

    Ansonsten mal eine Variante ohne OpenProcess (ebenfalls ungetestet):

    Spoiler anzeigen
    [autoit]

    Global $oWMI = ObjGet("winmgmts:\\localhost\root\CIMV2")

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

    Func _GetProcessPath($hPID)
    For $o In $oWMI.ExecQuery("SELECT ExecutablePath FROM Win32_Process WHERE ProcessID=" & $hPID, "WQL", 48)
    Return $o.ExecutablePath
    Next
    EndFunc

    [/autoit]


    Allerdings ist die 2. Funktion logischerweise deutlich langsamer als die 1.

  • Zensur?

    • AspirinJunkie
    • 6. Mai 2009 um 09:36

    Hier muss gar nichts mit irgendwelchen Gesetzen begründet werden.
    Jeder Nutzer hat mit seiner Anmeldung einen Vertrag geschlossen in dem er die Nutzungsbedingungen anerkennt.
    Der Forenbetreiber besitzt ein virtuelles Hausrecht welches du beim Anmelden akzeptiert hast.
    Ein solches wurde schon in mehreren Gerichtsverfahren bestätigt.
    Unter anderem hast du in folgendes eingestimmt:

    Zitat

    Weiterhin können Einträge [...] ohne weitere Begründung editiert oder gelöscht werden.

    Hier ist niemand in der Pflicht dir irgendetwas begründen zu müssen.

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™