作者kadasaki (软硬兼湿)
看板C_and_CPP
标题Re: [问题] main的使用时机...
时间Thu Oct 8 15:21:59 2009
int main(void){
return 0;
}
void main(int argc,char ** argv){
}
-------------------------------------
The WinMain function is the conventional name for the user-provided entry
point for a Microsoft Windows-based application.
Header Declared in Winbase.h, include Windows.h
WinMain(hInstance, hPrevInstance, lpCmdLine, nCmdShow)
ex.
int WINAPI WinMain( HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR
lpCmdLine, int nCmdShow){
return 0;
}
//HINSTANCE hInstance, // handle to current instance
//HINSTANCE hPrevInstance, // handle to previous instance
//LPSTR lpCmdLine, // pointer to command line
//int nCmdShow // show state of window
mdsn:
http://msdn.microsoft.com/en-us/library/ms633559(VS.85).aspx
※ 引述《snoopy0907 (我是男的喔~^0^")》之铭言:
: 请问一下main跟WinMain的使用时机到底是什麽...
: 我在学习上都搞混了
: 同样都是include<windows.h>就可以呼叫API函式
WinMain需要include <windows.h>。
是因为你要用到WinMain或者其他函数才会include<windows.h>
: 有时会会用main...有时则用WinMain
main()的话,就不用include<windows.h>
例:
若需要用到cin、cout、endl ->需include <iostream.h> 打开iostream.h又会发现里面是
include <istream.h>
include <ostream.h>
...
...
----------------------------------
打开 windows.h,你会发现更多
: 是根据所想写的程式类型所定义吗?
: 例如写视窗有关的就一定要用WinMain
等语言功力提升,就可能做到。
: (不能用C/C++呼叫Win API函式写吗?)
不懂
: 那我用C/C++呼叫API写程式跟我写Windows程式(那本厚厚的砖块书里的程式)
不懂
: 有什麽不同呢?
: 这边观念有点模糊..谢谢
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 61.220.139.2
※ 编辑: kadasaki 来自: 61.220.139.2 (10/08 16:44)