Last active
October 16, 2023 16:07
-
-
Save trevorsaudi/6563be9c36ad135289d2e2872b67c59c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #include <windows.h> | |
| #include <iostream> | |
| int main() { | |
| // Load the user32.dll library | |
| HMODULE user32Dll = GetModuleHandle(L"user32.dll"); | |
| // Define a function pointer for MessageBoxW | |
| typedef int (WINAPI* MessageBoxWFunc)( | |
| HWND hwnd, | |
| LPCWSTR lpText, | |
| LPCWSTR lpCaption, | |
| UINT uType | |
| ); | |
| MessageBoxWFunc pMessageBoxW = (MessageBoxWFunc)GetProcAddress(user32Dll, "MessageBoxW"); | |
| // Ensure the texts are wide character strings using the 'L' notation | |
| LPCWSTR Text = L"Hello hackers!"; | |
| LPCWSTR Title = L"Title"; | |
| // Invoke the function | |
| int result = pMessageBoxW(nullptr, Text, Title, MB_OK); | |
| return 0; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment