Jump to content

Leaderboard

Popular Content

Showing content with the highest reputation on 05/19/2020 in all areas

  1. First and foremost, if you want to become proficient with working with DLL APIs in AutoIt, then there are several things that you need to have a good understanding of. Among those things are how data is stored in memory, the base16 (Hex) numbering system, and the base2 (binary) numbering system. Without a good understanding of at least those 3 things, trying to figure out the rest will be extremely difficult. Since you have some sort of affinity for wanting to work with WIM, I will stick with WIM examples. The flags field of the WIM_INFO structure is stored as a 32-bit unsigned integer. That means that it is 4 bytes, 8 hex characters, or 32 bits (1's or 0's). All of those represent the same storage area. The difference is how it is logically represented. At the lowest levels, everything in memory is binary, either a 1 or a 0. So back to the flags fields. It is made up of 32 binary bits that can either be a 1 or a 0, either it is on or off, true or false. Currently, only 10, single-bit flags, of the 32 bits are being used for wim_info flags. The other 22 are reserved (not in use yet). It is called the flags field because in those 4 bytes of memory it can hold up to 32 different flags that can either be set (1) or unset(0), basically 32 toggle switches. You can think of it in memory like this (assuming all bits are unset: 0000 0000 0000 0000 0000 0000 0000 0000 (base2) Each flag bit, when set, represents a specific value. Assuming the we are looking at a big-endian value, the bit values going from right to left are: 1, 2, 4, 8, 16, 32, 64, 128,...2147483648. So if I want to represent the first 4 flags as being set, it would look like: 0000 0000 0000 0000 0000 0000 0000 1111 (base2/binary) or 0x0000000F (base16/hex) or 15 (base10/decimal) With all of that said, below is a starter WIM UDF (wimlib.au3) that I have written and an example file to show the Wim_Open API that I showed you earlier, a new _wimlib_get_wim_info API function, a new function called _wimlib_wiminfo_is_flag_set that lets you see if a given flag is set (true) or unset (false), and a function _wimlib_wiminfo_get_flag_name to lookup the flags name by its bit position. Pay special attention to the flag enums and constants that I created in the UDF file. And then related it back to what I said above about the the flags' bit values and bit positions. In the example file, I added examples of how to get the wim_info information using the API, how the flags field can be retrieved from the WIM_INFO structure, how flags can be set and how flag states can be interrogated. Hopefully, by figuring out how the structs, functions, enums, and constants work, and by playing around with the examples, it will become clearer in time. I hope this helped P.S. You may want to get familiar with AutoIt's bitwise functions (BitAND, BitOR, BitXOR, etc.) if you plan to play with bits.
    3 points
  2. You could add the properties SenderName or SenderEmailAddress to be returned by _OL_ItemFind (right now you just get the EntryID) and then check for the correct Name or Address before moving the item.
    2 points
  3. Attached my old UDF for this (but works even on new versions). Don't remember why i didn't posted it here before. GUICtrlSetResizingEx_1.3.zip
    2 points
  4. Yes, we have those here and there (including my Container UDF), but i didn't find one that able to pass arrays or other types to be reliable enough. Differences from other analogs: Stability (reliability) Array support (2D ATM) Ability to get the return data from the interaction process Easy both ways interaction Notes: Examples (run both)... Downloads: AppInteract_v0.5.zip AppInteract_v0.4.zip AppInteract_v0.3.zip AppInteract_v0.2.zip AppInteract_v0.1.zip
    1 point
  5. ... and it's 100% unsafe to use one of the various attempts to "add" multithreading by using an UDF. Also threads are evil! http://www.eecs.berkeley.edu/Pubs/TechRpts/2006/EECS-2006-1.pdf (this a direct download link to a seminal PDF about threads)
    1 point
  6. jchd

    @FuncName ?

    Posted to the MVP forum.
    1 point
  7. This is embarissing... thanks for the hint. Will test tomorrow.
    1 point
  8. You've doubled up all the leading opening brackets braces. Also, if you know where the shortcut is, why don't you just ShellExecute it?
    1 point
  9. I updated the files attached to the previous post. I added a new API (_wimlib_get_wim_info), a new function to check the state of a given WIM_INFO bit flag (_wimlib_wiminfo_is_flag_set), and a function that will let you lookup the bit flag's name by it's bit position (_wimlib_wiminfo_get_flag_name). I also added examples of the new stuff in the example file. The starter UDF file and the example file should get you back on track and motivated to continue learning more about structs, pointers, and dllcalls.
    1 point
  10. Hello there! I've been looking at leveraging the WinMagnifier.au3 include to make a legacy app with a hard-coded screensize fit in quasi-fullscreen. While it works for the most part using a keyboard/mouse, the application doesn't seem to play nice in Win10 using a touchscreen. Microsoft introduced the MagGetInputTransform as part of the Redstone update; as such, when you touch a display at what would phyiscally be, say, (200,200), it will transcribe your touch to what (200,200) is displayed as un-magnified. Without making this DLL call to adjust the resolution, the touch aspect is entirely off, no matter how you position the magnification/display. I think the main challenge I'm having is that I can't figure out the LPRECT part of DllCall. I'm at least able to get values to use if I call them as a pointer. ;~ The assumption here is that the 4:3 app is in the top-left corner of the screen ;~ As such, we know where the script will be magnifying, as well as the size of the normal display... $pRectSource = DllStructCreate("int rect[4]") DllStructSetData($pRectSource,1,0, 1) DllStructSetData($pRectSource,1,0, 2) DllStructSetData($pRectSource,1,$HorizontalResizeArea, 3) DllStructSetData($pRectSource,1,$VerticalResizeArea, 4) $pRectSourcePtrRECT = DllStructGetPtr($pRectSource) $pRectDest = DllStructCreate("int rect[4]") DllStructSetData($pRectDest,1,0, 1) DllStructSetData($pRectDest,1,0, 2) DllStructSetData($pRectDest,1,@DesktopWidth, 3) DllStructSetData($pRectDest,1,@DesktopHeight, 4) $pRectDestPtrRECT = DllStructGetPtr($pRectDest) ;~ These will return different values MsgBox(0,"Test",$pRectSourcePtrRECT) MsgBox(0,"Test",$pRectDestPtrRECT) ;~ ... ;~ Here's where I'm trying to make the DllCall, leading to the script exiting unexpectedly Local $pfEnabled = True $MagSet = DllCall($g_hMagnificationDLL, "BOOL", "MagGetInputTransform", "BOOL", $pfEnabled, "ptr", $pRectSourcePtrRECT, "ptr", $pRectDestPtrRECT) I'm not having any luck using references to "RECT" (with/without asterisks, capitalization, or other major variations thereof), but referencing the LPRECT value as a pointer at least gives me a value in my MsgBox, so I'm assuming that is the correct approach. Any idea what I'm doing wrong (aside from running a legacy app in 2020)? Thanks in advance!
    1 point
  11. MrCreatoR

    @FuncName ?

    11 years ago was proposed, and... rejected.
    1 point
  12. ; ; In C: ; struct { ; uint32_t a : 1 ; uint32_t b : 1 ; uint32_t c : 2 ; uint32_t d : 4 ; uint32_t e : 24 ; } t; ; ; Warning: C doesn't specify the bit order which is implementation-dependant ; ; here assume the following layout: ; eeeeeeee eeeeeeee eeeeeeee ddddccba ; Local $t = DllStructCreate("dword") DllStructSetData($t, 1, 0x0123045D) Local $a = BitAND(DllStructGetData($t, 1), 0x01) Local $b = BitAND(BitShift(DllStructGetData($t, 1), 1), 0x01) Local $c = BitAND(BitShift(DllStructGetData($t, 1), 2), 0x03) Local $d = BitAND(BitShift(DllStructGetData($t, 1), 4), 0x0F) Local $e = BitAND(BitShift(DllStructGetData($t, 1), 8), 0x00FFFFFF) ConsoleWrite(Hex($a) & @TAB & Hex($b) & @TAB & Hex($c) & @TAB & Hex($d) & @TAB & Hex($e) & @LF)
    1 point
  13. _OL_FolderAccess returns an array. Element 1 holds the folder object. ; #RequireAdmin #include <File.au3> #include <Array.au3> #include <OutlookEX.au3> Global $oOutlook = _OL_Open() If @error Then MsgBox(0, "", "_OL_Open: " & @error & "/" & @extended) $aFolder = _OL_FolderAccess($oOutlook, "*") If @error Then MsgBox(0, "", "_OL_FolderAcces: " & @error & "/" & @extended) $item_find =_OL_ItemFind($oOutlook, $aFolder[1], $olMail,"[UnRead]=True", "", "", "EntryID", "", 1) If @error Then MsgBox(0, "", "_OL_ItemFind: " & @error & "/" & @extended) _ArrayDisplay($item_find, "unread emails") _OL_ItemMove($oOutlook, $item_find[1][0], Default, "*\unread Mails")
    1 point
  14. Give this a spin: example() Func example() Const $ALPHA_STRING = "aBc" Local $aChars = StringSplit($ALPHA_STRING, "") Local $iNbrOfChars = $aChars[0] Local $sString = "" For $i = 0 To (2 ^ $iNbrOfChars) - 1 ;Loop thru iterations (base2 000, 001, 010, ... 111) $sString = "" ; Initialize string For $j = 0 To $iNbrOfChars - 1 ; Loop thru chars If BitAND($i, 2 ^ $j) Then ; If bit $j of $i is 1 $sString &= StringUpper($aChars[$j+1]) ; Append uppercase char to string Else ; Else $sString &= StringLower($aChars[$j+1]) ; Append lowercase char to string EndIf ; EndIf Next ; End char loop ConsoleWrite($sString & @CRLF) ; Display string iteration Next ;End iteration loop EndFunc
    1 point
  15. IAHIM, Open your eyes: M23
    1 point
  16. Hi everyone, Some good news for you among all the gloom of these virus-ridden times: Nine, Subz and Danyfirex have accepted the invitation to become MVPs. Please join me in congratulating them on their new status in our community. Keep safe out there, M23
    1 point
  17. wuruoyu, Your problem was that you were overwriting the ControlIDs of the input and list with each GUI you created - so only the last created GUI worked. You need to store the details of each GUI in an array and then work out which GUI is active so that the filter function know which input and list to use. I have simplified your script a little to make the process clearer and added comments for each bit of code I added: ;#AutoIt3Wrapper_Res_HiDpi=y ;#AutoIt3Wrapper_Run_Tidy=y ;#NoTrayIcon #include <StaticConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <GuiButton.au3> #include <GuiTab.au3> #include <EditConstants.au3> #include <Misc.au3> Opt("GUIOnEventMode", 1) ; Declare array to hold data on each GUI Global $aGUI_ID[1][4] = [[0]] Global $prepareDataFlg, $prepareDataButton, $title, $Main, $filterInput, $aKeyWords, $nameList, $shlist $DPI = 94 GUIRegisterMsg($WM_COMMAND, '_WM_COMMAND') _main() Func _main() $Main = GUICreate("main", 500, 500) GUISetOnEvent($GUI_EVENT_CLOSE, "_exit") $prepareDataButton = GUICtrlCreateButton("Button", 10, 10, 80, 30) GUICtrlSetOnEvent(-1, "_prepareData") GUISetState(@SW_SHOW) While 1 Sleep(100) Select Case $prepareDataFlg = True _prepareDataAction() $prepareDataFlg = False EndSelect WEnd EndFunc ;==>_main Func _exit() Exit EndFunc ;==>_exit Func _prepareData() Switch @GUI_CtrlId Case $prepareDataButton $prepareDataFlg = True EndSwitch EndFunc ;==>_prepareData Func _prepareDataAction() Local $iRandom = Random(10, 10000) $title = $iRandom $listString = "OLIVIA|RUBY|EMILY|GRACE|JESSICA|CHLOE|SOPHIE|LILY|" $aKeyWords = StringSplit(StringTrimRight($listString, 1), "|", 2) _createPCMembershipGUI($title, $listString) EndFunc ;==>_prepareDataAction Func _createPCMembershipGUI($title, $list) ; Increase GUI count $aGUI_ID[0][0] += 1 $iIndex = $aGUI_ID[0][0] ; Increase array size ReDim $aGUI_ID[$iIndex + 1][4] ; Save details of each handle/ControlID related to the GUI $aGUI_ID[$iIndex][0] = GUICreate($title, 200, 200) GUISetOnEvent($GUI_EVENT_CLOSE, "On_Close_Secondary") $aGUI_ID[$iIndex][1] = GUICtrlCreateInput("", 10, 10, 100, 20, -1, $WS_EX_CLIENTEDGE) $aGUI_ID[$iIndex][2] = GUICtrlGetHandle($aGUI_ID[$iIndex][1]) $aGUI_ID[$iIndex][3] = GUICtrlCreateList("", 10, 40, 150, 150, $WS_VSCROLL) GUICtrlSetData(-1, $list) GUISetState() EndFunc ;==>_createPCMembershipGUI Func On_Close_Secondary() GUIDelete(@GUI_WinHandle) EndFunc ;==>On_Close_Secondary Func Keywords($iIndex) ; In this function we use the passed index to identify the GUI ; and so which elements of the array we need to use Local $sFilter = GUICtrlRead($aGUI_ID[$iIndex][1]) Local $shlist = '|' For $1 = 0 To UBound($aKeyWords) - 1 If $sFilter = '' Then $shlist &= $aKeyWords[$1] & '|' ContinueLoop Else If StringInStr($aKeyWords[$1], $sFilter) > 0 Then $shlist &= $aKeyWords[$1] & '|' EndIf Next GUICtrlSetData($aGUI_ID[$iIndex][3], $shlist) EndFunc ;==>Keywords Func _WM_COMMAND($hWnd, $iMsg, $wParam, $lParam) $hCtrl = $lParam $nNotifyCode = BitShift($wParam, 16) ; See which GUI holds the input For $iIndex = 1 To $aGUI_ID[0][0] If $aGUI_ID[$iIndex][2] = $hCtrl Then Switch $nNotifyCode Case $EN_CHANGE ; And pass the index number of the GUI to the filter function so it knows which GUI is active Keywords($iIndex) ExitLoop EndSwitch EndIf Next Return $GUI_RUNDEFMSG EndFunc ;==>_WM_COMMAND All clear now? Please ask if not. M23
    1 point
  18. Ok.. also modified the buffer init to adhere to the setting made for utf8.auto.check. I am intending to phase out the use of NewFileEncoding setting and have that logic now also use then utf8.auto.check setting. Jos
    1 point
×
×
  • Create New...