神奇好望角 The Magical Cape of Good Hope

          庸人不必自擾,智者何需千慮?
          posts - 26, comments - 50, trackbacks - 0, articles - 11
            BlogJava :: 首頁(yè) ::  :: 聯(lián)系 :: 聚合  :: 管理
          用 NetBeans 開(kāi)發(fā)一個(gè)簡(jiǎn)單的 Windows XP 程序 - 其一 Developing A simple Windows XP Application with NetBeans - Part 1
            首先創(chuàng)建一個(gè)名為 WinHello 的項(xiàng)目,在“源代碼”節(jié)點(diǎn)下新建 WinHello.c,代碼的內(nèi)容如下:     First create a project with the name WinHello, and then create a new WinHello.c under "Source Files" node with the following code:
          1. #include <windows.h>
          2. #include <commctrl.h>
          3. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
          4.             PSTR szCmdLine, int iCmdShow) {
          5.     INITCOMMONCONTROLSEX init;
          6.     init.dwSize = sizeof(init);
          7.     init.dwICC = ICC_STANDARD_CLASSES;
          8.     InitCommonControlsEx(&init);
          9.     MessageBox(NULL, TEXT("再來(lái)!"), TEXT("哈哈~"), 0);
          10.     return 0;
          11. }
            注意末尾處最好再加上一個(gè)回車(chē)符,因?yàn)槲覀儗⒂?MinGW GCC 來(lái)編譯,遵循 UNIX 的規(guī)矩總是好的。行 6~9 指明用 Windows XP 風(fēng)格初始化程序,但這還不夠,我們還需要一個(gè)資源腳本和一個(gè)清單文件來(lái)顯示調(diào)用 Comctl32.dll 版本 6(默認(rèn)狀態(tài)下自動(dòng)調(diào)用版本 5,也就是 Windows 9x/2000 風(fēng)格)。在“資源文件”節(jié)點(diǎn)下新建資源腳本 resource.rc 和清單文件 WinHello.exe.manifestresource.rc 的內(nèi)容如下:     Attention it's best to add a CR in the end, because we'll compile it with MinGW GCC, so it's always good to follow the UNIX conventions. Line 6~9 indicates Windows XP style will be used to initialize the application, but that's not enough. We still need a resource script and a manifest file to explicitly invoke Comctl32.dll version 6 (version 5 is automatically invoked by default which is Windows 9x/2000 style). Create a new resource script resource.rc and a manifest file WinHello.exe.manifest. The content of resource.rc is as below:
          1. #include <windows.h>
          2. CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "Winhello.exe.manifest"
            WinHello.exe.manifest 的內(nèi)容如下:     The content of WinHello.exe.manifest is as below:
          1. <?xml version="1.0" encoding="UTF-8" standalone="yes"?>
          2. <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
          3. <assemblyIdentity
          4.     version="1.0.0.0"
          5.     processorArchitecture="X86"
          6.     name="zhyi.zhyi.Winhello"
          7.     type="win32"
          8. />
          9. <description>Description.</description>
          10. <dependency>
          11.     <dependentAssembly>
          12.         <assemblyIdentity
          13.             type="win32"
          14.             name="Microsoft.Windows.Common-Controls"
          15.             version="6.0.0.0"
          16.             processorArchitecture="X86"
          17.             publicKeyToken="6595b64144ccf1df"
          18.             language="*"
          19.         />
          20.     </dependentAssembly>
          21. </dependency>
          22. </assembly>

            到現(xiàn)在為止,所有的源文件都準(zhǔn)備好了,接下來(lái)是編譯。為避免一篇文章過(guò)長(zhǎng),且看下回分解。     By now all source files are ready, and next job is compiling. For avoiding a too long article, please read the next part.

          只有注冊(cè)用戶(hù)登錄后才能發(fā)表評(píng)論。


          網(wǎng)站導(dǎo)航:
           
          主站蜘蛛池模板: 大连市| 益阳市| 岳普湖县| 即墨市| 信宜市| 贡山| 义乌市| 吉木萨尔县| 江安县| 通辽市| 金乡县| 沙坪坝区| 姚安县| 工布江达县| 迭部县| 长宁县| 通许县| 台州市| 义乌市| 无极县| 江华| 蒲城县| 诸暨市| 繁峙县| 琼结县| 中江县| 昌黎县| 神农架林区| 获嘉县| 扶风县| 五大连池市| 湘阴县| 应用必备| 罗平县| 山阴县| 兴安县| 井陉县| 永善县| 井研县| 大方县| 汉寿县|