OK so I got my executable file that should load all the functions from
"message.dll" so I can use them.

But every time I run my executable file I am getting an error that say my executable is encountered problems and its should be closed than its being closed.

Here is my executable source

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

int main () {
	
	/*Typedef the hello function*/
	typedef void (*pfunc)();  
	
	/*Windows handle*/
	HINSTANCE HandleDLL;
	
	/*A pointer to a function*/
	pfunc hello;
	
	/*LoadLibrary*/
	HandleDLL = LoadLibrary("message.dll");
	
	/*GetProcAddress*/
	hello = (pfunc)GetProcAddress(HandleDLL,"hello");
	
	/*Call the function*/
	hello();
	return 0;
}

And this is what the hello function suppose to do
source from the dll

__declspec(dllexport) void hello()
												   
{ 
     MessageBox (0, "Hello from injected DLL!\n", "Hi", MB_ICONINFORMATION);
}

Any ideas why my exe crashes when I run it?

Listen guys i just discovered that the problem comes when I try to use the hello function from the dll.


any ideas?? please?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.