Sign in to follow this  
Followers 0
Mirek H2o

Source code of DllCall

5 posts in this topic

Hi people, :lmao:

Does somebode know the source code(C++, assembler or Pascal) of DllCall function ?

I need it in my application.

Thx ;)

Share this post


Link to post
Share on other sites



Actual Microsoft example

// File:  RUNTIME.C
// A simple program that uses LoadLibrary and 
// GetProcAddress to access myPuts from MYPUTS.DLL. 

#include <stdio.h> 
#include <windows.h> 

typedef VOID (*MYPROC)(LPTSTR); 

VOID main(VOID) 
{ 
    HINSTANCE hinstLib; 
    MYPROC ProcAdd; 
    BOOL fFreeResult, fRunTimeLinkSuccess = FALSE; 

    // Get a handle to the DLL module.

    hinstLib = LoadLibrary("myputs"); 

    // If the handle is valid, try to get the function address.

    if (hinstLib != NULL) 
    { 
        ProcAdd = (MYPROC) GetProcAddress(hinstLib, "myPuts"); 

        // If the function address is valid, call the function.

        if (fRunTimeLinkSuccess = (ProcAdd != NULL)) 
            (ProcAdd) ("message via DLL function\n"); 

        // Free the DLL module.

        fFreeResult = FreeLibrary(hinstLib); 
    } 

    // If unable to call the DLL function, use an alternative.

    if (! fRunTimeLinkSuccess) 
        printf("message via alternative method\n"); 
}

Share this post


Link to post
Share on other sites

I am very interested in this as I have been learning C++ for a couple of weeks now. Using the code above, how could you dynamically load a function from a dll, with or without parameters, like AutoIt does?

Share this post


Link to post
Share on other sites

A couple weeks? In 6 - 12 months, come back to Windows programming in general. Another 2-3 months after that take a look at DLLs. Crawling before you walk, walking before you run and all that.

Share this post


Link to post
Share on other sites

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
Sign in to follow this  
Followers 0