-
Notifications
You must be signed in to change notification settings - Fork 0
Usage Examples.md
Wolf edited this page Jul 2, 2023
·
3 revisions
In this section, we provide some basic usage examples to help you get started with WolfLtd. These examples are intended for testing purposes and may not cover all possible use cases.
#include "Memory.h"
#include <iostream>
int main()
{
// Start the Library Setup
if(!Function::Init_SetUp()){
return 1; // ERROR
}
// Load User32.dll with LoadLibraryA that was found when you called Init_Setup()
PVOID user32 = Function::call::loadLibraryA("user32.dll");
// Create a function pointer with the correct signature
typedef int(__stdcall* MessageBoxAFunc)(HWND, LPCSTR, LPCSTR, UINT);
// Cast the function address to the function pointer type
MessageBoxAFunc messageBoxFunc = reinterpret_cast<MessageBoxAFunc>(Function::pGetProcAddress(user32, "MessageBoxA"));
// Call the MessageBoxA function
int result = messageBoxFunc(NULL, "Hello, WolfLtd!", "Test", MB_OK);
// Output the result
std::cout << "MessageBoxA returned: " << result << std::endl;
return 0;
}