
Originally Posted by
Hassan
First include this header file:
[highlight=c]#include <Windows.h>[/highlight]
Then you can call the MessageBox function to create a message box at runtime, like this:
[highlight=c]MessageBox(NULL,(LPCWSTR)L"Injected DLL successfully.",(LPCWSTR)L"Information",MB_OK);[/highlight]
A little explanation:
MessageBox function takes 4 parameters. The first one, which is NULL here, defines a handle to the owner window of the Message Box. By setting this parameter to NULL, this MessageBox has no owner window and is displayed independently.
The second parameter, which is (LPCWSTR)L"Injected DLL successfully." here, defines what will be the body of the MessageBox.
The third parameters, which is (LPCWSTR)L"Information" here, defines the title of the MessageBox dialog.
The last parameter, which is MB_OK here, defines the behavior of the MessageBox. MB_OK will display the MessageBox with only a single Button captioned "OK".
You can define more than 1 behaviors for the MessageBox.
For Example:
[highlight=c]
MB_OK
MB_OKCANCEL
MB_YESNO
MB_YESNOCANCEL
MB_ABORTRETRYIGNORE
MB_CANCELTRYCONTINUE
MB_HELP
MB_RETRYCANCEL
[/highlight]
You can also use them in parallel like this:
[highlight=c]MessageBox(NULL,(LPCWSTR)L"Injected DLL successfully.",(LPCWSTR)L"Information",MB_OKCANCEL | MB_YESNO);[/highlight]
You can also specify the icon of the MessageBox explicitly. Supported constants for setting Icons are:
[highlight=c]
MB_ICONEXCLAMATION
MB_ICONWARNING
MB_ICONINFORMATION
MB_ICONASTERISK
MB_ICONQUESTION
MB_ICONSTOP
MB_ICONERROR
MB_ICONHAND
[/highlight]
Here's how to use these constants:
[highlight=c]MessageBox(NULL,(LPCWSTR)L"DLL not injected successfully.",(LPCWSTR)L"Error Injecting DLL",MB_OK | MB_ICONEXCLAMATION);[/highlight]
If you don't understand something, feel free to ask. Hope this helps.