PDA

Click to See Complete Forum and Search --> : calling APIs


Sam Finch
Oct 22nd, 2000, 11:49 AM
I'm trying to do a Simple Hello World app using C++ inline asm. something along these lines



#include <windows.h>

void main()
{

char* msg = "Hello World";
char* cap = "A Message";

// MessageBox(0,msg,cap,0); //This is what the asm should do

__asm
{
mov ebx, msg
mov ecx, cap

push 0
push ecx
push ebx
push 0

call MessageBoxA

}


}


I've tried all sorts of variations on this, but none of them seem to work.

I am getting a message box, but rather than saying "Hello World" it says "Unhandled excaption in Tests.exe: 0xC0000005: Access violation." I've stepped through the code and it raises it on the call MessageBoxA line, what am I doing wrong that causes the computer to make such a strange spelling mistake?

Oct 22nd, 2000, 01:24 PM
For the past week, everyday, nonstop, ive been trying to look for that question. Ive e-mailed microsoft, ive posted in BBS's, ive even asked the a-hole experts on IRC, but to no avail. No one that ive ever talked knows the answer to this question. Im now posting here cuz if there is an answer, i need it to.