im trying to put a varible into a parameter with a char * varible as well.

Code:
int i(5);
MessageBox(ghwnd_Main,(LPCSTR)sprintf("Hey this is my number %a",(LPCSTR)i),"",MB_OK);
it compiles with these warnings

c:\C++\winControls\winControls.cpp(51): warning C4312: 'type cast' : conversion from 'int' to 'LPCSTR' of greater size
c:\C++\winControls\winControls.cpp(51): warning C4312: 'type cast' : conversion from 'int' to 'LPCSTR' of greater size
but at run time it gives me this.

Unhandled exception at 0x0041ffe6 in winControls.exe: 0xC0000005: Access violation reading location 0x00000005.
cheers