Jump to content

DllCall for C++


 Share

Recommended Posts

Hey! Currently i'am trying to programm a funktion like DllCall for C++. Do you got any tricks how to handle the specification of the variables as string?

sample:

DllCall("Dllname", "ReturnType", "FunctionName", "float", $fHeight, "float", $fWidth)

 

Currently i have to programm for every funtion that i want to include something like this:

HRESULT URLDownloadToFileA(LPUNKNOWN pCaller,LPCSTR szURL,LPCSTR szFileName, DWORD dwReserved,LPBINDSTATUSCALLBACK lpfnCB)
{
   typedef HRESULT (P_OT)(LPUNKNOWN, LPCSTR, LPCSTR,DWORD,LPBINDSTATUSCALLBACK);
   P_OT* OT;
   HMODULE hLib;

   hLib = LoadLibraryA("Urlmon.dll");
   if(hLib)
   {
      OT = (P_OT*)GetProcAddress(hLib, "URLDownloadToFileA");
      if(OT)
         return OT(pCaller,szURL,szFileName, dwReserved,lpfnCB);
      else
         return NULL;
   }
   else
      return NULL;
}
Edited by Hamburger1993
Link to comment
Share on other sites

That's how you should do it (more or less). DllCall written for C++ and used from that language doesn't make sense.

I saw the other thread you made about the AutoIt source, presumably you are interested in AutoIt's Dllcall implementation. Well, the source that was available for download didn't include DllCall code so you aren't at lost.

AutoIt's DllCall is form of JIT compilation, if that rings any bells to you. You don't want it in your code.

I have written DllCall alike code for some other scripting language which unfortunately is also closed source (for time being) but if you badly need to do things wrong I can publish my code so that you can see general idea.

♡♡♡

.

eMyvnE

Link to comment
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
 Share

  • Recently Browsing   0 members

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