Create Your Own MessageBox

Posts 1–3 of 3 · Page 1 of 1
Create Your Own MessageBox
In this tutorial I will teach you how to create your own messagebox.

The first thing you do is call the MessageBoxA function with the shit it needs.

int WINAPI MessageBox(
__in_opt HWND hWnd,
__in_opt LPCTSTR lpText,
__in_opt LPCTSTR lpCaption,
__in UINT uType
);

MessageBox(NULL, "My own messagebox!", "Caption!", 0);

You have now learned how to create your own message box.

I recommend calling MessageBoxW and using your own unicode strings to save time because MessageBoxA is just a wrapper for MessageBoxW on newer systems. Heres something to convert crap to unicode if you ever need it. Just use the L macro so that the compiler converts your crap to unicode for you and you can save some resources and such.

So yeah, I wrote this a while ago and I really didn't feel like translating it to C because i'm tired right now...

Code:
        	UnicodeStrCombine: ;ptr dest, ptr src
	mov edi, edi
	push ebp
	mov ebp, esp
	mov eax, dword ptr ss:[ebp + 8h]
	cmp word ptr ds:[eax], 0
	mov edx, eax
	je _UnicodeStrCombine2
_UnicodeStrCombine1:
	inc edx
	inc edx
	cmp word ptr ds:[edx], 0
	jnz _UnicodeStrCombine1	
_UnicodeStrCombine2:
	push esi
	mov esi, dword ptr ss:[ebp + 0ch]
_UnicodeStrCombine3:
	movzx ecx, word ptr ds:[esi]
	mov word ptr ds:[edx], cx
	inc edx
	inc edx
	inc esi
	inc esi
	test cx, cx
	jnz _UnicodeStrCombine3
	pop esi
	pop ebp
	retn
Good job. Soon you will be making really cool things i am sure.
Good Job .
Posts 1–3 of 3 · Page 1 of 1

Post a Reply

Similar Threads

Tags for this Thread

None

Talk with us