Skip to content

Commit

Permalink
Better ExcHndl.DLL sample code.
Browse files Browse the repository at this point in the history
Slightly more compact version of @asmwarrior's sample code.

Fixes #87
  • Loading branch information
jrfonseca committed Dec 9, 2023
1 parent 22e8452 commit c2e1335
Showing 1 changed file with 19 additions and 3 deletions.
22 changes: 19 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -92,9 +92,25 @@ You can use ExcHndl by:

* or use `LoadLibrary`/`GetProcAddress` like

LoadLibrary("exchndl.dll");
pfnExcHndlInit = GetProcAddress("ExcHndlInit");
pfnExcHndlInit()
// Load the DLL
HMODULE hModule = LoadLibraryW(L"exchndl.dll");

if (hModule != NULL) {
// Get the function pointer
typedef void (*PFNEXCHNDLINIT)();
PFNEXCHNDLINIT pfnExcHndlInit = (PFNEXCHNDLINIT)GetProcAddress(hModule, "ExcHndlInit");

if (pfnExcHndlInit != NULL) {
pfnExcHndlInit();
} else {
// Handle the error if GetProcAddress fails
// Add your error handling code here
}

// Do not free the DLL module
} else {
// Handle the error if LoadLibrary fails
}

* you can also override the report location by invoking the exported `ExcHndlSetLogFileNameA`/`ExcHndlSetLogFileNameW` entry-point.

Expand Down

0 comments on commit c2e1335

Please sign in to comment.