Re: [問題] main的使用時機...
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)
討論串 (同標題文章)
完整討論串 (本文為第 2 之 2 篇):