Search the Community
Showing results for tags 'beginner'.
-
Hello Autoit, I'm very new to DllCall function, in fact never used it, but I'm just curious about it. I found @toasterking's awesome beginner friendly dll GUI: I searched for some easier functions (less input / less output parameters), and I found GetFileSize function (I didn't modify his code, just using the GUI): https://learn.microsoft.com/en-gb/windows/win32/api/fileapi/nf-fileapi-getfilesize So, this is what I did: The function itself is executing like this, but the output is 0 and -1 DllCall("kernel32.dll","int","GetFileSize","HANDLE","D:\DllCall GetFileSize Example.au3","DWORD*","$hello") Then, I tried to execute my script (very simple) and put it into D drive: ;DllCall("kernel32.dll", "int", "GetFileSize", "HANDLE", "D:\DllCall GetFileSize Example.au3") $aDllCallReturn = DllCall("kernel32.dll","int","GetFileSize","HANDLE","D:\DllCall GetFileSize Example.au3","DWORD*","$hello") For $i = 0 To UBound($aDllCallReturn) - 1 ConsoleWrite($i & ": " & $aDllCallReturn[$i] & @CRLF) ;MsgBox(0, $i, $aDllCallReturn[$i]) Next ;ConsoleWrite($hello & @CRLF) The result is as the following (same as the screenshot): 0: -1 1: 0x00000000 2: 0 This file size is 403 bytes in my computer, it's very small, I expected to see 403 somewhere, but I don't know where I made it wrong. So, now I have some questions: 1. Do I really need to use lpFileSizeHigh or can I use "hello"? 2. Do I always have to put $ in the beginning of the parameter? I tried without $ in his GUI, I got an error. So, I think $ is a must. 3. But if I write as $hello (expecting this will store the file size), when I ConsoleWrite it, Autoit becomes angry because "undeclared global variable". 4. If somehow $hello will be the output to my file size, why do I need to return an array $aDllCallReturn which contains 3 elements? So, I have one $hello + 3 items from the array = I have 4 outputs total. But Microsoft says this function has only one return "[out, optional] LPDWORD lpFileSizeHigh ". I'm confused. Please note that; the goal for me is to use the DllCall function, not to get the file size by using FileGetSize() or some other existing functions.
- 10 replies
-
- getfilesize
- dllcall
-
(and 1 more)
Tagged with:
-
AutoIt is very useful and easy to use even for non-programmers (like me). Most of the examples in the Example section of the forum are somewhat advanced and not suitable for non-programmers who want to learn how to do simple things with AutoIt. I've attached a few simple scripts with lots of comments to help beginners. For more help on any function, press F1 when your curser is on the desired function name. Example01_MouseSwitchButtons.au3 Example02_HelloWorld.au3 Example03_CopyPasteNotepadToWord.au3 Example04_CopyPasteNotepadToWord_2.au3 Example05_OpenLinkInIE.au3 Additional simple AutoIt examples can be downloaded from here: '?do=embed' frameborder='0' data-embedContent>> P.S. Can somebody pin this topic?