Jump to content

Tutorial on DllCall() & DllStructs


Recommended Posts

I don't think this is true, however (Page 4):

This is the exact same function that is being called when you write Sleep(100) in AutoIt, it's just that AutoIt acts a layer between you and the function.
As you probably understand it's a generalization :D

Thank you, master monoceres, for my DLL-fu grows stronger! There must be great Chi in sitting around eating cereal in your underwear!

:D

Haha, don't forgot the nazi-hat, it's the most important part ;)

Inside Utility.cpp, the util_sleep() function loops "::sleep(0);" until another counter detects timeout. I assume the double colon "::" makes a library reference to the C++ sleep() function. Is that the same thing as calling the Kernel32.dll version of sleep()?

Not exactly, the '::' detones a static method in a class. The method will then probably make a call to Sleep().

Also, while you're already learning so much, Sleep() is not a C++ function, it's a function that's a part of the winapi which is 3d party library from microsoft that enables you to interact with the windows os.

Broken link? PM me and I'll send you the file!

Link to comment
Share on other sites

  • 8 months later...
  • 2 months later...

Hey guys

Is it possible to get this tutoriel in .doc, .rtf, .odf or something like that ?

I want to translate this amazing tutorial for the french community (http://autoitscript.fr), but if i could have the structure it would be easier.

Thx a lot,

Cheers,

Tim

Link to comment
Share on other sites

I've started AutoIt couple of months and I find it a great tool to work with, and this tutorial - along with the AutoIt documentation - are of great help for newbies like me. Thank you Monoceres!

Link to comment
Share on other sites

  • 1 month later...

Hey guys

Is it possible to get this tutoriel in .doc, .rtf, .odf or something like that ?

I want to translate this amazing tutorial for the french community (http://autoitscript.fr), but if i could have the structure it would be easier.

Thx a lot,

Cheers,

Tim

Not sure about Acrobat Reader, but in Acrobat Pro you can highlight -> copy -> and then -> paste the content into an MS Word document. Shouldn't take to long with just 10 pages. :mellow:

-Mike

Link to comment
Share on other sites

  • 2 weeks later...

Thx, i already tried your solution but i have OpenOffice and the file .doc converted isn't good. (Some letters are over others, etc...) However i started translation changing the layout.

I already said it, but Thx a lot for this tutorial.

Link to comment
Share on other sites

  • 2 months later...
  • 6 months later...

How do i convert the dll structs here to autoit, its in vb6 and am finding it difficult

Private Declare Function DeviceCapabilities Lib "winspool.drv" Alias "DeviceCapabilitiesW" ( ByVal lpDeviceName As Long, ByVal lpPort As Long, ByVal iIndex As Long, ByVal lpOutput As Long, ByVal lpDevMode As Long) As Long

Private Sub lstPrinters_Click()
    Dim P As Printer
    Dim lngPapers As Long
    Dim strPaperNames As String
    Dim lngPaper As Long
    Dim strPaperName As String
    Dim lngActualLength As Long

    Set P = Printers(lstPrinters.ListIndex)
    lngPapers = DeviceCapabilities(StrPtr(P.DeviceName),   StrPtr(P.Port), DC_PAPERNAMES, 0, 0)
    strPaperNames = String$(lngPapers * 64, 0)
    lngPapers = DeviceCapabilities(StrPtr(P.DeviceName), StrPtr(P.Port), DC_PAPERNAMES, StrPtr(strPaperNames),  0)
    lstPapers.Clear
    For lngPaper = 0 To lngPapers - 1
        strPaperName = Mid$(strPaperNames, 64 * lngPaper + 1, 64)
        lngActualLength = InStr(strPaperName, vbNullChar) - 1
        If lngActualLength > 1 Then strPaperName = Left$(strPaperName, lngActualLength)
        lstPapers.AddItem strPaperName
    Next
End Sub
Link to comment
Share on other sites

This tutorial is mostly aimed for people who have never used DllCall() before or have very limited knowledge about it. In the future I will update it with more advanced topics so more advanced users can make use of it too.

Nice tutorial! And description above is very me. This will help me a lot with my Thanks! :)

Best,
Euler

Link to comment
Share on other sites

  • 10 months later...

Ok I'm kinda stuck & hope somebody can help me with this here.

I'm following this tutorial but I can't get stuff to work.

I have a dll & it has like COM Properties or idk like "_class::propperty" but how do I call them?

using DLLCall (like I tried) or do I need the ObjGet function? Or both of them combined?

I haven't used dll's & com stuff before but now I need to and now this tutorial did help me understand DLLCall better.

Anybody can push me in the right direction? Do I need DLLCall or ObjGet or both? And how do I use those things from the dll (those that look like "_class::property") in AutoIt?

Edit: I also found a function called "DllGetClassObject" in the dll, can I use that to create an object and then use that to call the properties? If so how?

When I tried it myself it crashed with exit code -1073741819.

Edit: moved to a seperate topic:

Edited by 1RV34
MsgBox(0x40040, "", "Hello Forum!")
Link to comment
Share on other sites

  • 2 years later...

monoceres,

Thanks for this! needed it  :thumbsup:

'?do=embed' frameborder='0' data-embedContent>>

TheAutomator.

 

I was reading your thread earlier but I'm a big dll noob myself, and the minute I saw this thread I knew you had dug it up lol!

Anyways, just wanted to say thanks as well! Some juicy stuff in here :)

Edited by Prime03
Link to comment
Share on other sites

Please post a little more advanced topic..............thanks for this i shall really like you if you teach us a bit more........ keep it up

Life is like a coin. You can spend it Anyway as you wish and for your kind information. "you can spend it only once."

Link to comment
Share on other sites

Please post a little more advanced topic..............thanks for this i shall really like you if you teach us a bit more........ keep it up

 

Look into WinAPI/Ex UDF are Great Examples.

Saludos

Link to comment
Share on other sites

  • 1 year later...

Wow, Short & Simple, I learn what DllStruct are in 10 mins :P, TD :thumbsup:

 

P.S I tried to learn the same thing in 2014 but It was freaking hard then, lol

EasyCodeIt - A cross-platform AutoIt implementation - Fund the development! (GitHub will double your donations for a limited time)

DcodingTheWeb Forum - Follow for updates and Join for discussion

Link to comment
Share on other sites

  • 3 weeks later...

@monoceres Thanks for this tutorial. Really helpful for those who don't know a lot about dlls. 

Spoiler

My Contributions

Glance GUI Library - A gui library based on Windows api functions. Written in Nim programming language.

UDF Link Viewer   --- A tool to visit the links of some most important UDFs 

 Includer_2  ----- A tool to type the #include statement automatically 

 Digits To Date  ----- date from 3 integer values

PrintList ----- prints arrays into console for testing.

 Alert  ------ An alternative for MsgBox 

 MousePosition ------- A simple tooltip display of mouse position

GRM Helper -------- A littile tool to help writing code with GUIRegisterMsg function

Access_UDF  -------- An UDF for working with access database files. (.*accdb only)

 

Link to comment
Share on other sites

  • 1 year later...

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...