hello, im very newibe at c++ coding im requesting for simple messagebox pop up after i injected a dll, i just need it for test it my work is working,
im compiling with Dev-C c++,
thanks.
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:
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.
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.
WOW you went overboard. The guy is clearly a leecher, why bother with that, he just wants:
Code:
MessageBoxA(NULL, "OMG IM A SPOONFED LITTLE FUCK", "GG BRO", MB_OK);
Originally Posted by Jason
WOW you went overboard. The guy is clearly a leecher, why bother with that, he just wants:
Code:
MessageBoxA(NULL, "OMG IM A SPOONFED LITTLE FUCK", "GG BRO", MB_OK);
LOL. I didn't wrote this for him only. Maybe some guy opens a thread, and is not a leecher, and finds this information useful ?
Originally Posted by Hassan
LOL. I didn't wrote this for him only. Maybe some guy opens a thread, and is not a leecher, and finds this information useful ?
Another person that is having trouble making a messagebox for their hack is NOT going to be a leecher?
Originally Posted by Jason
Another person that is having trouble making a messagebox for their hack is NOT going to be a leecher?
.
thank you so much.
but its not working, its not
thats the code i did,
omgsh, still not working and now its shows me an error:
D:\antihack\dllmain.cpp In function `int main()':
D:\antihack\dllmain.cpp cannot convert `const WCHAR*' to `const CHAR*' for argument `2' to `int MessageBoxA(HWND__*, const CHAR*, const CHAR*, UINT)'
D:\antihack\Makefile.win [Build Error] [dllmain.o] Error 1
please some one can make the full code work? thanks.
Originally Posted by BlackShawarma
omgsh, still not working and now its shows me an error:
D:\antihack\dllmain.cpp In function `int main()':
D:\antihack\dllmain.cpp cannot convert `const WCHAR*' to `const CHAR*' for argument `2' to `int MessageBoxA(HWND__*, const CHAR*, const CHAR*, UINT)'
D:\antihack\Makefile.win [Build Error] [dllmain.o] Error 1
please some one can make the full code work? thanks.
Post your code of dllmain.cpp file here. I'll post it after modification.
Leechers going to leech. Learn to fucking code.
@[MPGH]Jason; what ever you say, i don't care, if you can't help so be quiet.
@[MPGH]Hassan; thanks for your support,
there is the code.
This code looks fine. It works perfectly on Visual Studio. I don't know if Dev C++'s compiler supports (LPCWSTR)L, so as Jason said, changing character set to Multi-Byte, might help. Don't know how to do it in Dev C++, but it must be in Project properties (In Visual Studio, it is in Project Properties -> Configuration Properties -> General. There you'll see Character Set property. Change it to "Use Multi-Byte Character Set". By default, it is "Use Unicode Character Set".)
Edit: Damn, I totally forgot about it. Unicode characters require the suffix L before the string or character. If using the suffix, character set doesn't need to change. Try this: