一些乱七八糟的东西

1、BOOL MoveWindow( HWND hWnd, int X, int Y, int nWidth, int nHeight, BOOL bRepaint );

hWnd指定了窗口的句柄;x指定了CWnd的左边的新位置;y指定了CWnd的顶部的新位置;nWidth指定了CWnd的新宽度;nHeight指定了CWnd的新高度。

2、BOOLEnableWindow(HWND hWnd,BOOL bEnable);

该函数允许/禁止指定的窗口或控件接受鼠标和键盘的输入,当输入被禁止时,窗口不响应鼠标和按键的输入,输入允许时,窗口接受所有的输入。

3、BOOL ShowWindow(HWND hWnd, int nCmdShow);

hWnd:指窗口句柄。
nCmdShow:指定窗口如何显示。如果发送应用程序的程序提供了STARTUPINFO结构,则应用程序第一次调用ShowWindow时该参数被忽略。否则,在第一次调用ShowWindow函数时,该值应为在函数WinMain中nCmdShow参数。在随后的调用中,该参数可以为下列值之一:
SW_FORCEMINIMIZE:在WindowNT5.0中最小化窗口,即使拥有窗口的线程被挂起也会最小化。在从其他线程最小化窗口时才使用这个参数。
SW_HIDE:隐藏窗口并激活其他窗口。
SW_MAXIMIZE:最大化指定的窗口。
SW_MINIMIZE:最小化指定的窗口并且激活在Z序中的下一个顶层窗口。
SW_RESTORE:激活并显示窗口。如果窗口最小化或最大化,则系统将窗口恢复到原来的尺寸和位置。在恢复最小化窗口时,应用程序应该指定这个标志。
SW_SHOW:在窗口原来的位置以原来的尺寸激活和显示窗口。
SW_SHOWDEFAULT:依据在STARTUPINFO结构中指定的SW_FLAG标志设定显示状态,STARTUPINFO 结构是由启动应用程序的程序传递给CreateProcess函数的。
SW_SHOWMAXIMIZED:激活窗口并将其最大化。
SW_SHOWMINIMIZED:激活窗口并将其最小化。
SW_SHOWMINNOACTIVE:窗口最小化,激活窗口仍然维持激活状态。
SW_SHOWNA:以窗口原来的状态显示窗口。激活窗口仍然维持激活状态。
SW_SHOWNOACTIVATE:以窗口最近一次的大小和状态显示窗口。激活窗口仍然维持激活状态。
SW_SHOWNORMAL:激活并显示一个窗口。如果窗口被最小化或最大化,系统将其恢复到原来的尺寸和大小。应用程序在第一次显示窗口的时候应该指定此标志。
Windows CE:nCmdShow参数不支持下列值:
SW_MAXIMINZE;SW_MINIMIZE;SW_RESTORE;SW_SHOWDEFAULT
SW_SHOWMAXIMIZED;SW_SHOWMINIMIZED;SW_SHOWMININOACTIVATE

4、GetDlgItem
返回窗口中指定参数ID的子元素的句柄,可以通过返回的句柄对窗口内的子元素进行操作。

1).CWindow::GetDlgItem

HWND GetDlgItem( intnID)const;

2).CWnd::GetDlgItem

CWnd* GetDlgItem ( intnID) const;
void CWnd::GetDlgItem( int nID, HWND *phWnd) const;

3).Windows SDK

HWND GetDlgItem(
HWNDhDlg, // handle to dialog box
intnIDDlgItem// control identifier
);
5、SetWindowPos
BOOL SetWindowPos(HWND hWnd, const CWnd* pWndInsertAfter, int x, int y,int cx, int cy, UINT nFlags);
hWndlnsertAfter:在z序中的位于被置位的窗口前的窗口句柄。该参数必须为一个窗口句柄,或下列值之一:HWND_BOTTOM;HWND_NOTOPMOST;HWND_TOP;HWND_TOPMOST(将窗口置于所有非顶层窗口之上,即使窗口未被激活窗口也将保持顶级位置。)
改变一个子窗口,弹出式窗口或顶层窗口的尺寸,位置和Z序。子窗口,弹出式窗口,及顶层窗口根据它们在屏幕上出现的顺序排序、顶层窗口设置的级别最高,并且被设置为Z序的第一个窗口。
SWP_FRAMECHANGED:给窗口发送WM_NCCALCSIZE消息,即使窗口尺寸没有改变也会发送该消息。如果未指定这个标志,只有在改变了窗口尺寸时才发送WM_NCCALCSIZE。
6、SetWindowLong
改变指定窗口的属性.函数也将指定的一个32位值设置在窗口的额外存储空间的指定偏移位置。
LONGSetWindowLong(
HWND hWnd,//handletowindow
int  nlndex,//offsetofvaluetoset
LONG dwNewLong//newvalue
);
7、CDialog::OnInitDialog
This method is called in response to the WM_INITDIALOG message.
virtual BOOL OnInitDialog();//相当于对对话框进行初始化处理
返回值:指定对话框是否对它的一个控件设置输入焦点。如果OnInitDialog返回非零值,Windows将输入焦点设在对话框的第一个控件上,只有在对话框明确将输入焦点设在某控件上,应用返回0。
例:
BOOL CSimpleDlg::OnInitDialog()
{
   CDialog::OnInitDialog();

   // TODO: Add extra initialization here
   m_cMyEdit.SetWindowText(_T("My Name")); // Initialize control values
   m_cMyList.ShowWindow(SW_HIDE);      // Show or hide a control, etc.

   return TRUE;  // return TRUE unless you set the focus to a control
   // EXCEPTION: OCX Property Pages should return FALSE
}
  
用VC向导生成的基于对话框的程序中,在对话框的 OnInitDialog()函数中,总可以看到如下的代码段:
BOOL CXXXDlg::OnInitDialog()
  {
  ......
  // Set the icon for this dialog. The framework does this automatically
  // when the application's main window is not a dialog
  SetIcon(m_hIcon, TRUE); // Set big icon
  SetIcon(m_hIcon, FALSE); // Set small icon
  ......
  }
两个SetIcon 向窗口(窗口句柄为m_hWnd)发送了WM_SETICON消息(This message is sent by an application to associate a new big or small icon with a window. )发送这个消息给窗口,是为了让这个窗口和大图标(large icon)或者小图标(small icon)关联。在用户按ALT+TAB键切换窗口时,显示的就是大图标,小图标就是对话框窗口标题栏上的那个图标。
8、BringWindowToTop
该函数将指定的窗口设置到Z序的顶部。如果窗口为顶层窗口,则该窗口被激活;如果窗口为子窗口,则相应的顶级父窗口被激活。
9、AfxGetApp
得到当前应用进程的指针,是CWinApp*类型的,通过这个指针可以访问到这个进程中的对象。
10、GetSystemMetrics
This function retrieves the dimensions — widths and heights — of Windows display elements and system configuration settings.
int GetSystemMetrics(int nIndex); 
SM_CXSCREEN, SM_CYSCREEN:Width and height, in pixels, of the screen of the primary display monitor.
11、RegOpenKeyEx()
打开一个指定的注册表键
LONG RegOpenKeyEx(
    HKEY hKey, // 需要打开的主键的名称
    LPCTSTR lpSubKey, //需要打开的子键的名称
    DWORD ulOptions, // 保留,设为0
    REGSAM samDesired, // 安全访问标记,也就是权限
    PHKEY phkResult // 得到的将要打开键的句柄
)
12、RegQueryValueEx()
检索一个已打开的注册表句柄中,指定的注册表键的类型和设置值。
LONG RegQueryValueEx(
    HKEY hKey,            // handle to key
    LPCTSTR lpValueName,  // value name
    LPDWORD lpReserved,   // reserved
    LPDWORD lpType,       // type buffer
    LPBYTE lpData,        // data buffer
    LPDWORD lpcbData      // size of data buffer
);
返回值
Long,零(ERROR_SUCCESS)表示成功。其他任何值都代表一个错误代码
参数 类型及说明
HKEY hKey,//一个已打开项的句柄,或者指定一个标准项名
LPCTSTR lpValueName,//要获取值的名字,注册表键的名字
LPDWORD lpReserved,//未用,设为零
LPDWORD lpType,//用于装载取回数据类型的一个变量
LPBYTE lpData,//用于装载指定值的一个缓冲区
LPDWORD lpcbData,//用于装载lpData缓冲区长度的一个变量。 //一旦返回,它会设为实际装载到缓冲区的字节数
13、RegCloseKey();

释放指定注册键的句柄
14、DoModal()
用来显示一个模态对话框
返回值:如果函数成功则返回IDOK或IDCANCEL;否则返回0或-1。
15、AfxMessageBox
int AfxMessageBox( LPCTSTR lpszText, UINT nType = MB_OK, UINT nIDHelp = 0 );
int AFXAPI AfxMessageBox( UINT nIDPrompt, UINT nType = MB_OK, UINT nIDHelp = (UINT) –1 );
16、CSpinButtonCtrl::SetAccel
    此成员函数用来设置一个旋转按钮控件的加速。如果成功则返回非零值;否则返回0。参数nAccel表示由pAccel指定的UDACCEL结构的数目.pAccel指向一个UDACCEL结构数组的指针,该数组包含了加速信息,其结构如下:
    typedef struct{
      UINT nSec;//位置改变前所等待的秒数。
      UINT nInc;//位置增量。

    }UDACCEL,FAR* LPUDACCEL;

17、RegisterWindowMessage

定义一个新的窗口消息,保证该消息在系统范围内是唯一的。通常调用SendMessage或者PostMessage函数时,可以使用该函数返回的消息值。
If two different applications register the same message string, the applications return the same message value. The message remains registered until the session ends. 
Return Values:A message identifier in the range 0xC000 through 0xFFFF indicates that the message is successfully registered. Zero indicates failure.

18、DestroyWindow
销毁指定的窗口。这个函数通过发送WM_DESTROY 消息和 WM_NCDESTROY 消息使窗口无效并移除其键盘焦点。这个函数还销毁窗口的菜单,清空线程的消息队列,销毁与窗口过程相关的定时器,解除窗口对剪贴板的拥有权,打断剪贴板器的查看链。
Windows CE: 本函数将不发送 WM_NCDESTROY 消息
19、CWnd::OnPaint
afx_msg void OnPaint( );
响应WM_PAINT消息,当Windows或应用程序请求重画应用程序窗口的一部分时,框架调用这个成员函数。WM_PAINT在调用UpdateWindowRedrawWindow成员函数时发出。当设置了RDW_INTERNALPAINT标志并调用RedrawWindow成员函数时,窗口可能会接收到内部重画消息。在这种情况下,窗口可能没有更新区域。应用程序必须调用GetUpdateRect成员函数以确定窗口是否具有更新区域。如果GetUpdateRect返回0,则应用程序不应调用BeginPaintEndPaint成员函数。
20、GetWindowRect
返回指定窗口的边框矩形的尺寸。该尺寸以相对于屏幕坐标左上角的屏幕坐标给出。
BOOL GetWindowRect(HWND hWnd,LPRECT lpRect);
hWnd:窗口句柄。
lpRect:指向一个RECT结构的指针,该结构接收窗口的左上角和右下角的屏幕坐标。
21、

AddFontResource

 
int AddFontResource(LPCTSTR lpszFilename);
从指定的文件里增加字体资源到系统字体表
22、BringWindowToTop
该函数将指定的窗口设置到Z序的顶部。如果窗口为顶层窗口,则该窗口被激活;如果窗口为子窗口,则相应的顶级父窗口被激活。BringWindowToTop函数并不能使一个窗口成为前台窗口。如果应用程序不在前台中而想设置在前台中,可以调用SetForegroundWindow函数。
B00L BringWindowToTop(HWND hWnd);
23、UpdateData
操作系统会调用这个函数来初始化对话框中的数据,或者检索或者验证对话框中的数据。
BOOL UpdateData( BOOL bSaveAndValidate = TRUE );
Updatedata(TRUE) == 将控件的值赋值给成员变量;Updatedata(FALSE) == 将成员变量的值赋值给控件。
24、::OnTimer
OnTimer()函数用于实现定时控制功能,定时控制功能主要由下面三个函数共同实现:
SetTimer, KillTimer()和OnTimer()
粗略的说,Settimer是设置一个计时器并开始执行计时器Ontimer中的代码(按照设定的时间间隔,每经过一个间隔时间向消息队列发送一个WM_TIMER事件或指定的回调函数),Ontimer是计时器所执行的代码。KillTimer用于停止计时器。或者说Settimer是设置定时器的,Ontimer是响应Settimer消息的。当Settimer设置的时间到了,就会自动调动Ontimer()函数。
WM_TIMER优先级极低,当消息队列中没有其他消息时才执行
UINT_PTR SetTimer(
HWND hWnd, // 窗口句柄
UINT_PTR nIDEvent, // 定时器ID,多个定时器时,可以通过该ID判断是哪个定时器
UINT nElapse, // 时间间隔,单位为毫秒
TIMERPROC lpTimerFunc // 回调函数,如果设为NULL,则使用系统默认的回调函数,系统默认的是OnTimer函数
);
25、WindowProc
该函数是一个应用程序定义的函数。它处理发送给窗口的消息。WINDPROC类型定义了一个指向该回调函数的指针。WindowProc是用于应用程序定义函数的占位符。
LRESULT CALLBACK WindowProc (HWND hwnd,
UINT uMsg,
WPARAM wParam,
LPARAM lParam);
hwnd:指向窗口的句柄。
uMsg:指定消息类型。
wParam:指定其余的、消息特定的信息。该参数的内容与UMsg参数值有关。
IParam:指定其余的、消息特定的信息。该参数的内容与uMsg参数值有关。
26、

