Results 1 to 2 of 2

Thread: calling APIs

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Mar 2000
    Posts
    1,089
    I'm trying to do a Simple Hello World app using C++ inline asm. something along these lines


    Code:
    #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?

  2. #2
    Guest
    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width