Leaderboard
Popular Content
Showing content with the highest reputation on 09/07/2012 in all areas
-
Good example. OTOH, you can also retrieve a 2D array containing all columns of all rows by using: Func Search() Local $sql = Connect() $string = "select * from assets" $i = _Query($sql, $string) With $i Local $a = .GetRows() ; <=== here _ArrayDisplay($a) EndWith BTW, you should probably not have to make a brand new connection for every invokation of Search().1 point
-
1 point
-
You can try something like this here but the png transparency is not fully supported! #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GDIPlus.au3> Global Const $SC_DRAGMOVE = 0xF012 _GDIPlus_Startup() $hGUI = GUICreate("Test", 450, 200) $Bar = GUICtrlCreatePic("", 15, 70, 408, 32) GUICtrlSetImage($Bar, @ScriptDir & "A.bmp") Global $iBorder = _WinAPI_GetSystemMetrics(8) Global $iBar = _WinAPI_GetSystemMetrics(4) Global $aMain_Pos = WinGetPos($hGUI) Global Const $IMAGE_BITMAP = 0 Global Const $STM_SETIMAGE = 0x0172 Global Const $iTransCol = 0x101010 Global $hGUI_Slider = GUICreate("", 0, 0, 100, 52, $WS_POPUP, $WS_EX_MDICHILD + $WS_EX_LAYERED, $hGUI) Global $hBitmap = _GDIPlus_CreateHBitmapFromFile(@ScriptDir & "button_smiley.png", 56, 68) _WinAPI_MakeGUITransparent($hGUI_Slider, $hBitmap, 56, 68) GUISetState(@SW_SHOW, $hGUI_Slider) GUISetState(@SW_SHOW, $hGUI) GUIRegisterMsg($WM_WINDOWPOSCHANGING, "WM_WINDOWPOSCHANGING") While 1 $aMsg = GUIGetMsg(1) Switch $aMsg[1] Case $hGUI Switch $aMsg[0] Case $GUI_EVENT_CLOSE _Exit() EndSwitch Case $hGUI_Slider Switch $aMsg[0] Case $GUI_EVENT_CLOSE _Exit() Case $GUI_EVENT_PRIMARYDOWN _SendMessage($hGUI_Slider, $WM_SYSCOMMAND, $SC_DRAGMOVE, 0) EndSwitch EndSwitch WEnd Func _Exit() _GDIPlus_Shutdown() GUIDelete() Exit EndFunc ;==>_Exit Func _WinAPI_MakeGUITransparent($hGUI, $hHBitmap, $iW, $iH, $iTrans = 0xFF) Local $hScrDC = _WinAPI_GetDC(0) Local $hMemDC = _WinAPI_CreateCompatibleDC($hScrDC) Local $hOld = _WinAPI_SelectObject($hMemDC, $hHBitmap) Local $tSize = DllStructCreate($tagSIZE) Local $pSize = DllStructGetPtr($tSize) DllStructSetData($tSize, "X", $iW) DllStructSetData($tSize, "Y", $iH) Local $tSource = DllStructCreate($tagPOINT) Local $pSource = DllStructGetPtr($tSource) Local $tBlend = DllStructCreate($tagBLENDFUNCTION) Local $pBlend = DllStructGetPtr($tBlend) DllStructSetData($tBlend, "Alpha", $iTrans) DllStructSetData($tBlend, "Format", 1) _WinAPI_UpdateLayeredWindow($hGUI, $hScrDC, 0, $pSize, $hMemDC, $pSource, 0, $pBlend, 2) _WinAPI_ReleaseDC(0, $hScrDC) _WinAPI_SelectObject($hMemDC, $hOld) _WinAPI_DeleteObject($hHBitmap) _WinAPI_DeleteDC($hMemDC) Return 1 EndFunc ;==>_WinAPI_MakeGUITransparentGUI Func _GDIPlus_CreateHBitmapFromFile($sFile, $iW, $iH) Local $hBmp = _GDIPlus_BitmapCreateFromFile($sFile) Local $aResult = DllCall($ghGDIPDll, "uint", "GdipCreateBitmapFromScan0", "int", $iW, "int", $iH, "int", 0, "int", 0x0026200A, "ptr", 0, "int*", 0) Local $hBitmap = $aResult[6] Local $hCtxt = _GDIPlus_ImageGetGraphicsContext($hBitmap) DllCall($ghGDIPDll, "uint", "GdipSetInterpolationMode", "handle", $hCtxt, "int", 7) _GDIPlus_GraphicsDrawImageRect($hCtxt, $hBmp, 0, 0, $iW, $iH) _GDIPlus_BitmapDispose($hBmp) _GDIPlus_GraphicsDispose($hCtxt) Local $hHBmp = _WinAPI_BitmapCreateDIBFromBitmap($hBitmap) _GDIPlus_BitmapDispose($hBitmap) Return $hHBmp EndFunc ;==>_GDIPlus_CreateHBitmapFromFile Func _WinAPI_BitmapCreateDIBFromBitmap($hBitmap) ;create 32-bit bitmap v5 (alpha channel supported) Local $tBIHDR, $aRet, $tData, $pBits, $hResult = 0 $aRet = DllCall($ghGDIPDll, 'uint', 'GdipGetImageDimension', 'ptr', $hBitmap, 'float*', 0, 'float*', 0) If (@error) Or ($aRet[0]) Then Return 0 $tData = _GDIPlus_BitmapLockBits($hBitmap, 0, 0, $aRet[2], $aRet[3], $GDIP_ILMREAD, $GDIP_PXF32ARGB) $pBits = DllStructGetData($tData, 'Scan0') If Not $pBits Then Return 0 $tBIHDR = DllStructCreate('dword bV5Size;long bV5Width;long bV5Height;ushort bV5Planes;ushort bV5BitCount;dword bV5Compression;dword bV5SizeImage;long bV5XPelsPerMeter;long bV5YPelsPerMeter;dword bV5ClrUsed;dword bV5ClrImportant;dword bV5RedMask;dword bV5GreenMask;dword bV5BlueMask;dword bV5AlphaMask;dword bV5CSType;int bV5Endpoints[3];dword bV5GammaRed;dword bV5GammaGreen;dword bV5GammaBlue;dword bV5Intent;dword bV5ProfileData;dword bV5ProfileSize;dword bV5Reserved;') DllStructSetData($tBIHDR, 'bV5Size', DllStructGetSize($tBIHDR)) DllStructSetData($tBIHDR, 'bV5Width', $aRet[2]) DllStructSetData($tBIHDR, 'bV5Height', $aRet[3]) DllStructSetData($tBIHDR, 'bV5Planes', 1) DllStructSetData($tBIHDR, 'bV5BitCount', 32) DllStructSetData($tBIHDR, 'bV5Compression', 3) ; $BI_BITFIELDS = 3 DllStructSetData($tBIHDR, 'bV5SizeImage', $aRet[3] * DllStructGetData($tData, 'Stride')) DllStructSetData($tBIHDR, 'bV5AlphaMask', 0xFF000000) DllStructSetData($tBIHDR, 'bV5RedMask', 0x00FF0000) DllStructSetData($tBIHDR, 'bV5GreenMask', 0x0000FF00) DllStructSetData($tBIHDR, 'bV5BlueMask', 0x000000FF) DllStructSetData($tBIHDR, 'bV5CSType', 2) ; LCS_WINDOWS_COLOR_SPACE = 2 DllStructSetData($tBIHDR, 'bV5Intent', 4) ; $LCS_GM_IMA $hResult = DllCall('gdi32.dll', 'ptr', 'CreateDIBSection', 'hwnd', 0, 'ptr', DllStructGetPtr($tBIHDR), 'uint', 0, 'ptr*', 0, 'ptr', 0, 'dword', 0) If (Not @error) And ($hResult[0]) Then DllCall('gdi32.dll', 'dword', 'SetBitmapBits', 'ptr', $hResult[0], 'dword', $aRet[2] * $aRet[3] * 4, 'ptr', DllStructGetData($tData, 'Scan0')) $hResult = $hResult[0] Else $hResult = 0 EndIf _GDIPlus_BitmapUnlockBits($hBitmap, $tData) $tData = 0 $tBIHDR = 0 Return $hResult EndFunc ;==>_WinAPI_BitmapCreateDIBFromBitmap Func WM_WINDOWPOSCHANGING($hWnd, $Msg, $wParam, $lParam) If $hWnd = $hGUI_Slider Then $aMain_Pos = WinGetPos($hGUI) Local $iY = $aMain_Pos[1] + $iBorder + $iBar + 52 Local $iX_Min = $aMain_Pos[0] + $iBorder + 15 Local $iX_Max = $aMain_Pos[0] + $iBorder + 367 Local $stWinPos = DllStructCreate("uint;uint;int;int;int;int;uint", $lParam) Local $iLeft = DllStructGetData($stWinPos, 3) Local $iTop = DllStructGetData($stWinPos, 4) Local $iWidth = DllStructGetData($stWinPos, 5) Local $iHeight = DllStructGetData($stWinPos, 6) If $iLeft < $iX_Min Then DllStructSetData($stWinPos, 3, $iX_Min) If $iLeft > $iX_Max Then DllStructSetData($stWinPos, 3, $iX_Max) If $iTop <> $iY Then DllStructSetData($stWinPos, 4, $iY) EndIf EndFunc ;==>WM_WINDOWPOSCHANGING But it is not flickering on movement... Br, UEZ1 point
-
I don't think the function Execute() is meant to call a function. I cannot believe that in 2 years you could not find the Call() function.1 point
-
help
Attckdog reacted to Blue_Drache for a topic
May I suggest reading the forum rules before posting the screenshot of the game you're trying to automate?1 point -
why no use DriveGetFileSystem ?1 point
-
run program with atributes
jackraymund reacted to JLogan3o13 for a topic
Ah, you are correct jackraymund, I misunderstood from the limited info in your initial post. As BrewManNH suggests above, you can use the Command Line Parameters to add functionality to your compiled script. As an example, I use the snippet below to allow me to decompile my compiled executable if I need to recover my original script: If StringInStr($cmdlineRaw, "/Extract") Then FileInstall("C:MyScript.au3", @TempDir & "Source.au3", 1) EndIf1 point -
run program with atributes
jackraymund reacted to BrewManNH for a topic
Look at the help file under "Using AutoIt" and look at the Command Line Parameters section. Also, do a search for $cmdline on the forum, it will probably link to a few scripts using command line parameters as input to the script.1 point -
run program with atributes
jackraymund reacted to JLogan3o13 for a topic
Hi, jackraymund. The answer is yes, you can run programs with switches. Check out Run or ShellExecute in the help file: Run: Run("asdf.exe -t -x 123") ShellExecute: ShellExecute("asdf.exe", "-t -x 123")1 point