1, 阅读程序常常要看此变量在那些地方值改变过
ctrl+f查找太麻烦
将此变量前加const
改变的地方报错
2, 看一个函数被那些函数调用.
方法:
1,调试状态下,view->debug window->call Stack
2,class view 的快捷菜单中选择called by
3, 在状态栏的最左边显示时间
static UINT indicators[] = { ID_SEPARATOR,//我们增加的 ID_SEPARATOR, ID_INDICATOR_CAPS, ID_INDICATOR_NUM, ID_INDICATOR_SCRL, }; int CMainFrame::OnCreate(LPCREATESTRUCT lpCreateStruct) { ..... m_wndStatusBar.SetPaneInfo(1,ID_SEPARTOR,SBPS_NORMAL,60); } //菜单的响应函数 void CMainFrame::OnTest() { CTime t; t = CTime::GetCurrentTime(); CString str = t.Format("%H - %M -%S"); m_wndStatusBar.SetPaneText(0,str); }
4,模拟鼠标
::SetCursorPos((int)ptMouse->x,(int)ptMouse->y); ::mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0); ::mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0); ::mouse_event(MOUSEEVENTF_LEFTDOWN,0,0,0,0); ::mouse_event(MOUSEEVENTF_LEFTUP,0,0,0,0);
5,什么是WORD, DWORD
typedef unsigned short WORD
typedef unsigned long DWORD
6,移动控件
CWnd * pWnd = GetDlgItem(IDC_BUTTON1); CRect r; pWnd->GetWindowRect(&r); r.left +=50; r.right += 50; pWnd->MoveWindow(r);
7, 如何让对话框中的CEdit响应ENTER键回车
GetDlgItem(IDC_EDIT1)->SetWindowText("111/r/n22");
右键属性
sytle -> Multiline选上
最好把want return 也选上
8,将c语言转化为汇编
VC++ provides this feature. Project->Settings... C/C++ tab Category: Choose Listing Files Listing file type: select "Assembly with source code"
9,如何获得进程所消耗的CPU时间?
BOOL GetProcessTimes( HANDLE hProcess, LPFILETIME lpCreationTime, LPFILETIME lpExitTime, LPFILETIME lpKernelTime, LPFILETIME lpUserTime );
10,如何通过扩展名得到该扩展名所对应的图标?
SHGetFileInfo(path, attr, &sfi, sizeof(SHFILEINFO), SHGFI_USEFILEATTRIBUTES | SHGFI_ICON | SHGFI_TYPENAME);
如何在拉着对话框的边框改变大小时,让它成比例的变化.就像视频播放软件哪样
处理wm_sizing消息
void CTest 1Dlg::OnSizing(UINT fwSide, LPRECT pRect) { CDialog::OnSizing(fwSide, pRect); if((fwSide==WMSZ_BOTTOM) || (fwSide==WMSZ_TOP)) pRect->right=pRect->left+(pRect->bottom-pRect->top)*2; else pRect->bottom=pRect->top+(pRect->right-pRect->left)*0.5; }