VC skill set (4)
He zhidan
1. Reading the program often needs to see where the value of this variable has changed.
CTRL + F searching is too troublesome
Add const to the variable
Error reported in the changed location
2. check whether a function is called by those functions.
Method:
1. In the debugging status, view-> debug window-> call stack
2. Select called by from the shortcut menu of Class View.
3. display the time on the far left of the status bar
Static uint indicators [] =
{
Id_separator, //
Id_separator,
Id_indicator_caps,
Id_indicator_num,
Id_indicator_scrl,
};
Int cmainframe: oncreate (maid)
{
... M_wndstatusbar.setpaneinfo (1, id_separtor, sbps_normal, 60 );
}
// Menu Response Function
Void cmainframe: ontest ()
{
Ctime T;
T = ctime: getcurrenttime ();
Cstring STR = T. Format ("% H-% m-% s ");
M_wndstatusbar.setpanetext (0, STR );
}
4. Simulate the mouse
: Setcursorpos (INT) ptmouse-> X, (INT) ptmouse-> Y );
: Mouse_event (mouseeventf_leftdown, 0, 0, 0 );
: Mouse_event (mouseeventf_leftup, 0, 0, 0 );
: Mouse_event (mouseeventf_leftdown, 0, 0, 0 );
: Mouse_event (mouseeventf_leftup, 0, 0, 0 );
5. What is word and DWORD?
Typedef unsigned short word
Typedef unsigned long DWORD
6. Mobile controls
Cwnd * pwnd = getdlgitem (idc_button1 );
Crect R;
Pwnd-> getwindowrect (& R );
R. Left + = 50;
R. Right + = 50;
Pwnd-> movewindow (R );
7. How to Make cedit in the dialog box respond to the Enter key and press enter?
Getdlgitem (idc_edit1)-> setwindowtext ("111/R/n22 ");
Right-click attribute
Choose sytle-> multiline
You 'd better select want return.
8. convert C language into assembly
VC ++ provides this feature.
Project-> Settings...
C/C ++ Tab
Category: Choose listing files
Listing file type:
Select "assembly with source code"
9. How to obtain the CPU time consumed by the process?
Bool getprocesstimes (handle hprocess, lpfiletime lpcreationtime, lpfiletime lpexittime, lpfiletime lpkerneltime, lpfiletime lpusertime );
10. How can I get the icon corresponding to the extension through the extension?
Shgetfileinfo (path, ATTR, & SFI, sizeof (shfileinfo), shgfi_usefileattributes | shgfi_icon | shgfi_typename );
How can I change the border of the dialog box by hour to make it change proportionally? Like what kind of wm_sizing message does the video playback software process?
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;
}