Utilizzare funzioni contenute in una DLL in C++

From RVM Wiki
Revision as of 17:03, 25 October 2009 by Gabriele.vivinetto (talk | contribs) (New page: Esempio: <pre> #include <windows.h> #include <stdio.h> int main () { Typedef the hello function: typedef void (*pfunc)(); Windows handle: HANDLE hdll; /*A pointer to a ...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

Esempio:

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

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


Riferimenti