Jump to content

ProgAndy

MVPs
  • Posts

    2,483
  • Joined

  • Last visited

  • Days Won

    5

Everything posted by ProgAndy

  1. Binary is defined for those values. It returns exactly what it should: the exact binary data stored in memory. It is also documented that AutoIt stores floating point numbers as doubles.Number on the other hand is not defined for binary input, although the description of the parameter only expects an "expression" It works well with everything except binary data in IEEE 754 format. If you want to write it, don't wait for someone else. The conversion is already possible with the DLLStruct functions.
  2. You could try to use the MozRepl-addon in a similar manner to FF.au3.
  3. I forgot that AutoItX doesn't come with the required .lib files and it is a bit tricky to create them from the dll, but it should be possible.http://gnuwin32.sourceforge.net/msimport.html
  4. You call LoadLibrary each time the function is entered, but CloseHandle is never called. By the way, why don't you link to the dll to create a hard dependency?
  5. Maybe a bug? For now you can do this: Func _BinaryToDouble($v) Local $t = DllStructCreate("double") DllStructSetData(DllStructCreate("byte[8]", DllStructGetPtr($t)), 1, Binary($v)) Return DllStructGetData($t, 1) EndFunc
  6. This is fairly simple: $b = Binary("0x...") $n = Number($b, 3)
  7. Maybe the SysTray UDFs can help
  8. The window has a name and a class. Convert it to a handle with WinGetHandle: $oTaskbarList.DeleteTab(WinGetHandle("Title of Window"))
  9. Please have a look at the example for ObjCreateInterface. It uses the ITaskbarList interface to hide Notepad from the taskbar.
  10. There is noting to implement. Create a property style (probably as read only) and set another object as its value.
  11. If you need a responsive grid or spreadsheet control, try to use a custom control implemented in a DLL like RAGrid or SpreadSheet. AutoIt is just too slow to draw a complete GUI effortlessly without external help.
  12. Origo has shut down. Indeed, 1.2.8.2 is the most recent version, but I have no copies on my laptop. I'll have to look on my other computer, probably something is there. At least a version more recent than 1.2.2.0
  13. This piece of code works for me. Some parts of _AppVisibilityEvents_GetPtr could be replaced with AutoItObject, but I think that would be overkill #include <WinAPI.au3> Global Const $sIID_IAppVisibilityEvents = "{6584CE6B-7D82-49C2-89C9-C6BC02BA8C38}" Global Const $sIID_IUnknown = "{00000000-0000-0000-C000-000000000046}" Global Const $sVTable_IAppVisibilityEvents = "ptr QueryInterface; ptr AddRef; ptr Release; ptr AppVisibilityOnMonitorChanged; ptr LauncherVisibilityChange;" Func __AppVisibilityEvents_QueryInterface($pSelf, $pRIID, $pObj) #forceref $pSelf, $pRIID, $pObj ConsoleWrite("__AppVisibilityEvents_QueryInterface called " & $pSelf & " " & _WinAPI_StringFromGUID($pRIID) & " ") Local $tStruct = DllStructCreate("ptr", $pObj) Switch _WinAPI_StringFromGUID($pRIID) Case $sIID_IUnknown DllStructSetData($tStruct, 1, $pSelf) ConsoleWrite("IUnknown" & @CRLF) Return 0 Case $sIID_IAppVisibilityEvents DllStructSetData($tStruct, 1, $pSelf) ConsoleWrite("IAppVisibilityEvents" & @CRLF) Return 0 EndSwitch ConsoleWrite("~ E_NOINTERFACE" & @CRLF) Return 0x80004002 ; E_NOINTERFACE EndFunc ;==>__AppVisibilityEvents_QueryInterface Func __AppVisibilityEvents_AddRef($pSelf) #forceref $pSelf ConsoleWrite("__AppVisibilityEvents_AddRef called" & @CRLF) Return 0x80004001 ; E_NOTIMPL EndFunc ;==>__AppVisibilityEvents_AddRef Func __AppVisibilityEvents_Release($pSelf) #forceref $pSelf ConsoleWrite("__AppVisibilityEvents_Release called" & @CRLF) Return 0x80004001 ; E_NOTIMPL EndFunc ;==>__AppVisibilityEvents_Release Func _AppVisibilityEvents_AppVisibilityOnMonitorChanged($pSelf, $hMonitor, $previousMode, $currentMode) ConsoleWrite("_AppVisibilityEvents_AppVisibilityOnMonitorChanged called: " & $hMonitor & " " & $previousMode & " " & $currentMode & @CRLF) Return 0x80004001 ; E_NOTIMPL EndFunc Func _AppVisibilityEvents_LauncherVisibilityChange($pSelf, $currentVisibleState); ConsoleWrite("_AppVisibilityEvents_LauncherVisibilityChange called: " & $currentVisibleState & @CRLF) Return 0x80004001 ; E_NOTIMPL EndFunc Func _AppVisibilityEvents_GetPtr() Local Static $tObj = DllStructCreate("ptr"), $tTable If Not DllStructGetData($tObj, 1) Then $tTable = DllStructCreate($sVTable_IAppVisibilityEvents) DllStructSetData($tObj, 1, DllStructGetPtr($tTable)) DllStructSetData($tTable, 1, DllCallbackGetPtr(DllCallbackRegister("__AppVisibilityEvents_QueryInterface", "long", "ptr;ptr;ptr"))) DllStructSetData($tTable, 2, DllCallbackGetPtr(DllCallbackRegister("__AppVisibilityEvents_AddRef", "long", "ptr"))) DllStructSetData($tTable, 3, DllCallbackGetPtr(DllCallbackRegister("__AppVisibilityEvents_Release", "long", "ptr"))) DllStructSetData($tTable, 4, DllCallbackGetPtr(DllCallbackRegister("_AppVisibilityEvents_AppVisibilityOnMonitorChanged", "long", "ptr;ptr;int;int"))) DllStructSetData($tTable, 5, DllCallbackGetPtr(DllCallbackRegister("_AppVisibilityEvents_LauncherVisibilityChange", "long", "ptr;int"))) EndIf Return DllStructGetPtr($tObj) EndFunc ;=============================================================================== #interface "IAppVisibility" Global Const $sCLSID_AppVisibility = "{7E5FE3D9-985F-4908-91F9-EE19F9FD1514}" Global Const $sIID_IAppVisibility = "{2246EA2D-CAEA-4444-A3C4-6DE827E44313}" ; Definition Global Const $tagIAppVisibility = "GetAppVisibilityOnMonitor hresult(ptr;int*);" & _ "IsLauncherVisible hresult(int*);" & _ "Advise hresult(ptr;dword*);" & _ "Unadvise hresult(dword);" ;============================================================================== Local $oAppVisibility = ObjCreateInterface($sCLSID_AppVisibility, $sIID_IAppVisibility, $tagIAppVisibility) ;~ MsgBox(0, @ScriptName, IsObj($oAppVisibility)) ;~ ConsoleWrite(IsObj($oAppVisibility) & @CRLF) If Not IsObj($oAppVisibility) Then ConsoleWrite("NOT IsObj" & @LF) MsgBox(0, "", "NOT IsObj") Exit EndIf Global $dwEventsCookie $oAppVisibility.Advise(_AppVisibilityEvents_GetPtr(), $dwEventsCookie) OnAutoItExitRegister("_UnadviseEvents") HotKeySet("ö", "_IsLauncherVisible") HotKeySet("å", "_GetAppVisibilityOnMonitor") $oMyError = ObjEvent("AutoIt.Error", "ErrFunc") ; Install a custom error handler $callback=DllCallbackRegister("_MonitorEnumProc","int","ptr;ptr;ptr;lparam") Global $Monitor DllCall("user32.dll","int","EnumDisplayMonitors","ptr",0,"ptr",0,"ptr",DllCallbackGetPtr($callback),"lparam",10) While 1 Sleep(1000) WEnd Func _UnadviseEvents() $oAppVisibility.Unadvise($dwEventsCookie) EndFunc Func _IsLauncherVisible() Local $bVisible $iRet = $oAppVisibility.IsLauncherVisible($bVisible) ;~ If @error Then ;Enable this and disable AutoIt.Error if on Alpha ;~ MsgBox(0, @ScriptName, @error) ;~ EndIf ToolTip("1: " & $iRet & @CRLF & "2: " & $bVisible) EndFunc Func _GetAppVisibilityOnMonitor() Local $iMode $iRet = $oAppVisibility.GetAppVisibilityOnMonitor($Monitor, $iMode) ToolTip("1: " & $iRet & @CRLF & "2: " & $iMode) EndFunc ; This is a custom error handler Func ErrFunc() $HexNumber = Hex($oMyError.number, 8) MsgBox(0, "", "We intercepted a COM Error !" & @CRLF & _ "Number is: " & $HexNumber & @CRLF & _ "WinDescription is: " & $oMyError.windescription) $iEventError = 1 ; Use to check when a COM Error occurs EndFunc ;==>ErrFunc Func _MonitorEnumProc($hMonitor, $hdcMonitor, $lprect, $lparam) MsgBox(0, "Monitor", "Monitor handle: " & $hMonitor & @CRLF & "LPARAM: " & $lparam) $Monitor = $hMonitor EndFunc
  14. I think you are on the right track, but the example is for IDispatch-Events. The event-interface for IAppVisibility is not that difficult and sophosticated. Create a DLLStruct for the object and the vTable-Struct with all methods using DLLCallbackRegister / ...GetPtr. Now just pass this reference to Advise. I'll hack something together on my Win8 VM
  15. You cannot ask for a range with And. You have to specify the variable for each expression: Case $a >= 0 And $a <= 9
  16. You casees with "or", "and" are most certainly wrong.
  17. Your x64-DLL is not statically linked and requires libstdc++-6.dll, I found one but it did not work. Also, do not hardcode the DLL-path in the UDF. Create a function _AXml_Startup to load the correct dll. If no parameter is given, try AXml_x64.dll and AXml.dll for x64, and AXml_x32.dll, AXml_x86.dll, AXml.dll for 32bit. When the user sets a custom path, load the DLL from there. If this DLL is not valid, return an error. Don't force the application to exit when the dll is missing. This is a choice the developer has to make for each project separately.
  18. You can also use FreeImage. These snippets are in C, but the AutoIt-code should be similar. When you have the HBITMAP, use Edit: Here is an example: #AutoIt3Wrapper_usex64=n #include<WinAPI.au3> #include<FreeImage.au3> #include <GUIConstants.au3> ; modify these variables Global Const $sFreeImageDLL = "E:UDFFreeImageFreeImage.dll" Global Const $sTIFF_File = @ScriptDir & "test.tif" _FreeImage_LoadDLL($sFreeImageDLL) #region - GUI Create GUICreate('Display', 400, 400) $iPic = GUICtrlCreatePic("", 0, 0, 400, 400) GUISetState() #endregion ; Load image, create thumbnail, maximum 400x400px $pDIBOrg = _FreeImage_Load($FIF_TIFF, $sTIFF_File); $pDIB = _FreeImage_MakeThumbnail($pDIBOrg, 400) _FreeImage_Unload($pDIBOrg) ; create windows HBITMAP for picture control $hDC = _WinAPI_GetDC(GUICtrlGetHandle($iPic)) $hBitmap = DllCall('gdi32.dll', 'ptr', 'CreateDIBitmap', 'hwnd', $hDC, 'ptr', _FreeImage_GetInfoHeader($pDIB), 'dword', 0x04, 'ptr', _FreeImage_GetBits($pDIB), 'ptr', _FreeImage_GetInfo($pDIB), "uint", 0) $hBitmap = $hBitmap[0] _WinAPI_ReleaseDC(GUICtrlGetHandle($iPic), $hDC) ; Free FreeImage image _FreeImage_Unload($pDIB); ; set HBITMAP to control _GUICtrlStatic_SetImage($iPic, $hBitmap) #region - GUI SelectLoop While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE Exit EndSelect WEnd #endregion ; #FUNCTION# ==================================================================================================================== ; Name...........: _GUICtrlStatic_SetImage ; Description ...: Sets a HBITMAP to a static control like image or label ; Syntax.........: _GUICtrlStatic_SetImage($iCtrlId, $hBitmap) ; Parameters ....: $iCtrlId - CtrlId or handle of Control in the current process ; $hBitmap - Pointer top Windows HBITMAP ; Return values .: Success - 1 ; Failure - 0 and set @error: ; |1 - invalid $pSource ; |1 - invalid $pSource ; Author ........: ProgAndy, Zedna ; Modified.......: ; Remarks .......: ; Related .......: ; Link ..........: ; Example .......: ; =============================================================================================================================== Func _GUICtrlStatic_SetImage($iCtrlId, $hBitmap) Local Const $STM_SETIMAGE = 0x0172 Local Const $IMAGE_BITMAP = 0 Local Const $SS_BITMAP = 0xE Local Const $GWL_STYLE = -16 If IsHWnd($iCtrlId) Then If WinGetProcess($iCtrlId) <> @AutoItPID Then Return SetError(1,0,0) Else $iCtrlId = GUICtrlGetHandle($iCtrlId) If Not $iCtrlId Then Return SetError(2,0,0) EndIf ; set SS_BITMAP style to control Local $oldStyle = DllCall("user32.dll", "long", "GetWindowLong", "hwnd", $iCtrlId, "int", $GWL_STYLE) If @error Then Return SetError(3, 0, 0) DllCall("user32.dll", "long", "SetWindowLong", "hwnd", $iCtrlId, "int", $GWL_STYLE, "long", BitOR($oldStyle[0], $SS_BITMAP)) If @error Then Return SetError(4, 0, 0) Local $oldBmp = DllCall("user32.dll", "handle", "SendMessageW", "hwnd", $iCtrlId, "int", $STM_SETIMAGE, "wparam", $IMAGE_BITMAP, "handle", $hBitmap) If @error Then Return SetError(5, 0, 0) If $oldBmp[0] Then _WinAPI_DeleteObject($oldBmp[0]) Return 1 EndFunc
  19. How did you create your text editor? Is it an AutoIt-script with GUICtrlCreateEdit? Create a simple GUI with the input window and FIND / NEXT buttons. Then read the text, get the current selection and begin your search with the selection end as the offset . Select the next occurence and scroll it into the viewport.
  20. Does it work if you compile without the obfuscator? Do you have file.au3 in different locations in you include paths?
  21. Hi, You can send HTTP requests with POST-data using the WinHtpp UDFs (link in my signature). You should be able to find a JSON-parser in the forum, too. Or simply use String... functions.
  22. Put it in a new folder and run your scripts manually or add a custom menu entry to SciTE or overwrite the beta or ...
  23. Yes, move it. I think either google code or github is fine and I already have accounts (gitorious is also good I think). If you know a better place, say so.
  24. You should consider using GuiOnEventMode.
  25. hannes08 has the right idea, but there should be more tests while assigning the number and LIMIT 1 in an UPDATE clause is AFAIK not alwayys working. Table: link_no (PK), user_id - assign link_no: UPDATE linktable SET user_id='THISUSER' WHERE link_no = (SELECT link_no FROM linktable WHERE user_id = '' LIMIT 1) - get link_no: SELECT link_no FROM linktable WHERE user_id = 'THISUSER' - delete link_no: DELETE FROM linktable WHERE user_id = 'THISUSER' or: DELETE FROM linktable WHERE link_no = link_no_previously_stored_in_script
×
×
  • Create New...