CreateFile

 
这是一个多功能的函数,可打开或创建以下对象,并返回可访问的句柄:控制台,通信资源,目录(只读打开),磁盘驱动器,文件,邮槽,管道。Long,如执行成功,则返回文件句柄。INVALID_HANDLE_VALUE表示出错,会设置GetLastError。即使函数成功,但若文件存在,且指定了CREATE_ALWAYS 或 OPEN_ALWAYS,GetLastError也会设为ERROR_ALREADY_EXISTS
HANDLE WINAPI CreateFile(
_In_ LPCTSTR lpFileName,
_In_ DWORD dwDesiredAccess,
_In_ DWORD dwShareMode,
_In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
_In_ DWORD dwCreationDisposition,
_In_ DWORD dwFlagsAndAttributes,
_In_opt_ HANDLE hTemplateFile
);
27、

GetFileSize

 
判断文件长度。如果函数调用成功,则返回值为文件大小的低位双字,lpFileSizeHigh返回文件大小的高阶双字。lpFileSizeHigh Long:指定一个长整数,用于装载一个64位文件长度的头32位。如这个长度没有超过2^32个字节,则该参数可以设为NULL(变成ByVal)。
DWORD WINAPI GetFileSize(
HANDLE hFile,
LPDWORD lpFileSizeHigh
);
28、PlaySound
BOOL PlaySound(LPCSTR pszSound, HMODULE hwnd,DWORD fdwSound);
参数pszSound是指定了要播放声音的字符串,该参数可以是WAVE文件的名字,或是WAV资源的名字,或是内存中声音数据的指针,或是在系统注册表WIN.INI中定义的系统事件声音。如果该参数为NULL则停止正在播放的声音
参数hwnd是应用程序的实例句柄,除非pszSound的指向一个资源标识符(即fdwSound被定义为SND_RESOURCE),否则必须设置为NULL
参数fdwSound是标志的组合
29、strdup
将串拷贝到新建的位置处
extern char *strdup(char *s);
strdup()在内部调用了malloc()为变量分配内存,不需要使用返回的字符串时,需要用free()释放相应的内存空间,否则会造成内存泄漏。

30、

fgets

 
从文件结构体指针stream中读取数据,每次读取一行。读取的数据保存在buf指向的字符数组中,每次最多读取bufsize-1个字符(第bufsize个字符赋'\0'),如果文件中的该行,不足bufsize个字符,则读完该行就结束。如若该行(包括最后一个换行符)的字符数超过bufsize-1,则fgets只返回一个不完整的行,但是,缓冲区总是以NULL字符结尾,对fgets的下一次调用会继续读该行。函数成功将返回buf,失败或读到文件结尾返回NULL。因此我们不能直接通过fgets的返回值来判断函数是否是出错而终止的,应该借助feof函数或者ferror函数来判断。
char *fgets(char *buf, int bufsize, FILE *stream);
*buf: 字符型指针,指向用来存储所得数据的地址。
bufsize: 整型数据,指明存储数据的大小。
*stream: 文件结构体指针,将要读取的文件流。
例:
如果一个文件的当前位置的文本如下
Love, I Have
Since you can do it.
如果用fgets(str1,6,file1);去读取
则执行后str1 = "Love," ,读取了6-1=5个字符
这个时候再执行fgets(str1,20,file1)则执行后str1 = " I Have\n"
31、

stricmp

 
比较字符串s1和s2,但不区分字母的大小写
extern int stricmp(char *s1,char * s2);
32、_tcstol(TCHAR.H Routine) strtol(_UNICODE & _MBCS Not Defined) strtol(_MBCS Defined) wcstol(_UNICODE Defined
将字符串类型根据不同的基转化数字形式

long strtol( const char *nptr, char **endptr, intbase);

long wcstol( const wchar_t *nptr, wchar_t **endptr, intbase);

[in]   nptr 表示要进行扫描字符串指针

           [out] endptr  存储扫描后无法转化的剩余的字符串

          [base]  表示数字的基,取值为:2,8,10,16  对应的进制

(1).转二进制


#include"afx.h"
#include<stdio.h>
void main()
{
char c[5]="0131";
CString cs=_T(c);
LPTSTR pstr = NULL;
int last=_tcstol(c,pstr ,2);//2表示二进制
printf("%d\n",last);//使用十进制输出结果为1
printf("%s\n",pstr);//输出:31
 }
2).转八进制


#include"afx.h"
#include<stdio.h>
void main()
{
char c[7]="010a,!";
CString cs=_T(c);
LPTSTR pstr = NULL;
int last=_tcstol(c,pstr ,8);//8表示8进制printf("%d\n",last);//使用十进制输出结果为8
printf("%s\n",pstr);//输出:a,!
 }
33、PostMessage
将一个消息放入(寄送)到与指定窗口创建的线程相联系消息队列里,不等待线程处理消息就返回,是异步消息模式。消息队列里的消息通过调用GetMessage和PeekMessage取得。
BOOL WINAPI PostMessage(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM lParam);
hWnd:其窗口程序接收消息的窗口的句柄。可取有特定含义的两个值:
HWND_BROADCAST:消息被寄送到系统的所有顶层窗口,包括无效或不可见的非自身拥有的窗口、 被覆盖的窗口和弹出式窗口。消息不被寄送到子窗口
NULL:此函数的操作和调用参数dwThread设置为当前线程的标识符PostThreadMessage函数一样
  Msg:指定被寄送的消息。
  wParam:指定附加的消息特定的信息。
  IParam:指定附加的消息特定的信息。
34、RETAILMSG
This macro conditionally outputs a printf-style formatted message.RETAILMSG()是在evc 下的嵌入式开发 s3c2410,arm9 用的,在wince 操作系统下的。
RETAILMSG (Expression,Message)
Expression Boolean expression used to determine if the message would be output. Message Expression to be printed using printf format style.Return Values

35、DeviceIoControl
发送控制代码直接到指定的设备驱动程序,使相应的移动设备以执行相应的操作
BOOL WINAPI DeviceIoControl(
_In_ HANDLE hDevice,
_In_ DWORD dwIoControlCode,
_In_opt_ LPVOID lpInBuffer,
_In_ DWORD nInBufferSize,
_Out_opt_ LPVOID lpOutBuffer,
_In_ DWORD nOutBufferSize,
_Out_opt_ LPDWORD lpBytesReturned,
_Inout_opt_ LPOVERLAPPED lpOverlapped);
返回值
Long,非零表示成功,零表示失败。会设置GetLastError
参数表
参数类型及说明
hDevice Long,设备句柄,通过CreateFile函数获得
dwIoControlCode Long,应用程序调用驱动程序的控制命令,就是IOCTL_XXX IOCTLs(通过CTL_CODE宏定义)。
lpInBuffer Any,应用程序传递给驱动程序的数据缓冲区地址。
nInBufferSize Long,应用程序传递给驱动程序的数据缓冲区大小,字节数。
lpOutBuffer Any,驱动程序返回给应用程序的数据缓冲区地址。
nOutBufferSize Long,驱动程序返回给应用程序的数据缓冲区大小,字节数。
lpBytesReturned Long,驱动程序实际返回给应用程序的数据字节数地址。
lpOverlapped OVERLAPPED,这个结构用于重叠操作。针对同步操作,请用ByVal As Long传递零值

37、 ftell
用于得到文件位置指针当前位置相对于文件首的偏移字节数
long ftell(FILE *stream);
使用fseek函数后再调用函数ftell()就能非常容易地确定文件的当前位置。

38、feof
检测流文件指针是否到达文件结尾
int  feof(FILE  *stream);
EOF是文本文件结束的标志

39、fprintf
格式化输出到一个流/文件中
int fprintf (FILE* stream, const char*format, [argument])

40、fread
从一个文件流中读数据,最多读取count个元素,每个元素size字节,如果调用成功返回实际读取到的元素个数,如果不成功或读到文件末尾返回 0。
size_t fread ( void *buffersize_t sizesize_t countFILE *stream) ;

41、fwrite
向文件写入一个数据块
size_t fwrite(const void* buffer, size_t size, size_t count, FILE* stream);
这个函数以二进制形式对文件进行操作,不局限于文本返回值:返回实际写入的数据块数目
(1)buffer:是一个指针,对fwrite来说,是要获取数据的地址;
(2)size:要写入内容的单字节数;
(3)count:要进行写入size字节的数据项的个数;
(4)stream:目标文件指针;
(5)返回实际写入的数据项个数count。文件
说明:写入到文件的哪里? 这个与文件的打开模式有关,如果是w+,则是从file pointer指向的地址开始写,替换掉之后的内容,文件的长度可以不变,stream的位置移动count个数;如果是a+,则从文件的末尾开始添加,文件长度加大。
fseek对此函数有作用,但是fwrite 函数写到用户空间缓冲区,并未同步到文件中,所以修改后要将内存与文件同步可以用fflush(FILE *fp)函数同步。(?)
42、fseek
重定位流(数据流/文件)上的文件内部位置指针
int fseek(FILE *stream, long offset, int fromwhere);
如果执行成功,stream将指向以fromwhere为基准,偏移offset(指针偏移量)个字节的位置,函数返回0。如果执行失败(比如offset超过文件自身大小),则不改变stream指向的位置,函数返回一个非0值。实验得出,超出文件末尾位置,还是返回0。往回偏移超出首位置,返回-1,且指向一个-1的位置,请小心使用。
43、SetEndOfFile
针对一个打开的文件,将当前文件位置设为文件末尾
44、GetLocalTime
获取当地的当前系统日期和时间
VOID GetLocalTime(
LPSYSTEMTIME lpSystemTime //address of system times structure
);
44、InvalidateRect
向指定的窗体更新区域添加一个矩形,然后窗口客户区域的这一部分将被重新绘制。
BOOL InvalidateRect(
HWND hWnd, // handle of window with changed update region
CONST RECT *lpRect, // address of rectangle coordinates
BOOL bErase // erase-background flag
);
hWnd:要更新的客户区所在的 窗体的句柄。如果为NULL,则系统将在函数返回前重新绘制所有的窗口, 然后发送 WM_ERASEBKGND 和  WM_PAINT 给窗口过程处理函数。
lpRect:无效区域的矩形代表,它是一个 结构体 指针,存放着矩形的大小。如果为NULL,全部的窗口客户区域将被增加到更新区域中。
bErase:指出无效矩形被标记为有效后,是否重画该区域,重画时用预先定义好的画刷。当指定TRUE时需要重画。
说明:被标记为无效矩形的区域直到WM_PAINT消息被处理完之后才会消失,或者使用ValidateRect(),ValidateRgn()函数来使之有效。当应用程序的消息队列中为空时,并且窗体要更新的区域非空时,系统会发送一个WM_PAINT消息到窗体。
InvalidateRect(hwnd, NULL, true);重画时将擦除背景。
InvalidateRect(hwnd, NULL, false);重画时不擦除背景
45、UpdateWindow
如果窗口更新的区域不为空,UpdateWindow函数通过发送一个WM_PAINT消息来更新指定窗口的客户区。函数绕过应用程序的消息队列,直接发送WM_PAINT消息给指定窗口的窗口过程,如果更新区域为空,则不发送消息。
BOOL UpdateWindow(HWND hWnd);
Invalidate在消息队列中加入一条WM_PAINT消息,其无效区为整个客户区。而UpdateWindow直接发送一个WM_PAINT消息,其无效区范围就是消息队列中WM_PAINT消息(最多只有一条)的无效区,其只对声明为无效的区域起作用。
46、Sleep
 执行挂起一段时间
