Advertisement
BugFix

Untitled

Jul 27th, 2012
266
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
AutoIt 2.92 KB | None | 0 0
  1.  
  2. ; CompatibleDC vom Desktop-Device Context erstellen
  3. $hDeskDC = _WinAPI_CreateCompatibleDC(_WinAPI_GetDC(_WinAPI_GetDesktopWindow()))
  4. ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hDeskDC = ' & $hDeskDC & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
  5.  
  6. ; Compatible Bitmap davon erstellen
  7. $hBitmap = _WinAPI_CreateCompatibleBitmap($hDeskDC, @DesktopWidth, @DesktopHeight)
  8. ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hBitmap = ' & $hBitmap & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
  9.  
  10. ; Bitmap und Device Context per SelectObject verbinden.
  11. $hDCBlt = _WinAPI_SelectObject($hDeskDC, $hBitmap)
  12. ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hDCBlt = ' & $hDCBlt & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
  13.  
  14.  
  15.  
  16. ; TEST - Skype Hwnd übergeben
  17. Local $oldOpt = Opt("WinTitleMatchMode", 2)
  18. $hWnd = WinGetHandle('Skype')
  19. Opt("WinTitleMatchMode", $oldOpt)
  20.  
  21.  
  22. ; gesamten Fensterinhalt der gewünschten Anwendung mit PrintWindow in das Bitmap-Objekt kopieren
  23. DllCall("user32.dll", "long", "PrintWindow", "hwnd", $hWnd, "long", $hDCBlt, "uint", 0)
  24.  
  25. ; daraus mit CopyImage eine DIBSection erstellen
  26. Local Const $LR_COPYDELETEORG = 0x00000008, $LR_COPYRETURNORG = 0x00000004, $LR_CREATEDIBSECTION = 0x00002000
  27. Local $aRet = DllCall("User32.dll", "hwnd", "CopyImage", "hwnd", $hDCBlt, "uint", 0, "int", 0, "int", 0, "uint", BitOr($LR_COPYDELETEORG, $LR_COPYRETURNORG, $LR_CREATEDIBSECTION))
  28. Local $hDIBSection = $aRet[0]
  29. ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $hDIBSection = ' & $hDIBSection & @crlf & '>Error code: ' & @error & @crlf) ;### Debug Console
  30.  
  31. ;
  32. Local $tagRGBQUAD = 'BYTE rgbBlue;BYTE rgbGreen;BYTE rgbRed;BYTE rgbReserved;'
  33. Local $arRGBQUAD  = _ByteArray_Create($tagRGBQUAD, 100)  ; WIEVIEL ??
  34.  
  35. ; Aufruf noch falsch, ByteArray oder Pointer - wenn Pointer, wie krieg ich den auf ein Bytearray?
  36. $aRet = DllCall("Gdi32.dll", "int", "GetDIBColorTable", "hwnd", $hDIBSection, "uint", 0, "uint", 1, "ptr", DllStructGetPtr($arRGBQUAD))
  37. ConsoleWrite('Anzahl Table-Einträge: ' & $aRet[0] & @CRLF)
  38.  
  39.  
  40. ;===============================================================================
  41. ; Function Name:   _ByteArrayCreate($sSTRUCT, $iELEMENTS=2)
  42. ; Description:     Erstellt eine Bytearray-Struktur
  43. ; Parameter(s):    $sSTRUCT     String der Struktur
  44. ;                  $iELEMENTS   Anzahl der Elemente des Bytearray
  45. ; Return Value(s): das erstellte Bytearray
  46. ; Author(s):       BugFix (bugfix@autoit.de)
  47. ;===============================================================================
  48. Func _ByteArray_Create($sSTRUCT, $iELEMENTS=2)
  49.     Local $SIZE = DllStructGetSize(DllStructCreate($sSTRUCT, 1))
  50.     Local $aBYTE[$iELEMENTS +1]
  51.     $aBYTE[0] = DllStructCreate('byte[' & $SIZE *$iELEMENTS & "]")
  52.     Local $ptr = DllStructGetPtr($aBYTE[0])
  53.     For $i = 0 To $iELEMENTS -1
  54.         $aBYTE[$i+1] = DllStructCreate($sSTRUCT, $ptr + $i*$SIZE)
  55.     Next
  56.     Return $aBYTE
  57. EndFunc  ;==>_ByteArray_Create
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement