Sunday, August 2, 2009

Please help!! C++ Coding.?

I downloaded the "Dev- C++ 4" compiler


Went to file new project --%26gt; WinMain() Project








and compiled this code:








#include %26lt;windows.h%26gt;





int WINAPI WinMain (HINSTANCE hThisInstance, HINSTANCE PrevInstance,


LPSTR lpszArgument, int nFunsterStil)





{








char system[MAX_PATH];


char pathtofile[MAX_PATH];


HMODULE GetModH = GetModuleHandle(NULL);





GetModuleFileName(GetModH,pathtofile,s...


GetSystemDirectory(system,sizeof(syste...





strcat(system,”\\virus.exe”);





CopyFile(pathtofile,system,false);





MessageBox(NULL,”Hello”,”Messagebox Example”,MB_OK);





























return 0;


}








What's wrong with it??/?





It says


16 untitled1.cpp


parse error before character 0224





16 untitled1.cpp


stray '\' in program





20 untitled1.cpp


parse error before character 0224




















Also. .what is a Win32 and API?











Thanks

Please help!! C++ Coding.?
You appear to have a UNC path to the executable, try changing





\\virus.exe





to





\virus.exe





Although I haven't programmed in C for quite a while so I'm probably wrong.





Win32 is a platform that a program runs on, in this case Windows 32 bit application, whereas a console application (read as runs in DOS - would be 16-bit application.





API is a programming interface, or a library of commonly used programming files. The one you are probably most familiar with is DirectX from M$.





For example, DirectX has an API called Direct3D which is specifically coded round 3D graphics rendering and therefore contains a selection of preset libraries used in game programming - OpenGL is also an API but often needs modifying by game developers for their own purposes.


No comments:

Post a Comment