Home » Community » Coffee corner » Load dll with U++
Re: Load dll with U++ [message #56704 is a reply to message #56703] |
Sun, 04 April 2021 06:20   |
BetoValle
Messages: 204 Registered: September 2020 Location: Brasil Valinhos SP
|
Experienced Member |
|
|
Hi Novo, Thanks
In example below with traditional way also works but ... why application freeze when set FreeLibrary ?
this will not cause a problem or in the end does the code generated in U ++ free from memory?
...
typedef void (*importFunction)(int, int, int, int, char *);
...
void AA::clickDll2(){
importFunction fscreen;
HINSTANCE hinstLib = LoadLibrary(AppendFileName("C:\\Temp\\outU++\\NOVOXXX\\CLANGx64.Debug.Debug_Full.Gui", "CaptureScreenDll.dll"));
if (hinstLib == NULL) {
PromptOK("ERRO: não foi possível carregar a DLL\n");
return;
}
fscreen = (importFunction)GetProcAddress(hinstLib, "capture_screen");
if (fscreen == NULL) {
PromptOK("ERRO: não foi possível achar a função na DLL\n");
//FreeLibrary(hinstLib); uncommenting will abort here
return;
}
char* f="teste2.png";
fscreen(0,0,500,600,f);
//FreeLibrary(hinstLib); uncommenting will abort here
}
|
|
|
Goto Forum:
Current Time: Tue Aug 12 17:16:51 CEST 2025
Total time taken to generate the page: 0.07646 seconds
|