Time of Update: 2018-12-07
網上找的源碼,建立一個word文檔,並插入文本和表格,代碼如下:void CWordtestDlg::OnNewDoc() { COleVariant vTrue((short)TRUE); COleVariant vFalse((short)FALSE); COleVariant vOpt((long)DISP_E_PARAMNOTFOUND, VT_ERROR); /////////////////////////////////////////////////
Time of Update: 2018-12-07
VC—>add files to folder失效,鬱悶了很久,最後網上一搜,都說的office2007惹的禍。抱著試一試的心理,卸載了剛剛裝上沒多久,才用習慣的office2007,重啟後發現又好使了! 其實office2007還是很好用的,可惜了啊! 卸了之後再到網上查,發現還有解決衝突的辦法: 不知從什麼時候開始,VC6.0不聽話了,open-file彈出msdev.exe應用程式錯誤,“0×73d311c7”指令引用的“0×
Time of Update: 2018-12-07
這是自己寫的計算浙江移動手機話費的js代碼,採用jquery架構。 首先,要得到包含話費資訊的網頁,如99.htm: 為了在99.htm中載入自己寫的js檔案,需要在99.htm的網頁原始碼中添加以下代碼:<script type="text/javascript" src="../js/jquery/jquery.js"></script> <script type="text/javascript" src="../js/ChinaMobile.js">&
Time of Update: 2018-12-07
對於一個編輯框,實現它的全選和取消全選(前提:該編輯框獲得焦點)建立一個dialog based MFC application, 命名為“d1”,介面如下:為對話方塊類添加一個成員變數:bool m_bSelectAll;用於控制全選狀態。另外重載對話方塊類的PreTranslateMessage事件,添加如下代碼:BOOL CD1Dlg::PreTranslateMessage(MSG* pMsg) {if((GetAsyncKeyState(VK_CONTROL) & 0x8000
Time of Update: 2018-12-07
From: http://www.cnblogs.com/yjm0105/archive/2009/07/16/180620.html1.使用CTime類 CString str; //擷取系統時間 CTime tm; tm=CTime::GetCurrentTime(); str=tm.Format("現在時間是%Y年%m月%d日 %X"); MessageBox(str,NULL,MB_OK);2: 得到系統時間日期(使用GetLocalTime)SYSTEMTIME
Time of Update: 2018-12-07
本文示範了讀取CListCtrl的方法:介面:讀取資料按鈕的點擊事件代碼為:void CCheckListCtrlDemoDlg::OnButtonRead() {UpdateData();CCheckListCtrl *pListCtrl = (CCheckListCtrl*)GetDlgItem(IDC_LIST1);if(m_nRowIndex >= 1 && m_nRowIndex <= (UINT)pListCtrl->GetItemCount()){
Time of Update: 2018-12-07
vc檔案讀寫,用fstream和CStdioFile。第一種,用fstream:#include <afx.h>#include <iostream>#include <fstream>using namespace std;// 如srcFile=D:\1.sql,則得到的destFile=D:\1_Result.sqlvoid GetResultFileName(char * destFile, char * srcFile){char *p;p =
Time of Update: 2018-12-07
try{CString str("",10000);//這是做為存放開啟檔案名稱和路徑的字串空間10000這個值的設定就覺得有些不妥當CFileDialog openfile(true,NULL,NULL,OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_ALLOWMULTISELECT,"All
Time of Update: 2018-12-07
From: http://www.cnblogs.com/seacode/archive/2010/06/17/1759616.html 要想修改CButton類按鈕背景顏色和文字顏色,必須利用自繪方法對按鈕進行重新繪製。這可以通過定義一個以CButton為基類的新按鈕類來實現。以下為具體的實現方法:方法一:加入一個新類,類名:CButtonEx,基類:CButton。在標頭檔 CButtonEx.h 中加入以下變數和函數定義:private: int m_Style;
Time of Update: 2018-12-07
From: http://hi.baidu.com/machh03/blog/item/f320a533fd1672fe1a4cfffe.html/cmtid/f3235f24ff89713a8644f950 最近做了個播放器,用到這方面的知識挺多, 總結一下: 1,添加菜單有多種方法(1:在resource View中選中對話方塊屬性的 menu 屬性(2:CMenu m_Menu; m_Menu.LoadMenu(IDR_MAIN_MENU);
Time of Update: 2018-12-07
From: http://www.cnblogs.com/chenhs/archive/2008/08/19/1270763.htmlCTime類format的使用 使用CTime類可以很方便地取得當前系統時間並轉換為各種格式 The format argument consists of one or more codes; as in printf, the formatting codes are preceded by a percent
Time of Update: 2018-12-07
先來看一段簡單的C++代碼:#include <iostream>using namespace std;int T(int & a = 5){a = 3;return 0;}void main(){int a = 0;T(a);cout<<a<<endl;}經過編譯,發現根本通不過。這是為什麼呢?我們都知道,“&”既可以作取地址符,又可以作引用符,但是程式中使用了“int T(int & a =
Time of Update: 2018-12-07
在編譯VC++6.0是,出現fatal error C1010: unexpected end of file while looking for precompiled header directive 的錯誤.解決方案:1、如果發生錯誤的檔案是由其他的C代碼檔案添加進入當前工程而引起的,則Alt+F7進入當前工程的 Settings,選擇C/C++選項卡,從Category組合框中選中Precompiled Headers,選擇Not Using Precompiled
Time of Update: 2018-12-07
命令列也可以玩IPSec封鎖連接埠IPSec 首先需要指出的是,IPSec和TCP/IP篩選是不同的東西,大家不要混淆了。TCP/IP篩選的功能十分有限,遠不如IPSec靈活和強大。下面就說說如何在命令列下控制IPSec。 XP系統用ipseccmd。 2000下用ipsecpol。 WIN2003下直接就是IPSEC命令。遺憾的是,它們都不是系統內建的。ipseccmd在xp系統安裝盤的SUPPORT\TOOLS\ SUPPORT.CAB中,ipsecpol在2000
Time of Update: 2018-12-07
From: http://blog.csdn.net/zhoubl668/archive/2009/04/30/4139933.aspx OLE是建立在COM之上的技術,層次比COM要高。AfxOleInit()調用的是OleInitialize(),而OleInitialize()除了調用CoInitializeEx()來初始化COM庫外,還進行一些其它的操作,這些操作對OLE應用來說是必須的,這些OLE應用程式套件括: (1)Clipboard; (2)Drag
Time of Update: 2018-12-07
如何捕獲Ctrl、Ctrl+Alt和Ctrl+Alt+Shift按鍵組合 BOOL CTestView::PreTranslateMessage(MSG* pMsg) { if(pMsg->message==WM_KEYDOWN) { BOOL bCtrl=::GetKeyState(VK_CONTROL)&0x8000; BOOL bShift=::GetKeyState(VK_SHIFT)&0x8000; BOOL bAlt=::GetKeyState(
Time of Update: 2018-12-07
BOOL PathFileExists(LPCTSTR pszPath); Determines if a file exists. ---經檢測,該函數可以檢測檔案或目錄是否存在!RemarksThis function tests the validity of the file and path. It works only on the local file system or on a remote drive that has been mounted to a
Time of Update: 2018-12-07
方法一:1.新增成員變數CStatusBarCtrl m_StatusBar;2.在OnInitDialog()中加入: m_StatusBar.Create(WS_CHILD|WS_VISIBLE|SBT_OWNERDRAW, CRect(0,0,0,0), this, 0); int strPartDim[3]= {100, 200, -1}; //分割數量
Time of Update: 2018-12-07
_access, _waccessDetermine file-access permission.int _access( const char *path, int mode );int _waccess( const wchar_t *path, int mode );RoutineRequired HeaderOptional HeadersCompatibility_access<io.h><errno.h>Win 95, Win
Time of Update: 2018-12-07
From: http://school.cnd8.com/vc/jiaocheng/33274.htm參考上面網址中的文章,寫了下面的例子,環境:windows XP SP3 + VC6#include <cstdlib >#include <stdlib.h >#include <boost/regex.hpp>#include <string>#include <iostream>using namespace