void Sleep(DWORD dwMilliseconds);
Sleep()单位为毫秒,sleep()单位为秒(如果需要更精确可以用usleep单位为微秒)
VC用Sleep, 别的一律使用sleep.
47、WIN32_FIND_DATA 
关于文件的全部属性信息。总计有以下以下9种:文件的标题名、文件的属性(只读、存档,隐藏等)、文件的创建时间、文件的最后访问时间、文件的最后修改时间、文件大小的高位双字、文件大小的低位双字、保留、保留。在这里只有文件标题名和文件的长度可以通过CFile类比较方便的获得,而对于其他几种属性的获取和设置就无能为力了。
typedef struct _WIN32_FIND_DATA {
DWORD dwFileAttributes; //文件属性
FILETIME ftCreationTime; // 文件创建时间
FILETIME ftLastAccessTime; // 文件最后一次访问时间
FILETIME ftLastWriteTime; // 文件最后一次修改时间
DWORD nFileSizeHigh; // 文件长度高32位
DWORD nFileSizeLow; // 文件长度低32位
DWORD dwReserved0; // 系统保留
DWORD dwReserved1; // 系统保留
TCHAR cFileName[ MAX_PATH ]; //  长文件名
TCHAR cAlternateFileName[ 14 ]; // 8.3格式文件名
} WIN32_FIND_DATA, *PWIN32_FIND_DATA;
47、 GetTickCount
GetTickCount返回(retrieve)从操作系统启动所经过(elapsed)的毫秒数,它的返回值是DWORD。
DWORD GetTickCount(void)
返回值以32位的双字类型DWORD存储,因此可以存储的最大值是(2^32-1) ms约为49.71天,因此若系统运行时间超过49.71天时,这个数就会归0
48、GetForegroundWindow
获取一个前台窗口的句柄(窗口与用户当前的工作)。该系统分配给其他线程比它的前台窗口的线程创建一个稍微更高的优先级
HWND GetForegroundWindow(void);
返回值是一个前台窗口的句柄。在某些情况下,如一个窗口失去激活时,前台窗口可以是NULL。
49、SetForegroundWindow
该函数将创建指定窗口的线程设置到前台,并且激活该窗口。键盘输入转向该窗口,并为用户改各种可视的记号。系统给创建前台窗口的线程分配的权限稍高于其他线程。
BOOL SetForegroundWindow(
50、CreateProcess
创建一个新的进程和它的主线程,这个新进程运行指定的可执行文件。
BOOL CreateProcess
(
LPCTSTR lpApplicationName,
LPTSTR lpCommandLine,
LPSECURITY _ ATTRIBUTES lpProcessAttributes,
LPSECURITY _ ATTRIBUTES lpThreadAttributes,
BOOL bInheritHandles,
DWORD dwCreationFlags,
LPVOID lpEnvironment,
LPCTSTR lpCurrentDirectory,
LPSTARTUPINFO lpStartupInfo,
LPPROCESS_INFORMATIONlpProcessInformation   //Pointer to a PROCESS_INFORMATION structure that receives identification information about the new process. 
);

51、 CreateCompatibleDC
创建一个与指定设备兼容的内存设备上下文环境(DC)。通过GetDc()获取的HDC直接与相关设备沟通,而本函数创建的DC,则是与内存中的一个表面相关联。
HDC CreateCompatibleDC(HDC hdc);
hdc:现有设备上下文环境的句柄,如果该句柄为NULL,该函数创建一个与应用程序的当前显示器兼容的内存设备上下文环境。
返回值:如果成功,则返回内存设备上下文环境的句柄;如果失败,则返回值为NULL。
注释:内存设备上下文环境是仅在内存中存在的设备上下文环境,当内存设备上下文环境被创建时,它的显示界面是标准的一个单色像素宽和一个单色像素高,在一个应用程序可以使用内存设备上下文环境进行绘图操作之前,它必须选择一个高和宽都正确的位图到设备上下文环境中,这可以通过使用CreateCompatibleBitmap函数指定高、宽和色彩组合以满足函数调用的需要。
当不再需要内存设备上下文环境时,可调用DeleteDc函数删除它。
52、 GetDC 
该函数检索一指定窗口的客户区域或整个屏幕的显示 设备上下文 环境的句柄,以后可以在GDI函数中使用该句柄来在设备上下文环境中绘图。GetDCEx函数是GetDC的一个扩展,它能使应用程序更多地控制在客户区域内如何或是否发生剪切。
HDC GetDC(HWND hWnd);
hWnd:设备上下文环境被检索的窗口的句柄,如果该值为NULL,GetDC则检索整个屏幕的设备上下文环境。Windows 98,WindowsNT 5.0或以后版本:如果该参数为Null,GetDC检索首要显示器的设备上下文环境,要得到其他显示器的设备上下文环境,可使用EnumDisplayMonitors和CreateDc函数。
GetDC函数根据指定的等级类型检索指定窗口普通的、典型的或特有的设备上下文环境。对于普通设备上下文环境,GetDC在每次检索的时候部分分配给它缺省特性,对于典型和特有的设备上下文环境,GetDC不改变先前设置的特性。
在使用普通设备上下文环境绘图之后,必须调用ReleaseDc函数释放该设备上下文环境,典型和特有设备上下文环境不需要释放,设备上下文环境的个数仅受有效内存的限制。
53、 CreateCompatibleBitmap
创建与指定的设备环境相关的设备兼容的位图。
HBITMAP CreateCompatibleBitmap(HDC hdc,int nWidth,int nHeight);
hdc: 设备环境句柄。
nWidth:指定位图的宽度,单位为像素。
nHeight:指定位图的高度,单位为像素。
需要与CreateCompatibleDC配合使用,当不再需要这个位图的时候,调用DeleteObject删除它。
54、 SelectObject
选择一对象到指定的设备上下文环境中,该新对象替换先前的相同类型的对象。
CPen* SelectObject( CPen* pPen );
CBrush* SelectObject( CBrush* pBrush );
virtual CFont* SelectObject( CFont* pFont );
CBitmap* SelectObject( CBitmap* pBitmap );
int SelectObject( CRgn* pRgn );
CGdiObject* SelectObject( CGdiObject* pObject );
函数原型:HGDIOBJ SelectObject(HDC hdc, HGDIOBJ hgdiobj)
hdc:设备上下文环境的句柄。
hgdiobj:被选择的对象的句柄,该指定对象必须由如下的函数创建。
返回值:如果选择对象不是区域并且函数执行成功,那么返回值是被取代的对象的句柄;如果选择对象是区域并且函数执行成功,返回如下一值:
55、 CreateFont 
创建一种有特殊性的逻辑字体,此逻辑字体可以在后面被任何设备选择。
HFONT CreateFont(
int nHeight, // logical height of font height
int nWidth, // logical average character width
int nEscapement, // angle of escapement
int nOrientation, // base-line orientation angle
int fnWeight, // font weight
DWORD fdwItalic, // italic attribute flag
DWORD fdwUnderline, // underline attribute flag
DWORD fdwStrikeOut, // strikeout attribute flag
DWORD fdwCharSet, // character set identifier
DWORD fdwOutputPrecision, // output precision
DWORD fdwClipPrecision, // clipping precision
DWORD fdwQuality, // output quality
DWORD fdwPitchAndFamily, // pitch and family
LPCTSTR lpszFace // pointer to typeface name string
);
56、 CxImage
图像操作类库, 可以快捷地存取、显示、转换各种图像。一个CxImage对象是一个扩展了的位图
例:
(1)CxImage smallImage;//旋转后的图片   

  image.Rotate(90,&smallImage);//旋转90,并且保存到smallImage中

(2)CxImage image;

image.load("name",类型)

(3)smallImg.Draw(pDC->GetSafeHdc(),CRect(40,70,picwidth,picheight));//图片旋转一定角度的话,getwidth和getheight的值发生变化


57、 BitBlt
对指定的源设备环境区域中的像素进行位块(bit_block)转换,以传送到目标设备 环境
BOOL BitBlt(  HDC hdcDest, // handle to destination DC
  int nXDest,  // x-coord of destination upper-left corner
  int nYDest,  // y-coord of destination upper-left corner
  int nWidth,  // width of destination rectangle
  int nHeight, // height of destination rectangle
  HDC hdcSrc,  // handle to source DC
  int nXSrc,   // x-coordinate of source upper-left corner
  int nYSrc,   // y-coordinate of source upper-left corner

  DWORD dwRop  // raster operation code

);

58、 CreateSolidBrush
创建一个具有指定颜色的逻辑刷子。 初始化一个指定颜色的画刷。画笔可以随后被选为任何设备上下文的当前刷子。在应用程序调用CreateSolidBrush创建刷子以后,可以通过调用SelectObject函数把该刷子选入设备环境。

59、 FillRect
用指定的画刷填充矩形,此函数包括矩形的左上边界,但不包括矩形的右下边界。
int FillRect(HDC hdc, CONST RECT *lprc, HBRUSH hbr);
hdc:设备环境句柄。
lprc:指向含有将填充矩形的逻辑坐标的RECT结构的 指针
hbr:用来填充矩形的画刷的句柄
由参数hbr定义的画刷可以是一个逻辑现刷句柄也可以是一个颜色值,如果指定一个逻辑画刷的句柄,调用下列函数之一来获得句柄;CreateHatchBrush、CreatePatternBrush或CreateSolidBrush。此外,你可以用GetStockObject来获得一个库存画刷句柄。如果指定一个颜色值,必须是标准系统颜色(所选择的颜色必须加1)如FillRect(hdc, &rect, (HBRUSH)(COLOR_ENDCOLORS+1)),参见GetSysColor可得到所有标准系统颜色列表。

60、 CreateThread
Windows API函数。该函数在主线程的基础上创建一个新线程。
CreateThread (
        LPSECURITY_ATTRIBUTES lpsa,    // security属性,在WinCE下须为NULL
        DWORD   cbStack,                               // 堆栈大小,除非定义宏,否则被忽略
        LPTHREAD_START_ROUTINE lpStartAddr,    // 起始地址,即C的函数指针
        LPVOID lpvThreadParam,        // 自定义的传入线程参数
        DWORD fdwCreate,                  // 标识线程是否立即运行,默认是
LPDWORD lpIDThread                // 新线程ID
);
61、 DoDataExchange
数据动态绑定技术,添加新变量到已经写好的控件类中
62、 BEGIN_MESSAGE_MAP
宏定义的一种。在BEGIN_MESSAGE_MAP()和END_MESSAGE_MAP()之间添加消息响应函数,为每个消息处理函数加入一个入口
BEGIN_MESSAGE_MAP( theClass, baseClass )
theClass:指定消息映射所属的类的名字。
baseClass:指定theClass的基类的名字。
每个消息映射入口的格式如下:ON_Notification(id, memberFxn)
其中id指定了发送通知的控件的子窗口的ID,而memberFxn指定了处理该通知的父对象中的成员函数名。
父对象的函数原型格式如下:afx_msg void memberFxn( );
可能的消息映射入口如下: ON_BN_CLICKED用户单击按钮时; ON_BN_DOUBLECLICKED 用户双击按钮时
63、extern "c"
extern "C"表明了一种编译规约,其中extern是关键字属性,“C”表征了编译器链接规范。对于extern "C"可以理解成在C++/C中的混合编程的编译指令。
作为一种面向对象的语言,C++支持函数重载,而过程式语言C则不支持。函数被C++编译后在符号库中的名字与C语言的不同。void foo( int x, int y );该函数被C编译器编译后在符号库中的名字为_foo,而C++编译器则会产生像_foo_int_int之类的名字(不同的编译器可能生成的名字不同,但是都采用了相同的机制,生成的新名字称为“mangledname”)。
64、 CreateThread
Windows API函数。该函数在主线程的基础上创建一个新线程。
CreateThread将在 主线程的基础上创建一个新线程,大致做如下步骤:
1.在内核对象中分配一个线程标识/句柄,可供管理,由CreateThread返回
2.把 线程退出码置为STILL_ACTIVE,把线程挂起计数置1
3.分配context结构
4.分配两页的物理存储以准备栈,保护页设置为PAGE_READWRITE,第2页设为PAGE_GUARD
5.lpStartAddr和lpvThread值被放在栈顶,使它们成为传送给StartOfThread的参数
6.把context结构的栈 指针指向栈顶(第5步)指令指针指向startOfThread函数
HANDLE CreateThread(
LPSECURITY_ATTRIBUTES lpThreadAttributes,//SD
SIZE_T dwStackSize,//initialstacksize
LPTHREAD_START_ROUTINE lpStartAddress,//threadfunction
LPVOID lpParameter,//threadargument
DWORD dwCreationFlags,//creationoption
LPDWORD lpThreadId//threadidentifier
)
lpThreadAttributes:指向SECURITY_ATTRIBUTES型态的结构的指针。在Windows 98中忽略该参数。在Windows NT中,NULL使用默认安全性,不可以被子线程继承,否则需要定义一个结构体将它的bInheritHandle成员初始化为TRUE
dwStackSize,设置初始栈的大小,以字节为单位,如果为0,那么默认将使用与调用该函数的线程相同的栈空间大小。任何情况下,Windows根据需要动态延长堆栈的大小。
lpStartAddress,指向线程函数的指针,形式:@函数名,函数名称没有限制,但是必须以下列形式声明:DWORD WINAPI 函数名 (LPVOID lpParam) ,格式不正确将无法调用成功。也可以直接调用void类型,但lpStartAddress要这样通过LPTHREAD_START_ROUTINE转换如: (LPTHREAD_START_ROUTINE)MyVoid,然后在线程声明为:void MyVoid(){return;}
lpParameter:向线程函数传递的参数,是一个指向结构的指针,不需传递参数时,为NULL。
dwCreationFlags :线程标志,可取值如下:(1)CREATE_SUSPENDED(0x00000004):创建一个挂起的线程,(2)0:表示创建后立即激活。(3)STACK_SIZE_PARAM_IS_A_RESERVATION(0x00010000):dwStackSize参数指定初始的保留堆栈 的大小,否则,dwStackSize指定提交的大小。
lpThreadId:保存新线程的id。
一般并不推荐使用 CreateThread函数,而推荐使用RTL库里的System单元中定义的 BeginThread函数,因为这除了能创建一个线程和一个入口函数以外,还增加了几项保护措施。在MFC程序中,应该调用AfxBeginThread函数,在Visual C++程序中应调用_beginthreadex函数。
65、 SetBkMode
MFC 里面封装的CDC类:
CDC::SetBkMode
int SetBkMode( int nBkMode );
API函数SetBkMode声明如下:
int SetBkMode(
HDC hdc, // handle of device context
int iBkMode // flag specifying background mode
);
hDC是当前设备的句柄。
mode是要设置的模式,其值可以为OPAQUE和TRANSPARENT。
OPAQUE的方式是用当前背景的画刷的颜色输出显示文字的背景,而TRANSPARENT是使用透明的输出,也就是文字的背景是不改变的。
66、DrawText
该函数在指定的矩形里写入格式化的正文,根据指定的方法对正文格式化(扩展的制表符,字符对齐、折行等)。
int DrawText(
HDC hDC, // 设备描述表句柄
LPCTSTR lpString, // 将要绘制的字符串
int nCount, // 字符串的长度, 如果nCount为-1,则lpString指向的字符串被认为是以\0结束的,DrawText会自动计算字符数。
LPRECT lpRect, // 指向矩形结构RECT的指针
UINT uFormat // 正文的绘制选项
);
67、 ReadFile
从文件指针指向的位置开始将数据读出到一个文件中, 且支持同步和异步操作,
BOOL ReadFile(
    HANDLE hFile,     //句柄
    LPVOID lpBuffer,     //用于保存读入数据的一个缓冲区
    DWORD nNumberOfBytesToRead,    //要读入的字节数
    LPDWORD lpNumberOfBytesRead,    //指向实际读取的字节数
    LPOVERLAPPED lpOverlapped	//异步 wince不支持,设为null
    //如文件打开时指定了FILE_FLAG_OVERLAPPED,那么必须,用这个参数引用一个特殊的结构。
    //该结构定义了一次异步读取操作。否则,应将这个参数设为NULL
);
68、 EnterCriticalSection
WINBASEAPI VOID WINAPI EnterCriticalSection(  __inout LPCRITICAL_SECTION lpCriticalSection);
多线程中用来确保同一时刻只有一个线程操作被保护的数据的操作函数,相关的多线程数据操作函数还有:
InitializeCriticalSection(&cs); //初始化临界区
EnterCriticalSection(&cs); //进入临界区
//操作数据
MyMoney*=10;//所有访问MyMoney变量的程序都需要这样写Enter.. Leave...
LeaveCriticalSection(&cs);//离开临界区
DeleteCriticalSection(&cs);//删除临界区
CRITICAL_SECTION不是针对于资源的,而是针对于不同线程间的代码段
69、 CRITICAL_SECTION 
不论是硬件临界资源,还是软件临界资源,多个线程必须互斥地对它进行访问。每个线程中访问临界资源的那段代码称为临界区(Critical Section)。
70、 WNDCLASS
结构WNDCLASS包含一个窗口类的全部信息,也是Windows编程中使用的基本数据结构之一,应用程序通过定义一个窗口类确定窗口的属性。CreateWindow将某个WNDCLASS定义的窗体变成实例。要得到某一窗口的WNDCLASS数据,可以用GetClassLong();RegisterClass()就是在系统注册某一类型的窗体

基本方法

typedef struct _WNDCLASS {
UINT style;// 窗口类型
WNDPROC lpfnWndProc;//窗口处理函数
int cbClsExtra;//窗口扩展
int cbWndExtra;//窗口实例扩展
HINSTANCE hInstance;//实例句柄
HICON hIcon;//窗口的最小化图标
HCURSOR hCursor;//窗口鼠标光标
HBRUSH hbrBackground;//窗口背景色
LPCTSTR lpszMenuName;//窗口菜单
LPCTSTR lpszClassName;// 窗口类名
} WNDCLASS, *LPWNDCLASS;
71、 GetMessage
函数GetMessage 是 从调用线程的消息队列里取得一个消息并将其放于指定的结构。此函数可取得与指定窗口联系的消息和由PostThreadMesssge寄送的线程消息。此函数接收一定范围的消息值。GetMessage不接收属于其他线程或应用程序的消息。获取消息成功后,线程将从消息队列中删除该消息。函数会一直等待直到有消息到来才有返回值。
GetMessage(LPMSG lpMsg,HWND hWnd,UINT wMsgFilterMin,UINT wMsgFilterMax)
lpMsg:指向MSG结构的指针,该结构从线程的消息队列里接收消息信息。
hWnd:取得其消息的窗口的句柄。当其值取NULL时,GetMessage为任何属于调用线程的窗口检索消息,线程消息通过PostThreadMessage寄送给调用线程。
wMsgFilterMin:指定被检索的最小消息值的整数。
wMsgFilterMax:指定被检索的最大消息值的整数。
返回值:如果函数取得WM_QUIT之外的其他消息,返回非零值。如果函数取得WM_QUIT消息,返回值是零。如果出现了错误,返回值是-1。
72、 TranslateMessage
将虚拟键消息转换为字符消息。将msg结构传给Windows,进行一些键盘转换。字符消息被寄送到调用线程的消息队列里,当下一次线程调用函数GetMessage或PeekMessage时被读出。
BOOL TranslateMessage( CONST MSG*lpMsg );
IpMsg:指向含有消息的MSG结构的指针,该结构里含有用函数GetMessage或PeekMessage从调用线程的消息队列里取得的消息信息。
73、 DispatchMessage
函数功能:该函数分发一个消息给窗口程序。通常消息从GetMessage函数获得。消息被分发到回调函数(过程函数),作用是消息传递给操作系统,然后操作系统去调用我们的回调函数,也就是说我们在窗体的过程函数中处理消息。
LONG DispatchMessage(CONST MSG*lpmsg);
备注:MSG结构必须包含有效的消息值。如果参数lpmsg指向一个WM_TIMER消息,并且WM_TIMER消息的参数IParam不为NULL,则调用IParam指向的函数,而不是调用窗口程序。
74、 __stdcall
被这个关键字修饰的函数,其参数都是从右向左通过堆栈传递的(__fastcall 的前面部分由ecx,edx传), 函数调用在返回前要由被调用者清理堆栈。
__stdcall是函数调用约定的一种,函数调用约定主要约束了两件事:
1.参数传递顺序
2.调用堆栈由谁(调用函数或被调用函数)清理
常见的函数调用约定:stdcall cdecl fastcall thiscall naked call
__stdcall表示
1.参数从右向左压入堆栈
2.函数被调用者修改堆栈
3.函数名(在编译器这个层次)自动加前导的下划线,后面紧跟一个@符号,其后紧跟着参数的尺寸
75、 匈牙利表示法
变数名以一个或者多个小写字母开始,这些字母表示变数的资料型态。例如,szCmdLine中的sz代表「以0结尾的字串」。在hInstance和hPrevInstance中的h字首表示「代号」;在iCmdShow中的i字首表示「整数」。 
在命名结构变数时,可以用结构名(或者结构名的一种缩写)的小写作为变数名的字首,或者用作整个变数名。
cchar或WCHAR或TCHAR
byBYTE (无正负号字元)
nshort
iint
x, yint分别用作x座标和y座标
cx, cyint分别用作x长度和y长度;C代表「计数器」
b或fBOOL (int);f代表「旗标」
wWORD (无正负号短整数)
lLONG (长整数)
dwDWORD (无正负号长整数)
fnfunction(函式)
sstring(字串)
sz以字符0结尾的字串
h句柄
p指针

76、 DefWindowProc 
 
该函数调用缺省的窗口过程来为应用程序没有处理的任何窗口消息提供缺省的处理。该函数确保每一个消息得到处理。
LRESULT DefWindowProc(HWND hWnd,UINT Msg,WPARAM wParam,LPARAM IParam);
呼叫DefWindowProc来为视窗讯息处理程式不予处理的所有讯息提供内定处理,这是很重要的。不然一般动作,如终止程式,将不会正常执行。
77、 SetCommMask
指定一组监视通信设备的事件
BOOL SetCommMask(HANDLE hFile, //标识通信端口的句柄
DWORD dwEvtMask // 能够使能的通信事件 准备监视的串口事件掩码(EV_RXCHAR A character was received and placed in the input buffer.A value of zero disables all events.),0停止所有事件
78、 SetupComm
该函数初始化一个指定的通信设备的通信参数。
BOOL SetupComm( HANDLE hFile, DWORD dwInQueue, DWORD dwOutQueue );
79、 SetCommTimeouts
BOOL SetCommTimeouts( HANDLE hFile, LPCOMMTIMEOUTS lpCommTimeouts );
windows系统利用此函数设定通讯设备读写时的超时参数
hFile是由CreateFile函数返回指向已打开串行口的句柄。第二个参数指向拥有超时数据的控制块COMMTIMEOUTS
80、 COMMTIMEOUTS 
规定读/写操作的超时
typedef struct _COMMTIMEOUTS { DWORD ReadIntervalTimeout; // 读间隔超时,在接收时两个字符之间的最大时延 DWORD ReadTotalTimeoutMultiplier; // 读时间系数 DWORD ReadTotalTimeoutConstant; // 读时间常量 DWORD WriteTotalTimeoutMultiplier; // 写时间系数 DWORD WriteTotalTimeoutConstant; // 写时间常量 } COMMTIMEOUTS,*LPCOMMTIMEOUTS; COMMTIMEOUTS结构的成员都以毫秒为单位。
有两种超时:间隔超时和总超时。间隔超时是指在接收时两个字符之间的最大时延,总超时是指读写操作总共花费的最大时间。写操作只支持总超时,而读操作两种超时均支持。
81、 DCB结构
串口通讯中的DCB结构 DCB(Device Control Block)结构定义了串口通信设备的控制设置。
typedef struct _DCB {    DWORD DCBlength;      /* sizeof(DCB)                     */    DWORD BaudRate;       /* Baudrate at which running       */波特率    DWORD fBinary: 1;     /* Binary Mode (skip EOF check)    */    DWORD fParity: 1;     /* Enable parity checking          */    DWORD fOutxCtsFlow:1; /* CTS handshaking on output       */    DWORD fOutxDsrFlow:1; /* DSR handshaking on output       */    DWORD fDtrControl:2;  /* DTR Flow control                */    DWORD fDsrSensitivity:1; /* DSR Sensitivity              */    DWORD fTXContinueOnXoff: 1; /* Continue TX when Xoff sent */    DWORD fOutX: 1;       /* Enable output X-ON/X-OFF        */    DWORD fInX: 1;        /* Enable input X-ON/X-OFF         */    DWORD fErrorChar: 1;  /* Enable Err Replacement          */    DWORD fNull: 1;       /* Enable Null stripping           */    DWORD fRtsControl:2;  /* Rts Flow control                */    DWORD fAbortOnError:1; /* Abort all reads and writes on Error */    DWORD fDummy2:17;     /* Reserved                        */    WORD wReserved;       /* Not currently used              */    WORD XonLim;          /* Transmit X-ON threshold         */    WORD XoffLim;         /* Transmit X-OFF threshold        */    BYTE ByteSize;        /* Number of bits/byte, 4-8        */     BYTE Parity;          /* 0-4=None,Odd,Even,Mark,Space    */校验位    BYTE StopBits;        /* 0,1,2 = 1, 1.5, 2               */停止位    char XonChar;         /* Tx and Rx X-ON character        */    char XoffChar;        /* Tx and Rx X-OFF character       */    char ErrorChar;       /* Error replacement char          */    char EofChar;         /* End of Input character          */    char EvtChar;         /* Received Event character        */    WORD wReserved1;      /* Fill for now.                   */ } DCB, *LPDCB;
82、SetCommState
设置串口设置(波特率,校验,停止位,数据位等)
BOOL SetCommState(HANDLE hFile,LPDCB lpDCB);
83、PurgeComm
清空输入输出缓冲区,终止待读写操作
BOOL PurgeComm(HANDLE hFile,DWORD dwFlags );
dwFlags:PURGE_TXABORT 、PURGE_RXABORT 、PURGE_TXCLEAR 、PURGE_RXCLEAR 
84、sprintf
字符串格式化命令,主要功能是把格式化的数据写入某个字符串中。sprintf 是个变参函数。
int sprintf( char *buffer, const char *format, [ argument] … );
返回值:字符串长度(strlen)
85、fscanf
int fscanf(FILE*stream, constchar*format, [argument...]); 
根据数据格式(format)从输入流(stream)中写入数据(argument);与fgets的差别在于:fscanf遇到空格和换行时结束,注意空格时也结束,fgets遇到空格不结束。
返回值:整型,成功返回读入的参数的个数,失败返回EOF(-1)。
86、memcpy
c和c++使用的内存拷贝函数,memcpy函数的功能是从源src所指的内存地址的起始位置开始拷贝n个字节到目标dest所指的内存地址的起始位置中。
void *memcpy(void *dest, const void *src, size_t n);
函数返回指向dest的指针。
1.source和destin所指的内存区域可能重叠,但是如果source和destin所指的内存区域重叠,那么这个函数并不能够确保source所在重叠区域在拷贝之前不被覆盖。而使用memmove可以用来处理重叠区域。函数返回指向destin的 指针
2.如果目标数组destin本身已有数据,执行memcpy()后,将覆盖原有数据(最多覆盖n)。如果要追加数据,则每次执行memcpy后,要将目标数组地址增加到你要追加数据的地址。
注意:source和destin都不一定是数组,任意的可读写的空间均可。
  87、 MultiByteToWideChar
int MultiByteToWideChar(UINT CodePage,//指定执行转换的字符集DWORD dwFlags,//一组位标记用以指出是否未转换成预作或宽字符(若组合形式存在),是否使用象形文字替代控制字符,以及如何处理无效字符。MB_PRECOMPOSED缺省的转换选择,不能与LPCSTR lpMultiByteStr,int cchMultiByte,//指定由参数lpMultiByteStr指向的字符串中字节的个数,如果lpMultiByteStr指定的字符串以空字符终止,可以设置为-1LPWSTR lpWideCharStr,//指向接收被转换字符串的缓冲区。int cchWideChar // 指定由参数lpWideCharStr指向的缓冲区的宽字符个数。若此值为零,函数返回缓冲区所必需的宽字符数,在这种情况下,lpWideCharStr中的缓冲区不被使用。 );  该函数映射一个字符串到一个宽字符(unicode)的字符串。由该函数映射的字符串没必要是多字节字符组
如果函数运行成功,并且cchWideChar不为零,返回值是由lpWideCharStr指向的缓冲区中写入的宽字符数;如果函数运行成功,并且cchWideChar为零,返回值是接收到待转换字符串的缓冲区所需求的宽字符数大小。如果函数运行失败,返回值为零。
88、WM_COPYDATA
在进程间共享数据(内部通过创建内存映射文件)
需要用到的数据结构/类型:typedef struct tagCOPYDATASTRUCT {    ULONG_PTR dwData;     DWORD cbData;    PVOID lpData;} COPYDATASTRUCT, *PCOPYDATASTRUCT;
结构体参数说明:    dwData(ULONG)   保存一个数值, 可以用来作标志等    lpData(void*)   待发送的数据的起始地址(可以为NULL)    cbData(DWORD)   待发送的数据的长度
SendMessage(接收窗口句柄, WM_COPYDATA, (WPARAM)发送窗口句柄, (LPARAM)&copyData);
使用示例:    COPYDATASTRUCT cds;    char msg[] = "女孩不哭";    cds.dwData = 0;    cds.lpData = msg;    cds.cbData = strlen(msg)+1; //字符串请记得把'\0'加上, 不然就错了, 这里是ANSI字符串    SendMessage(FindWindow("nbsg_class", NULL), WM_COPYDATA, 0, (LPARAM)&cds);    接收端对该消息的一种可能处理:    case WM_COPYDATA:    {        //这里的消息应该是以 '\0' 结尾的字符串        COPYDATASTRUCT* pCDS = (COPYDATASTRUCT*)lParam;        MessageBox(hWnd, pCDS->lpData, "", MB_OK);        return TRUE;    }    lpData 指向的内存应该是一段"数据", 就是说里面不应该有指向该程序某数据的指针. 因为 SendMessage 在处理 WM_COPYDATA 时, 只是把 lpData 指向的 cbData 个字节复制到共享内存中. 当前进程私有的指针就算是被发送到接收程序, 其也是无法访问的.
An application must use the SendMessage function to send this message, not the PostMessage function. 
89、OpenEvent
HANDLEOpenEvent(DWORD dwDesiredAccess,//该参数必须设置为以下值:EVENT_ALL_ACCESS 指定事件对象所有可能的权限BOOL bInheritHandle,//指定是否返回的句柄是否继承 。该参数必须设置为falseLPCTSTR lpName//指向一个以null结束的字符串,即将要打开的事件对象的名字。名称是区分大小写的。);
打开一个已经存在的命名事件对象
90、CreateEvent
CreateEvent是一个Windows API函数。它用来创建或打开一个命名的或无名的事件对象。如果想为对象指定一个访问掩码,应当使用CreateEventEx函数。
HANDLE CreateEvent(LPSECURITY_ATTRIBUTES lpEventAttributes,// 安全属性 如果lpEventAttributes是NULL,此句柄不能被继承。BOOL bManualReset,// 复位方式 指定将事件对象创建成手动复原还是自动复原。如果是TRUE,那么必须用ResetEvent函数来手工将事件的状态复原到无信号状态。如果设置为FALSE,当一个等待线程被释放以后,系统将会自动//将事件状态复原为无信号状态。BOOL bInitialState,// 初始状态 如果为TRUE,初始状态为有信号状态;否则为无信号状态。LPCTSTR lpName // 对象名称,是一个以0结束的字符串指针);
一个Event被创建以后,可以用OpenEvent()API来获得它的Handle,用CloseHandle()来关闭它,用SetEvent()或PulseEvent()来设置它使其有信号,用ResetEvent()来使其无信号,用WaitForSingleObject()或WaitForMultipleObjects()来等待其变为有信号.             
91、WriteFile      
从文件指针指向的位置开始将数据写入到一个文件中, 且支持同步和异步操作,如果文件打开方式没有指明FILE_FLAG_OVERLAPPED的话,当程序调用成功时,它将实际写入文件的字节数保存到lpNumberOfBytesWriten指明的地址空间中如果文件要交互使用的话,当函数调用完毕时要记得调整文件指针
BOOL WriteFile(HANDLE  hFile,//文件句柄LPCVOID lpBuffer,//数据缓存区指针DWORD   nNumberOfBytesToWrite,//你要写的字节数LPDWORD lpNumberOfBytesWritten,//用于保存实际写入字节数的存储区域的指针LPOVERLAPPED lpOverlapped//OVERLAPPED结构体指针,如果文件是以FILE_FLAG_OVERLAPPED方式打开的话,那么这个指针就不能为NULL wince不支持,设为null);
92、FindFirstFile
根据文件名查找文件。该函数到一个文件夹(包括子文件夹)去搜索指定文件 如果要使用附加属性去搜索文件的话 可以使用FindFirstFileEx函数。
HANDLE FindFirstFile(LPCTSTR lpFileName,//filenameLPWIN32_FIND_DATA lpFindFileData//databuffer);
LPCTSTR lpFileName文件名(包括路径),可使用通配符,例如“*”和“?”
LPWIN32_FIND_DATA lpFindFileData 指向一个用于保存文件信息的结构体
93、SendMessageTimeout
该函数将指定的消息发送到一个或多个窗口。此函数为指定的窗口调用窗口程序,并且,如果指定的窗口属于不同的线程,直到窗口程序处理完消息或指定的超时周期结束函数才返回。如果接收消息的窗口和当前线程属于同一个队列,窗口程序立即调用,超时值无用。
LRESULT SendMessageTimeout(HWND hwnd,UINT Msg,WPARAM wParam,LPARAM IParam,UINT fuFlags,UIUT uTimeout,LPDWORD lpdwResultult);
fuFlags:指定如何发送消息。此参数可为下列值的组合:SMTO_ABORTIFHUNG:如果接收进程处于“hung”状态,不等待超时周期结束就返回。SMTO_BLOCK:阻止调用线程处理其他任何请求,直到函数返回。SMTO_NORMAL:调用线程等待函数返回时,不被阻止处理其他请求。SMTO_NOTIMEOUTIFNOTHUNG:Windows 95及更高版本:如果接收线程没被挂起,当超时周期结束时不返回。
uTimeout:为超时周期指定以毫秒为单位的持续时间。如果该消息是一个广播消息,每个窗口可使用全超时周期。例如,如果指定5秒的超时周期,有3个顶层窗回未能处理消息,可以有最多15秒的延迟。
IpdwResult:指定消息处理的结果,依赖于所发送的消息。
94、afx_msg 
在头文件(DrawView.h)中声明消息响应函数原型。
   //{{AFX_MSG(CDrawView) //注释宏afx_msg void OnLButtonDown(UINT nFlags, CPoint point);//}}AFX_MSG //注释宏说明:在注释宏之间的声明在VC中灰色显示。afx_msg宏表示声明的是一个消息响应函数afx_msg消息函数 应用程序框架产生的消息映射函数例如:afx_msg void OnBnClickedButton1(); 其中 afx_msg为消息标志,它向系统声明:有消息映射到函数实现体;而在map宏定义中,就有具体消息和此函数的映射定义(可以是自定义BEGIN_MESSAGE_MAP、,也可以是系统自动完成的)afx是 application framework
在afxwin.h中afx_msg的解释:#ifndef afx_msg#define afx_msg // intentional placeholder#endif
只是定义了这个符号而已
例子:定义一个Edit的Change处理函数:
一、在类的头文件(*.h)中增加 :
//{{AFX_MSG(CDialogDemo)
afx_msg void OnChangeEdit1();
//}}AFX_MSG
二、在类的实现文件(*.cpp)中增加:
1.消息定义( ON_EN_CHANGE):
BEGIN_MESSAGE_MAP(CDialogDemo, CDialog)
//{{AFX_MSG_MAP()
ON_EN_CHANGE(IDC_EDIT1, OnChangeEdit1)
//}}AFX_MSG_MAP
END_MESSAGE_MAP()
2.执行函数:
void CDialogDemo::OnChangeEdit1()
{
// TODO: Add your control notification handler code here
……
}
95、WM_USER
#define WM_USER         0x0400
#define WM_APP 0x8000
There are five ranges of message numbers:0 through WM_USER –1 Messages reserved for use by the systemWM_USER through 0x7FFF Integer messages for use by private window classes
WM_APP through 0xBFFF Messages available for use by applications
  0xC000 through 0xFFFF String messages for use by applications
Greater than 0xFFFF Reserved by the system for future use
Message numbers in the first range (0 through WM_USER –1) are defined by the system. Values in this range that are not explicitly defined are reserved for future use by the system.   Message numbers in the second range (WM_USER through 0x7FFF) can be defined and used by an application to send messages within a private window class. These values cannot be used to define messages that are   meaningful throughout an application, because some predefined window classes already define values in this range. For example, predefined control classes such as BUTTON, EDIT, and LISTBOX may use these     values. Messages in this range should not be sent to other applications unless the applications have been designed to exchange messages and to attach the same meaning to the message numbers.  Message numbers in the third range (0x8000 through 0xBFFF) are available for application to use as private messages. Message in this range do not conflict with system messages.  Message numbers in the fourth range (0xC000 through 0xFFFF) are defined at run time when an application calls the RegisterWindowMessage function to retrieve a message number for a string. All applications  that register the same string can use the associated message number for exchanging messages. The actual message number, however, is not a constant and cannot be assumed to be the same between different  sessions. 
97、 GetBuffer
所属类:CString ,CBookMark,CBaseAllocator
CString::GetBuffer(int nMinBufLength)
nMinBufLength:The minimum size of the character buffer in characters. This value does not include space for a NULL terminator. 
这个函数是为一个CString对象重新获取其内部字符缓冲区的指针,返回的LPTSTR为非const的,从而允许直接修改CString中的内容。
如果nMinBufLength(最小占用长度) 比当前buffer长度大,那么就调用GetBuffer函数去释放当前的Buffer,用一个被请求的大小去覆盖这个buffer并且重新设定计数器为0,如果在这之前你在这个buffer中调用了LockBuffer,那么你将失去你当前锁定的buffer。
98、WaitCommEvent
为一个特指的通信设备等待一个事件发生,该函数所监控的事件是与该设备句柄相关联的一系列事件
BOOL WINAPI WaitCommEvent(__in HANDLEhFile,__out LPDWORDlpEvtMask,__in LPOVERLAPPEDlpOverlapped);
hFile:指向通信设备的一个句柄,该句柄应该是由 CreateFile函数返回的
lpEvtMask:A pointer to a variable that receives a mask indicating the type of event that occurred. If an error occurs, the value is zero; otherwise, it is one of the following values:EV_DSR、EV_ERR、EV_RING、EV_RLSD、EV_RXCHAR(A character was received and placed in the input buffer.)、EV_RXFLAG、EV_TXEMPTY
lpOverlapped:A pointer to an OVERLAPPED structure. This structure is required if hFile was opened with FILE_FLAG_OVERLAPPED.If hFile was opened with FILE_FLAG_OVERLAPPED, the lpOverlapped parameter must not be NULL. It must point to a valid OVERLAPPED structure. If hFile was opened with FILE_FLAG_OVERLAPPED and lpOverlapped is NULL, the function can incorrectly report that the operation is complete.If hFile was opened with FILE_FLAG_OVERLAPPED and lpOverlapped is not NULL, WaitCommEvent is performed as an overlapped operation. In this case, the OVERLAPPED structure must contain a handle to amanual-reset event object (created by using the CreateEvent function).If hFile was not opened with FILE_FLAG_OVERLAPPED, WaitCommEvent does not return until one of the specified events or an erroroccurs.
99、ClearCommError
清除硬件的通讯错误以及获取通讯设备的当前状态
BOOL ClearCommError(HANDLE hFile,LPDWORD lpErrors,LPCOMSTAT lpStat);
第二个参数表示错误类型。第三个参数指向一个返回设备状态的控制块COMSTAT(结构体)。
100、COMSTAT
COMSTAT结构包含串口的信息,结构定义如下:typedef struct _COMSTAT { // cst    DWORD fCtsHold : 1;   // Tx waiting for CTS signal   DWORD fDsrHold : 1;   // Tx waiting for DSR signal   DWORD fRlsdHold : 1;  // Tx waiting for RLSD signal   DWORD fXoffHold : 1;  // Tx waiting, XOFF char rec''d     DWORD fXoffSent : 1;  // Tx waiting, XOFF char sent   DWORD fEof : 1;       // EOF character sentDWORD fTxim : 1;      // character waiting for Tx   DWORD fReserved : 25; // reserved   DWORD cbInQue;        // bytes in input buffer该成员变量的值代表输入缓冲区的字节数,Specifies the number of bytes received by the serial provider but not yet read by a ReadFile operation   DWORD cbOutQue;       // bytes in output buffer} COMSTAT, *LPCOMSTAT;
101、atoi
alphanumeric to integer把字符串转换成整型数
int atoi(const char *nptr);
参数nptr字符串,如果第一个非空格字符存在,是数字或者正负号则开始做类型转换,之后检测到非数字(包括结束符 \0) 字符时停止转换,返回整型数。否则,返回零。
102、_wfopen
FILE *_wfopen(    const wchar_t* filename,    const wchar_t* mode );
Each of these functions returns a pointer to the open file.A null pointer value indicates an error. 
"r":Opens for reading. If the file does not exist or cannot be found, the fopen call fails. 
"w":Opens an empty file for writing. If the file exists, its contents are destroyed. 
"a":Opens for writing at the end of the file (appending) without removing the EOF marker before writing new data to the file; creates the file first if it doesn't exist. 
"r+":Opens for both reading and writing. (The file must exist.) 
"w+":Opens an empty file for both reading and writing. If the file exists, its contents are destroyed. 
"a+":Opens for reading and appending; the appending operation includes the removal of the EOF marker before data is written to the file and the EOF marker is restored after writing is complete; createsthe file first if it doesn't exist. 
When a file is opened with the "a" or "a+" access type, all write operations occur at the end of the file. 
103、GetModuleFileName
获取当前进程已加载模块的文件的完整路径,该模块必须由当前进程加载。如果想要获取另一个已加载模块的文件路径,可以使用GetModuleFileNameEx函数。
DWORD WINAPI GetModuleFileName(   _In_opt_  HMODULE hModule,   _Out_     LPTSTR lpFilename,   _In_      DWORD nSize);
Long,如执行成功,返回复制到lpFileName的实际字符数量;零表示失败。使用GetLastError可以打印错误信息。
hModule Long:一个模块的句柄。可以是一个DLL模块,或者是一个应用程序的实例句柄。如果该参数为NULL,该函数返回该应用程序全路径。
lpFileName String:指定一个字串缓冲区,要在其中容纳文件的用NULL字符中止的路径名,hModule模块就是从这个文件装载进来的
nSize Long:装载到缓冲区lpFileName的最大字符数量
104、_tcsrchr
Scan a string for the last occurrence of a character.
Returns a pointer to the last occurrence of c in str, or NULL if c is not found.
例:获得程序当前目录
   char szFilePath[MAX_PATH];  GetModuleFileName(NULL, szFilePath, MAX_PATH);   (_tcsrchr(szFilePath, _T('\\')))[1] = 0;
最后一句:char *ch = _tcsrchr(szFilePath, _T('\\'));查找最后一个\出现的位置,并返回\后面的字符(包括\)ch[1] = 0;//NULL  szFilePath后面加0,截断最后一个\后面的字符(不包括\)
105、续行符“\”
例:
#define SomeFun(x, a, b)\    if (x)\        x = a + b;\    else\        x = a - b;
VC的预处理器在编译之前会自动将\与换行回车去掉
106、RegCreateKeyEx
LONG WINAPI RegCreateKeyEx(__in HKEY hKey,__in LPCTSTR lpSubKey,DWORD Reserved,__in LPTSTR lpClass,__in DWORD dwOptions,__in REGSAM samDesired,__in LPSECURITY_ATTRIBUTES lpSecurityAttributes,__out PHKEY phkResult,__out LPDWORD lpdwDisposition);
创建指定的注册键。如果这个键已经存在,这个函数会打开它。注意:键的名字大小写不敏感。返回值:Long,零(ERROR_SUCCESS)表示成功。其他任何值都代表一个错误代码
参数 类型及说明hKey Long,一个打开项的句柄,或者一个标准项名lpSubKey String,欲创建的新子项的名字Reserved Long,设为零lpClass String,项的类名,可为NULLdwOptions Long,下述常数为零:REG_OPTION_VOLATILE——这个项不正式保存下来,系统重新启动后会消失samDesired Long,带有前缀KEY_??的一个或多个常数。它们组合起来描述了允许对这个项进行哪些操作lpSecurityAttributes SECURITY_ATTRIBUTES,对这个项的安全特性进行描述的一个结构(用ByVal As Long传递空值)。不适用于windows 95phkResult Long,指定用于装载新子项句柄的一个变量lpdwDisposition Long,用于装载下列某个常数的一个变量:REG_CREATED_NEW_KEY——新建的一个子项,REG_OPENED_EXISTING_KEY——打开一个现有的项
107、FindNextFile
This function continues a file search from a previous call to the FindFirstFile or the FindFirstFileEx function. 
BOOL FindNextFile(HANDLE hFindFile,LPWIN32_FIND_DATA lpFindFileData );
hFindFile:Search handle returned by a previous call to the FindFirstFile or the FindFirstFileEx function.
lpFindFileData:Pointer to the WIN32_FIND_DATA structure that receives information about the found file or subdirectory. The structure can be used in subsequent calls to FindNextFile to refer to the foundfile or directory. 
108、QueryInterface
查询组件是否支持某个特定的接口,返回一个指向组件支持的接口的指针,没有找到组件支持的接口则返回指针是NULL,返回的是一个HRESULT结构而不是一个数
109、IBasicAudio
IBasicAudio::get_Balance    //retrieves the balance for the audio signal 立体声平衡(声道),值为-10000到10000
IBasicAudio::get_Volumn//retrieves the volume (amplitude) of the audio signal 音量大小
IBasicAudio::put_Balance
IBasicAudio::put_Volume
110、IUnKnown
IUnKnown是一个接口。 所有COM接口都继承IUnKnown。
interface IUnKnown{virtual HRESULT __stdcall QueryInterface(const IID& iid,void **ppv)=0;virtual ULONG __stdcall AddRef()=0;virtual ULONG __stdcall Release()=0;}
111、rand函数
rand()函数是产生随机数的一个随机函数。C语言里还有 srand()函数等。
在标准的C库中函数rand()可以生成0~RAND_MAX之间的一个随机数,其中RAND_MAX 是stdlib.h 中定义的一个整数,它与系统有关。
例:printf("Random numbers are: %i %i\n",rand(),rand());
因为rand()函数是按指定的顺序来产生整数,因此每次执行上面的语句都打印相同的两个值,所以说C语言的随机并不是真正意义上的随机,有时候也叫伪随机数。
为了使程序在每次执行时都能生成一个新序列的随机值,我们通常通过为随机数生成器提供一粒新的随机种子。函数 srand()(来自stdlib.h)可以为随机数生成器播散种子。只要种子不同rand()函数就会产生不同的随机数序列。srand()称为随机数生成器的初始化器。
void srand(unsigned int seed);
通常可以利用系统时间来改变系统的种子值,即srand(time(NULL)),可以为rand函数提供不同的种子值,进而产生不同的随机数序列
例:生成1-8的随机数:rand()%8+1
112、timeGetTime
函数以毫秒计的系统时间。该时间为从系统开启算起所经过的时间。
该函数与timeGetSystemTime函数的唯一不同是timeGetSystemTime函数使用MMTIME结构返回系统时间。
注意timeGetTime函数是一个双字。这个值在0到2^32之间。大约49.71天。如果在代码中直接将该值用于计算,会导致一些问题,特别是用该值来控制代码的执行。一般利用两个timeGetTime函数返回值的不同来用于计算。
113、FindClose
BOOL FindClose(HANDLE hFindFile // file search handle);
关闭FindFirstFile创建的搜索句柄
114、CCriticalSection
类CCriticalSection的对象表示一个“临界区”,它是一个用于同步的对象,同一时刻只允许一个线程存取资源或代码区。
CCriticalSection::Lock
CCriticalSection::Unlock
115、GetDiskFreeSpaceEx
This function obtains the following information about the amount of space available on a disk volume: the total amount of space, the total amount of free space, and the amount of free space available to the user associated with the calling thread.
BOOL GetDiskFreeSpaceEx(  LPCWSTR lpDirectoryName, //不包括卷名的磁盘根路径名 PULARGE_INTEGER lpFreeBytesAvailableToCaller, //指定一个变量,用于容纳调用者可用的字节数量 PULARGE_INTEGER lpTotalNumberOfBytes,//指定一个变量,用于容纳磁盘上的总字节数  PULARGE_INTEGER lpTotalNumberOfFreeBytes//指定一个变量,用于容纳磁盘上可用的字节数 );
116、CTL_CODE
This macro creates a unique system I/O control code (IOCTL).  定义:#define CTL_CODE(DeviceType, Function, Method, Access)  (((DeviceType) << 16) | ((Access) << 14) | ((Function) << 2) | (Method))
DeviceType:Defines the type of device for the given IOCTL.This parameter can be no bigger than a WORD value.The values used by Microsoft are in the range 0-32767; the values 32768-65535 are reserved foruse by OEMs and IHVs.  
Function :Defines an action within the device category.Function codes 0-2047 are reserved for Microsoft; codes 2048-4095 are reserved for OEMs and IHVs.A function code can be no larger then 4095.
Method :Defines the method codes for how buffers are passed for I/O and file system controls.The following values are possible for this parameter:
METHOD_BUFFERED METHOD_IN_DIRECT METHOD_OUT_DIRECT METHOD_NEITHER 
This field is ignored by Windows CE. You should always use the METHOD_BUFFERED value unless compatibility with Windows-based desktop platforms is required using a different Method value. 
Access :Defines the access check value for any access. The following table shows the possible flags for this parameter:FILE_ANY_ACCESS、FILE_READ_ACCESS、FILE_WRITE_ACCESS. The FILE_ACCESS_ANY isgenerally the correct value. 

The following illustration shows the format of the resulting IOCTL.

117、SUCCEEDED
#define SUCCEEDED(Status)     ((HRESULT)(Status) >= 0)
Provides a generic test for success on any status value. Non-negative numbers indicate success.
118、CoCreateInstance 
Creates a single uninitialized object of the class associated with a specified CLSID.用指定的类标识符创建一个Com对象,用指定的类标识符创建一个未初始化的对象。
STDAPI CoCreateInstance( REFCLSID rclsid, //创建的Com对象的类标识符(CLSID) LPUNKNOWN pUnkOuter, //指向接口IUnknown的指针 DWORD dwClsContext,  //运行可执行代码的上下文 REFIID riid, //创建的Com对象的接口标识符 LPVOID * ppv //用来接收指向Com对象接口地址的指针变量);
   rclsid [in] CLSID associated with the data and code that will be used to create the object.     pUnkOuter      [in] If NULL, indicates that the object is not being created as part of an aggregate. If non-NULL, pointer to the aggregate object's IUnknown interface (the controlling IUnknown). dwClsContext [in] Context in which the code that manages the newly created object will run. The values are taken from the enumeration CLSCTX.riid [in] Reference to the identifier of the interface to be used to communicate with the object.ppv [out] Address of pointer variable that receives the interface pointer requested in riid. Upon successful return, *ppv contains the requested interface pointer. Upon failure, *ppv contains NULL.
119、CLSID
CLSID是指windows系统对于不同的应用程序,文件类型,OLE对象,特殊文件夹以及各种系统组件分配一个唯一表示它的ID代码,用于对其身份的标示和与其他对象进行区分。GUID是Globally Unique Identifier的简称,中文翻译 为“全局唯一标示符”,在Windows系统中也称之为Class ID,缩写为CLSID。
CLSID是一个128位的随机数,为了确保它的随机性,避免重复,它的算法主要是从两个方面入手:
 1. 一部分数字来自于系统网卡的序列号,由于每一个网卡的MAC地址都不一样,因此产生的ID也就会有差异。   2. 另外一部分数字来自于系统的当前时间。
GUID 的格式为“xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx”,其中每个 x 是 0-9 或 a-f 范围内的一个4位十六进制数。例如:6F9619FF-8B86-D011-B42D-00C04FC964FF 即为有效的 GUID 值。
typedef struct _GUID {          // size is 16    DWORD Data1;    WORD   Data2;    WORD   Data3;    BYTE  Data4[8];} GUID;
生成:
#include <objbase.h>  #include <stdio.h> //--生成GUID const char* newGUID() { static char buf[64] = {0}; GUID guid; if (S_OK == ::CoCreateGuid(&guid)) { _snprintf(buf, sizeof(buf) , "{%08X-%04X-%04x-%02X%02X-%02X%02X%02X%02X%02X%02X}" , guid.Data1 , guid.Data2 , guid.Data3 , guid.Data4[0], guid.Data4[1] , guid.Data4[2], guid.Data4[3], guid.Data4[4], guid.Data4[5] , guid.Data4[6], guid.Data4[7] ); } return (const char*)buf; } int main(int argc, char* argv[]) { //--COM CoInitialize(NULL); printf(newGUID()); printf("\n"); //--COM CoUninitialize(); return 0; }
120、WinMain
int WINAPI WinMain(   HINSTANCE hInstance,         // handle to current instance   HINSTANCE hPrevInstance, // handle to previous instance在Win32环境下,这个参数总是NULL   LPSTR lpCmdLine,              //一个以空终止的字符串,指定传递给应用程序的命令行参数   int nCmdShow                  //指定程序的窗口应该如何显示);
121、FindWindow
Returns the top-level(此函数不搜索子窗口) CWnd whose window class is given by lpszClassName and whose window name, or title, is given by lpszWindowName.
HWND FindWindow(   LPCTSTR lpClassName,   LPCTSTR lpWindowName ); 
122、HRESULT
HRESULT 其实是一个双字节的值,其最高位(bit)如果是0表示成功,1表示错误。if( SUCCEEDED( hr ) ){...} // 如果成功......if( FAILED( hr ) ){...} // 如果失败......
123、LRESULT
数据类型
124、CoInitializeEx
为当前线程初始化COM库并设置并发模式 。应用程序调用com库中的函数(除CoGetMalloc和内存分配函数)之前必须初始化com库。
HRESULT CoInitializeEx( void * pvReserved,//必须设为NULL DWORD dwCoInit);
dwCoInit该标示指明基于当前线程的并发模式和初始化选项。该参数是 COINIT 枚举类型,传入参数时候,除了COINIT_APARTMENTTHREADED 和COINIT_MULTITHREADED标记外,其余的标记可以组合使用
125、CoUninitialize
关闭当前线程的COM库,卸载线程加载的所有dll,释放任何其他的资源,关闭在线程上维护所有的RPC连接。
126、CoInitialize
以单线程的方式创建com对象,应用程序调用com库函数(除CoGetMalloc和内存分配函数)之前必须初始化com库。
127、fputs
向指定的文件写入一个字符串(不自动写入字符串结束标记符‘\0’)。成功写入一个字符串后,文件的位置指针会自动后移,函数返回值为非负整数;否则返回EOF(符号常量,其值为-1)。
int fputs(    const char* string,    FILE* stream );
128、CreateDirectory
BOOL CreateDirectory(  LPCTSTR lpPathName,  LPSECURITY_ATTRIBUTES lpSecurityAttributes ); 
lpPathName [in] Long pointer to a null-terminated string that specifies the path of the directory to be created. There is a default string size limit for paths of MAX_PATH characters. This limit is related to how the CreateDirectory function parses paths.   lpSecurityAttributes [in] Ignored; set to NULL. 
129、RegSetValueEx
stores data in the value field of an open registry key.
LONG RegSetValueEx(  HKEY hKey,  LPCWSTR lpValueName,  DWORD Reserved,  DWORD dwType,  const BYTE* lpData,  DWORD cbData );
hKey :Handle to a currently open key or any of the following predefined reserved handle values:HKEY_CLASSES_ROOT HKEY_CURRENT_USER HKEY_LOCAL_MACHINE HKEY_USERS 
lpValueName:Pointer to a string containing the name of the value to set. 
dwType:Type of information to be stored as the value's data. 
lpData:Pointer to a buffer containing the data to be stored with the specified value name. 
cbData :Size, in bytes, of the information pointed to by the lpData parameter. 
130、CloseHandle
closes an open object handle.
BOOL CloseHandle(  HANDLE hObject);
CloseHandle invalidates the specified object handle, decrements the object's handle count, and performs object retention checks. After the last handle to an object is closed, the object is removed from the   system. Persistent objects such as databases and files will remain in storage, but must be re-opened to be accessed again.   Closing a thread handle does not terminate the associated thread. To remove a thread object, you must terminate the thread, and then close all handles to the thread.
Use CloseHandle to close handles returned by calls to the CreateFile function. Use FindClose to close handles returned by calls to the FindFirstFile function.
131、GetTimeZoneInformation
获得当前时区的相关信息This function retrieves the current time-zone parameters. These parameters control the translations between UTC and local time.    DWORD GetTimeZoneInformation(  LPTIME_ZONE_INFORMATION lpTimeZoneInformation ); 
lpTimeZoneInformation :[out] Pointer to a TIME_ZONE_INFORMATION structure to receive the current time-zone parameters. 
typedef struct _TIME_ZONE_INFORMATION {LONG Bias;//和0时区相差的分钟数 UTC = local time + biasWCHAR StandardName[ 32 ];//标准时间的名称SYSTEMTIME StandardDate;//如果有夏令时的时区,这个结构确定了什么时间开始实行夏令时LONG StandardBias;//标准时间下,和Bias的差别。通常为0WCHAR DaylightName[ 32 ];//夏令时的名称SYSTEMTIME DaylightDate;//结束夏令时的时间LONG DaylightBias;//夏令时的时候,时间的偏差} TIME_ZONE_INFORMATION, *PTIME_ZONE_INFORMATION, *LPTIME_ZONE_INFORMATION;  其中UTC = local time + bias(UTC时间 = 本地时间 + bias)
132、GetWindow
返回与指定窗口有特定关系(如Z序或所有者)的窗口句柄
HWND GetWindow(   HWND hWnd,   UINT uCmd ); 
uCmd :Specifies the relationship between the specified window and the window whose handle is to be retrieved. 
GW_CHILD、GW_HWNDFIRST、GW_HWNDLAST、GW_HWNDNEXT、GW_HWNDPREV、GW_OWNER
133、IsWindowVisible
BOOL IsWindowVisible(HWND hWnd)
通过该函数可以获得指定窗口的可视状态,即显示或者隐藏。
134、IsWindow
This function determines whether the specified window handle identifies an existing window.BOOL IsWindow(  HWND hWnd ); 
135、GetGestureInfo 
在给定笔势信息的句柄的情况下检索笔势信息结构。
BOOL WINAPI GetGestureInfo( __in   HGESTUREINFO hGestureInfo, __out  PGESTUREINFO pGestureInfo);
参数hGestureInfo [in]笔势信息句柄。pGestureInfo [out]一个指向笔势信息结构的指针。
在调用该函数之前,必须设置传入该函数的 GESTUREINFO 结构的 cbSize 成员。否则,调用 GetLastError 将返回 ERROR_INVALID_PARAMETER(十进制的 87)。如果某个应用程序处理 WM_GESTURE 消息,则该应用程序负责关闭使用    CloseGestureInfoHandle 的句柄。如果不这样做,则可能会导致进程内存泄漏。如果将该消息传递给 DefWindowProc,或者使用 API 函数的一个 PostMessage 或 SendMessage 类转发该消息,则将通过该消息传送句柄,并且应用程序无需关闭句柄。
示例:
GESTUREINFO gestureInfo = {0};    gestureInfo.cbSize = sizeof(gestureInfo);    BOOL bResult = GetGestureInfo((HGESTUREINFO)lParam, &gestureInfo);    if (!bResult){                        DWORD err = GetLastError();                                           }
136、WM_GESTURE
传递有关笔势的信息。MFC的CWnd类已经加载了这个消息,以虚函数的方式供集成的类使用,函数声明为LRESULT OnGesture(WPARAM wParam, LPARAM lParam);然后分配指派手势的不同虚函数执行相应的手势代码。
wParam:提供标识笔势命令和特定于笔势的参数值的信息。此信息是在 GESTUREINFO 结构中的 ullArguments 成员中传递的相同信息。
lParam:提供标识笔势命令和特定于笔势的参数值的信息的句柄。可通过调用 GetGestureInfo 检索此信息。
笔势命令:
笔势ID 值(dwID) 说明
GID_BEGIN1指示泛型笔势已开始。
GID_END2指示泛型笔势已结束。
GID_ZOOM3指示缩放开始、缩放移动或缩放停止。第一条 GID_ZOOM 命令消息开始缩放但不会导致任何缩放。第二条 GID_ZOOM 命令触发与第一条 GID_ZOOM 中包含的状态相关的缩放。
GID_PAN4指示平移移动或平移开始。第一条 GID_PAN 命令指示平移开始但不会执行任何平移。在出现第二条 GID_PAN 命令消息时,应用程序将开始平移。
GID_ROTATE5指示旋转移动或旋转开始。第一条 GID_ROTATE 命令消息指示旋转移动或旋转开始但不会进行旋转。第二条 GID_ROTATE 命令消息将触发与第一条 GID_ROTATE 中包含的状态相关的旋转操作。
GID_TWOFINGERTAP6指示双指点击笔势。
GID_PRESSANDTAP7指示按住并点击笔势。可以用来表示鼠标的右键动作。
137、CString::Mid
CString Mid( int nFirst ) const;
throw( CMemoryException );
CString Mid( int nFirst, int nCount ) const;
throw( CMemoryException );
返回一个包含指定范围字符的拷贝的CString对象。注意,这个返回的CString对象可能是空的。
nFirst 此CString对象中的要被提取的子串的第一个字符的从零开始的索引。
nCount 要从此CString对象中提取的字符数。如果没有提供这个参数,则字符串的其余部分都被提取。
138、TerminateProcess
This function terminates the specified process and all of its threads.
BOOL TerminateProcess( HANDLE hProcess,  DWORD uExitCode);
This function is used to unconditionally cause a process to exit. Use this function only in extreme circumstances. 
139、GetWindowThreadProcessId
This function retrieves the identifier of the thread that created the specified window and, optionally, the identifier of the process that created the window.
DWORD GetWindowThreadProcessId( HWND hWnd,  LPDWORD lpdwProcessId );
140、OpenProcess
This function returns a handle to an existing process object.
HANDLE OpenProcess(  DWORD fdwAccess,  BOOL fInherit,   DWORD IDProcess);
141、GetWindowTextLength
The GetWindowTextLength function retrieves the length, in characters, of the specified window's title bar text (if the window has a title bar). If the specified window is a control, the function retrieves    the length of the text within the control. However, GetWindowTextLength cannot retrieve the length of the text of an edit control in another application.
int GetWindowTextLength(HWND hWnd);
hWnd:[in] Handle to the window or control. 
142、CEdit::SetSel
Call this function to select a range of characters in an edit control.
void SetSel(   DWORD dwSelection,   BOOL bNoScroll = FALSE   );  void SetSel(   int nStartChar,   int nEndChar,   BOOL bNoScroll = FALSE   );
dwSelection:Specifies the starting position in the low-order word and the ending position in the high-order word. If the low-order word is 0 and the high-order word is –1, all the text in the edit control            is selected. If the low-order word is –1, any current selection is removed.  bNoScroll:Indicates whether the caret should be scrolled into view. If FALSE, the caret is scrolled into view. If TRUE, the caret is not scrolled into view.
143、CEdit::ReplaceSel
Call this function to replace the current selection in an edit control with the text specified by lpszNewText.
void ReplaceSel(   LPCTSTR lpszNewText,   BOOL bCanUndo = FALSE //To specify that this function can be undone, set the value of this parameter to TRUE . The default value is FALSE.   );
Replaces only a portion of the text in an edit control. If you want to replace all of the text, use the CWnd::SetWindowText member function.If there is no current selection, the replacement text is        inserted at the current cursor location.
144、CEdit::GetLineCount
Call this function to retrieve the number of lines in a multiple-line edit control.
int GetLineCount( ) const;
145、CEdit::LineScroll
Call this function to scroll the text of a multiple-line edit control.
void LineScroll(   int nLines,//Specifies the number of lines to scroll vertically.   int nChars = 0 //Specifies the number of character positions to scroll horizontally. This value is ignored if the edit control has either the ES_RIGHT or ES_CENTER style.   );
146、CWnd::UpdateData
Call this member function to initialize data in a dialog box, or to retrieve and validate dialog data.
BOOL UpdateData(     BOOL bSaveAndValidate = TRUE );
bSaveAndValidate:Flag that indicates whether dialog box is being initialized (FALSE) or data is being retrieved (TRUE).
查找存储器
HANDLE WINAPI FindFirstStore(  PSTOREINFO pStoreInfo);
BOOL WINAPI FindNextStore(  HANDLE hSearch,  PSTOREINFO pStoreInfo);
148、STOREINFO
This structure contains information about an instance of the store.
typedef struct tagSTOREINFO {     DWORD      cbSize;                  // sizeof(PD_STOREINFO)    TCHAR      szDeviceName[DEVICENAMESIZE];    TCHAR      szStoreName[STORENAMESIZE];    DWORD      dwDeviceClass;    DWORD      dwDeviceType;    STORAGEDEVICEINFO sdi;    DWORD      dwDeviceFlags;    SECTORNUM  snNumSectors;            // number of sectors on store    DWORD      dwBytesPerSector;        // number of bytes per sector    SECTORNUM  snFreeSectors;           // number of unallocated sectors    SECTORNUM  snBiggestPartCreatable;  // biggest partition currently creatable    FILETIME   ftCreated;               // last time store was formatted    FILETIME   ftLastModified;          // last time partition table was modified    DWORD      dwAttributes;            // store attributes, see below    DWORD      dwPartitionCount;        // Number of Partitions    DWORD      dwMountCount;            // Number of partitions that have been mounted } STOREINFO, *PSTOREINFO;
149、OpenStore
This function opens the storage volume.
HANDLE OpenStore( LPCSTR szDeviceName//[in] Name of the device. );
Returns a handle to the store or INVALID_HANDLE_VALUE if the open failed.
150、FindFirstPartition
This partition finds the first partition on the store.
HANDLE WINAPI FindFirstPartition(    HANDLE hStore,//[in] Handle to the store returned from OpenStore.     PPARTINFO pPartInfo//[in, out] Pointer to a PARTINFO structure.   );
151、PARTINFO
typedef struct {  
  DWORD cbSize;  
  TCHAR szPartitionName[PARTITIONNAMESIZE];
  TCHAR szFileSys[FILESYSNAMESIZE];  //Name of the file system. Maximum length is 32. 
  TCHAR szVolumeName[VOLUMENAMESIZE];//Name of the volume. 卷名
  SECTORNUM snNumSectors;  
  FILETIME ftCreated;  
  FILETIME ftLastModified;
  DWORD dwAttributes;  
  BYTE bPartType;
} PARTINFO, *PPARTINFO;
This structure contains information about a partition.
152、lstrcmpi
比较两个字符串,此比较不区分大小写。
int lstrcmp(LPCTSTR lpString1,LPCTSTR lpString2);
153、FindClosePartition
This function closes the partition search handle.
BOOL WINAPI FindClosePartition(HANDLE hSearch);
154、FindCloseStore
This function closes the store search handle.
BOOL WINAPI FindCloseStore(HANDLE hSearch);
155、SHELLEXECUTEINFO 

Contains information used by ShellExecuteEx
typedef struct _SHELLEXECUTEINFO {
       DWORD cbSize;  
       ULONG fMask;
       HWND hwnd;
       LPCTSTR lpVerb;
       LPCTSTR lpFile;
       LPCTSTR lpParameters;
       LPCTSTR lpDirectory;
       int nShow;
       HINSTANCE hInstApp;
       LPVOID lpIDList;
       LPCTSTR lpClass;
       HKEY hkeyClass;
       DWORD dwHotKey;
       union {
          HANDLE hIcon;
          HANDLE hMonitor;
       } DUMMYUNIONNAME;
      HANDLE hProcess;
} SHELLEXECUTEINFO, *LPSHELLEXECUTEINFO;
参数详解:
cbSize
结构大小,以字节为单位。
fMask
一个标志数组,用来设置其他成员的有效性。
hwnd
可选。执行ShellExecuteEx的窗口句柄,可设为NULL。
lpVerb
指定执行的动作,包括:edit ,explore ,find ,open,print, properties
lpFile
以\0 结尾的字符串,指出 lpVerb 的操作对象的路径,被系统支持的操作包括文本的 open 、 print等
lpParameters
可选。运行/打开程序的参数,如果打开的是一个文档,则该项无效
lpDirectory
可选。指明工作目录的名字,成员没有说明,则默认为当前目录
nShow
必须。指定打开的程序的显示方式,为SW_值中的一个。
hInstApp
【out】如果设置SEE_MASK_NOCLOSEPROCESS S值并且ShellExecuteEx 调用成功,则该项的值大于32,如果调用失败,则将设置为 SE_ERR_XXX 的错误值。
lpIDList
一个ITEMIDLIST结构的地址,用来存储成员的特别标识符,当fMask不包括SEE_MASK_IDLIST或SEE_MASK_INVOKEIDLIST时该项被忽略
lpClass
用以指明文件类别的名字或GUID,当fMask不包括SEE_MASK_CLASSNAME时该项被忽略
hkeyClass
获得已在系统注册的文件类型的Handle,当fMask不包括SEE_MASK_HOTKEY时该项被忽略
 dwHotKey
程序的热键关联,低位存储虚拟关键码(Key Code),高位存储修改标志位(HOTKEYF_),修改标志为(modifier flags)的详细列表请看WM_SETHOTKEY消息的描述,当fmask不包括SEE_MASK_HOTKEY时该项被忽略
DUMMYUNIONNAME
hIcon
取得对应文件类型的图标的Handle,当fMask不包括SEE_MASK_ICON时该项被忽略
hMonitor
将文档显示在显示器上的Handle,当fMask不包括SEE_MASK_HMONITOR时该项被忽略
hProcess
指向新启动的程序的句柄。若fMask不设为SEE_MASK_NOCLOSEPROCESS则该项值为NULL。但若程序没有启动,即使fMask设为SEE_MASK_NOCLOSEPROCESS,该值也仍为NULL。

156、ShellExecuteEx
Performs an operation on a specified file。对指定应用程序执行某个操作
lpExecInfo:Long pointer to a SHELLEXECUTEINFO structure that contains and receives information about the application being executed. 
基本使用ShellExecuteEx&SHELLEXECUTEINFO:
SHELLEXECUTEINFO ShellInfo;

memset(&ShellInfo, 0, sizeof(ShellInfo));

ShellInfo.cbSize = sizeof(ShellInfo);

ShellInfo.hwnd = NULL;

ShellInfo.lpVerb = _T("open");

ShellInfo.lpFile = szFilePath;

ShellInfo.nShow = SW_SHOWNORMAL;

ShellInfo.fMask = SEE_MASK_NOCLOSEPROCESS;

BOOL bResult = ShellExecuteEx(&ShellInfo);


157、EnumFilters
provides an enumerator for all filters in the graph.
HRESULT EnumFilters(IEnumFilters **ppEnum);

  ppEnum:[out] Receives a pointer to the IEnumFilters interface. Use this interface to enumerate the filters. The caller must release the interface.
返回值:S_OK、E_OUTOFMEMORY、E_POINTER(Null pointer argument.)

158、IEnumFilters Interface
This interface implements a standard Component Object Model (COM) collection object.
HRESULT Clone(  IEnumFilters **ppEnum);//makes a copy of the enumerator object.
HRESULT Next(ULONG cFilters,IBaseFilter **ppFilter,ULONG *pcFetched);//retrieves the specified number of filters in the enumeration sequence. 
cFilters:[in] Number of filters to retrieve. 
ppFilter:[out] Array of size cFilters that is filled with IBaseFilter interface pointers. The caller must release the interfaces.
pcFetched:[out] Receives the number of filters retrieved. Can be NULL if cFilters is 1. 
HRESULT Reset(void);//resets the enumeration sequence to the beginning. 
HRESULT Skip(ULONG cFilter);//skips over a specified number of filters.
159、IBaseFilter Interface
The IBaseFilter interface is the primary interface for DirectShow filters. All DirectShow filters must expose this interface. The Filter Graph Manager uses this interface to control filters. Applications   can use this interface to enumerate pins and query for filter information, but should not use it to change the state of a filter. Instead, use the IMediaControl interface on the Filter Graph Manager.
Method:
HRESULT EnumPins(IEnumPins **ppEnum);//enumerates the pins on this filter.
HRESULT FindPin(LPCWSTR Id,IPin **ppPin)
HRESULT JoinFilterGraph(  IFilterGraph *pGraph,  LPCWSTR pName);
pGraph:[in] Pointer to the Filter Graph Manager's IFilterGraph interface, or NULL if the filter is leaving the graph.
pName:[in, string] Pointer to a wide-character string that specifies a name for the filter.
HRESULT QueryFilterInfo(FILTER_INFO *pInfo);
HRESULT QueryVendorInfo(LPWSTR *pVendorInfo);
160、IGraphBuilder::RenderFile
builds a filter graph that renders the specified file.
HRESULT RenderFile(
    LPCWSTR lpwstrFile,//[in] Specifies a wide-character string that contains the name of a media file.
    LPCWSTR lpwstrPlayList//NULL
  );
161、ConnectDirect
connects the two pins directly (without intervening filters). 
HRESULT ConnectDirect(
    IPin *ppinOut,
    IPin *ppinIn,
    const AM_MEDIA_TYPE *pmt //Pointer to the media type to use for the connection (optional; can be NULL). 
  );
162、RedrawWindow
updates the specified rectangle or region in a window's client area. 
BOOL RedrawWindow(
    HWND hWnd,               // handle to window
    CONST RECT *lprcUpdate,  // update rectangle
    HRGN hrgnUpdate,         // handle to update region
    UINT flags               // array of redraw flags
  );
When RedrawWindow is used to invalidate part of the desktop window, the desktop window does not receive a WM_PAINT message. To repaint the desktop, an application uses the RDW_ERASE flag to generate a      WM_ERASEBKGND message. 
InvalidateRect()与 UpdateWindow()结合后可以实现立即更新,两者结合的效果相当于RedrawWindow(rect)
163、CPaintDC
CPaintDC类是一个来自CDC的设备环境类。它在构造期间执行CWnd::BeginPaint,在析构期间执行CWnd::EndPaint。 一个CPaintDC对象只在响应一个WM_PAINT消息的时候被使用,通常是在你的OnPaint消息处理成员函数中。
数据成员:
m_ps 包含了用于画客户区的PAINTSTRUCT
m_hWnd CPaintDC对象所附着的HWND

164、ResetEvent
sets the state of the specified event object to nonsignaled.
BOOL ResetEvent(HANDLE hEvent ); 
165、CString::Find
在一个较大的字符串中查找字符或子字符串,返回此CString对象中与需要的子字符串或字符匹配的第一个字符的从零开始的索引;如果没有找到子字符串或字符则返回-1。
int Find( TCHAR ch ) const;
  int Find( LPCTSTR lpszSub ) const;
  int Find( TCHAR ch, int nStart ) const;
  int Find( LPCTSTR pstr, int nStart ) const;
166、RasEnumConnections
 lists all active RAS connections.列举当前活动的拨号连接。 It returns each connection's handle and phone book entry name. 
DWORD RasEnumConnections(
  LPRASCONN lprasconn, 
  LPDWORD lpcb, 
  LPDWORD lpcConnections 
);
返回值:0成功
参数:
lprasconn:指向RASCONN结构数组指针
lpcb :参数lprasconn结构数据的大小
lpcConnections :活动连接数目
167、RASCONN
typedef struct _RASCONN { 
  DWORD dwSize; 
  HRASCONN hrasconn; 
  TCHAR szEntryName[ RAS_MaxEntryName + 1 ]; 
} RASCONN;
This structure provides data about a remote access connection. 
dwSize:Specifies the size, in bytes, of the RASCONN structure.
hrasconn:拨号连接句柄
szEntryName :Null-terminated string that specifies the phone-book entry used to establish the remote access connection. If the connection was established using an empty entry name, this string consists of a period (.) followed by the connection phone number. 
168、SubclassWindow
子类化窗口

169、modf
double modf( 
    double x, 
    double* intptr 
);
将x分解为整数和小数部分,返回值为小数部分







































































































































































































  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值