Finding the Directory of your DLL

On viernes, 24 de septiembre de 2010 0 comentarios

OK this is gonna be a simple one.

Firstly we need to make a function. I called mine GetModulePath.

        
hInst is the Handler for your Dll
pszBuffer is the variable that you want to set as the File Directory.
dwSize is the size of pszBuffer

Now we will add the line that actuall gets the filepath.

        

Most paths in C++ require that there be 2 \'s. Although the next 4 lines are optional, it is recommended that you do them.

        

Now what that does is converts / ---> //...

Now we return and close the function

        

Now to call the function...

I call the function in DllMain because it already has the handle attached.

NOTE: Make sure you only do this once....


CREDITS:

Uknown Origional auther
Thanks to Azo for code...

0 comentarios:

Publicar un comentario