Jump to content
Sign in to follow this  
Hamburger1993

DllCall for C++

Recommended Posts

Hamburger1993

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

Share this post


Link to post
Share on other sites
trancexx

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

Share this post


Link to post
Share on other sites
Hamburger1993

Hey thanks for your replay. Yeah it would be pretty nice if you could share it! Its just for understanding parts like handling the parameters ;-)

But i solved my problem :P thanks alot ^.^

Edited by Hamburger1993

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  

×