vc 學習筆記 之工程

來源:互聯網
上載者:User

記錄學習過程中的一些點滴:

 

在做工程的時候遇到,在遇到解決方案裡的菜單有用到項目裡的類來建立變數,對於不在同一目錄下的項目來說,這裡是用到的的把同類的放到一起,包含標頭檔(全域用到的)放在inc檔案夾裡,

1..lib檔案放到lib檔案夾裡(這裡的拷貝是設定vs2005,項目—》右鍵屬性-》配置屬性-》建置事件-》產生後事件-》命令列copy $(SolutionDir)$(ConfigurationName)\vss_carinfo.lib ..\lib\vss_carinfo.lib,這樣可以不用人工把產生好的lib拷到檔案夾,

2.注意c++常規----附加元件封裝含目錄設定為:..\inc,

3.連接器常規-----附加庫目錄設定為..\lib。

 對餘菜單的函數如下

 

 

void CMainFrame::OnMenuTest()
{//不用包含標頭檔,因為已經在stdafx.h裡載入了#include "IVSS_CarInfoLibrary.h" #pragma comment(lib,"vss_carinfo.lib")
//
 CtestDlg *dlg = new CtestDlg();
 dlg->DoModal();
 delete dlg;
}

註:以下stdafx.h的內容

// stdafx.h : 標準系統包含檔案的包含檔案,
// 或是經常使用但不常更改的
// 特定於項目的包含檔案

#pragma once

#ifndef _SECURE_ATL
#define _SECURE_ATL 1
#endif

#ifndef VC_EXTRALEAN
#define VC_EXTRALEAN  // 從 Windows 頭中排除極少使用的資料
#endif

// 如果您必須使用下列所指定的平台之前的平台,則修改下面的定義。
// 有關不同平台的相應值的最新資訊,請參考 MSDN。
#ifndef WINVER    // 允許使用特定於 Windows XP 或更高版本的功能。
#define WINVER 0x0501  // 將此值更改為相應的值,以適用於 Windows 的其他版本。
#endif

#ifndef _WIN32_WINNT  // 允許使用特定於 Windows XP 或更高版本的功能。
#define _WIN32_WINNT 0x0501 // 將此值更改為相應的值,以適用於 Windows 的其他版本。
#endif      

#ifndef _WIN32_WINDOWS  // 允許使用特定於 Windows 98 或更高版本的功能。
#define _WIN32_WINDOWS 0x0410 // 將它更改為適合 Windows Me 或更高版本的相應值。
#endif

#ifndef _WIN32_IE   // 允許使用特定於 IE 6.0 或更高版本的功能。
#define _WIN32_IE 0x0600 // 將此值更改為相應的值,以適用於 IE 的其他版本。值。
#endif

#define _ATL_CSTRING_EXPLICIT_CONSTRUCTORS // 某些 CString 建構函式將是顯式的

// 關閉 MFC 對某些常見但經常可放心忽略的警告訊息的隱藏
#define _AFX_ALL_WARNINGS

#include <afxwin.h>         // MFC 核心組件和標準組件
#include <afxext.h>         // MFC 擴充


#include <afxdisp.h>        // MFC 自動化類

 

#ifndef _AFX_NO_OLE_SUPPORT
#include <afxdtctl.h>  // MFC 對 Internet Explorer 4 公用控制項的支援
#endif
#ifndef _AFX_NO_AFXCMN_SUPPORT
#include <afxcmn.h>   // MFC 對 Windows 公用控制項的支援
#endif // _AFX_NO_AFXCMN_SUPPORT


#define __MYSQL_DEF__


#include "IVSS_Corelibrary.h"
#pragma comment(lib,"vss_core.lib")

#include "IVSS_MysqlLibrary.h"
#pragma comment(lib,"vss_mysql.lib")

#include "IVSS_GeoLibrary.h"
#pragma comment(lib,"vss_geo.lib")

#include "IVSS_WsLibrary.h"
#pragma comment(lib,"vss_ws.lib")

#include "IVSS_DmLibrary.h"
#pragma comment(lib,"vss_dm.lib")

#include "IVSS_MapLibrary.h"
#pragma comment(lib,"vss_map.lib")

#include "IVSS_GuiLibrary.h"
#pragma comment(lib, "vss_gui.lib")

#include "IVSS_CarInfoLibrary.h"
#pragma comment(lib,"vss_carinfo.lib")


#ifdef _UNICODE
#if defined _M_IX86
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='x86' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_IA64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='ia64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#elif defined _M_X64
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='amd64' publicKeyToken='6595b64144ccf1df' language='*'\"")
#else
#pragma comment(linker,"/manifestdependency:\"type='win32' name='Microsoft.Windows.Common-Controls' version='6.0.0.0' processorArchitecture='*' publicKeyToken='6595b64144ccf1df' language='*'\"")
#endif
#endif

 

 

 

 

 

 

所以在MainFrm.cpp裡不用

#include "CtestDlg.h

 

在編譯的時候,先產生個部分的,

最後編譯整個方案。

 

 

 

註:要使菜單不是灰色可點的,必須有與之相對應的函數,而且是在MainFram.cpp裡面。而且還要

BEGIN_MESSAGE_MAP(CMainFrame, CFrameWnd)
 ON_WM_CREATE()
 ON_COMMAND(ID_DB_CONNECT, &CMainFrame::OnDbConnect)
 ON_COMMAND(ID_MIF_IMPORT, &CMainFrame::OnMifImport)
 ON_COMMAND(ID_MAP_ZOOMIN, &CMainFrame::OnMapZoomin)
 ON_COMMAND(ID_MAP_ZOOMOUT, &CMainFrame::OnMapZoomout)
 ON_COMMAND(ID_MAP_SCROLL, &CMainFrame::OnMapScroll)
 ON_COMMAND(ID_MENU_GUI, &CMainFrame::OnMenuGui)
END_MESSAGE_MAP()   

                

待續.....

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.