0. Alt+F8 自动对齐格式
1.
CString str;
str.Format("%d",m_width);
SetDlgItemText(IDC_XXX,str);
或 SetDlgItemText(AfxGetMainWnd()->m_hWnd,IDC_XXX,str);
2.
GetDlgItem(IDC_XXX)->EnableWindow(TRUE);
/
((CButton *)GetDlgItem(IDC_BUTTON_SHOW))->SetIcon(AfxGetApp()->LoadIcon(IDI_ICON1));
//
CBitmap bit;
CSketchDlg *pointerDlg;//主对话框指针
bit.LoadBitmap(IDB_BITMAP_FoundBody);
CStatic *btm = (CStatic*)pointerDlg->GetDlgItem(IDC_STATIC_AlarmSHOW);
btm->SetBitmap(bit);
//
CBitmap bit;
bit.LoadBitmap(IDB_BITMAP4);
CPCBCutterView* pView=(CPCBCutterView*)((CMainFrame*)AfxGetMainWnd())->GetActiveView();//单文档主界面指针
pView->m_cBmpzPos.SetBitmap(bit);
3.
#include <iostream>
#include <fstream>
using namespace std; --这三句写在stdAfx.h
CString saveFileName;
saveFileName = "output.txt";
fstream outfile;
outfile.open(saveFileName,ios::out);
outfile<<"V = "<<V<<endl;
outfile.close();
4.
#ifdef _DEBUG
#pragma comment(lib,"strmbasd.lib")
#else
#pragma comment(lib,"STRMBASE.lib")
#endif
#pragma comment(lib,"strmiids.lib")
5.Windows系统对话框默认的背景色的RGB值是多少?
RGB(212,208,200)
6.查看.rc文本文件的方法:
菜单-File-Open-*.rc-把底部的Open as选项改为Text
7.VC播放声音
#include "mmsystem.h"
#pragma comment(lib,"winmm.lib") //添加多媒体库文件
(1)PlaySound("c:\\music.wav",NULL, SND_ASYNC|SND_NODEFAULT);
(2)PlaySound(MAKEINTRESOURCE(IDR_WAVE1),AfxGetResourceHandle(), SND_ASYNC|SND_RESOURCE|SND_NODEFAULT|SND_LOOP);
8.一个对话框操作另一个对话框的控件
CTestDlg *dd = (CTestDlg*)GetParent();
//或:CTestDlg *dd = (CTestDlg*)AfxGetMainWnd();
dd->GetDlgItem(IDC_EDIT1)->EnableWindow(FALSE);
9.注册ocx控件的方法:开始-运行-输入"Regsvr32 e:\cncgridX.ocx"
10.
BOOL CScrewView::PreCreateWindow(CREATESTRUCT& cs)
{
// TODO: Modify the Window class or styles here by modifying
// 改变鼠标光标时不闪烁(创建自己的窗口类,窗口不设置光标,以便根据需要进行设置) //
if (cs.lpszClass == NULL)
{
cs.lpszClass = AfxRegisterWndClass(CS_DBLCLKS);
}
return CScrollView::PreCreateWindow(cs);
}
11.在VC6中,如何查看以下代码中vec里的内容?
在调试窗口中输入:vec._First[n]就能看了,之后改下标遍历.