VC++常用技术术语.docx
《VC++常用技术术语.docx》由会员分享,可在线阅读,更多相关《VC++常用技术术语.docx(31页珍藏版)》请在冰豆网上搜索。
![VC++常用技术术语.docx](https://file1.bdocx.com/fileroot1/2023-2/10/81bb25e9-22f5-4df9-a365-f97231c50aeb/81bb25e9-22f5-4df9-a365-f97231c50aeb1.gif)
VC++常用技术术语
VC作为一个主流的开发平台一直深受编程爱好者的喜爱,严格的来说VC++不是门语言,虽然它和C++之间有密切的关系,如果形象点比喻的话,可以C++看作为一种“工业标准”,而VC++则是某种操作系统平台下的“厂商标准”,而“厂商标准”是在遵循“工业标准”的前提下扩展而来的。
VC++应用程序的开发主要有两种模式,一种是WINAPI方式,另一种则是MFC方式,传统的WINAPI开发方式比较繁琐,而MFC则是对WINAPI再次封装,所以MFC相对于WINAPI开发更具备效率优势,但为了对WINDOWS开发有一个较为全面细致的认识,笔者在这里还是以讲解WINAPI的相关内容为主线。
要想学习好VC必须具备良好的C/C++的基础,必要的英语阅读能力也是必不可少的,因为大量的技术文档多以英文形式发布。
第一部分:
VC++中的对象的命名规则、常用宏定义的命名,以及VC++下的数据类型。
(注:
这部分简单浏览即可。
)
匈牙利命名法规则
一般情况下,变量的取名方式为:
++。
范围前缀_,类型前缀_,限定词。
特殊的类型命名,前缀表示:
类、接口
前缀
类型
例子
备注
Lm(类名拼音第一个字母)
Class
LmObject
表示类型本身
不与范围前缀结合使用
I
Interface接口
IUnknown
注:
类名前缀改为Lm,对于非全局的类最好有语义表示其所属模块。
类的实例命名与类名大致相同,只是类名语义表示类的通用含义,而类名表示此实例的具体语义。
如类名LmSketPoint表示草图点的类定义,而它的两个实例_StartPoint,_EndPoint分别代表起点和终点的语义。
类的实例命名带上前缀_。
特殊约定:
a.MouseTool的派生类的前缀为_Mt.
b.对话框类的前缀为CDlg.
c.橡皮条类的前缀为_Rb.
凡围前缀:
前缀
类型
例子
备注
g_
全局作用域
g_Servers
m_
成员变量
m_pDoc,
l_
局部作用域
l_strName
少用
注:
编程时尽量少用全程变量,对于全程变量还应在类型前缀后加上如下关键字:
特征模块 :
Fea
草图模块 :
Sket
装配模块 :
Asm
工程图模块:
Lay
曲面模块 :
Surf
界面模块 :
Ui
常用的一般数据类型的前缀
前缀
类型
内存规格描述
例子
ch
char
8-bitcharacter
chGrade
ch
TCHAR
16-bitcharacterif_UNICODEisdefined
chName
b
BOOL
Booleanvalue
bEnabled
n
int
Integer(sizedependentonoperatingsystem)
nLength
n
UINT
Unsignedvalue(sizedependentonoperatingsystem)
nLength
w
WORD
16-bitunsignedvalue
wPos
l
LONG
32-bitsignedinteger
lOffset
dw
DWORD
32-bitunsignedinteger
dwRange
p
*
Ambientmemorymodelpointer
pDoc
lp
FAR*
Farpointer
lpDoc
lpsz
LPSTR
32-bitpointertocharacterstring
lpszName
lpsz
LPCSTR
32-bitpointertoconstantcharacterstring
lpszName
lpsz
LPCTSTR
32-bitpointertoconstantcharacterstringif_UNICODEisdefined
lpszName
h
handle
HandletoWindowsobject
hWnd
lpfn
(*fn)()
callbackFarpointertoCALLBACKfunction
lpfnAbort
常用Windows对象名称缩写
Windows对象
例子变量
MFC类
例子对象
HWND
hWnd;
CWnd*
pWnd;
HDLG
hDlg;
CDialog*
pDlg;
HDC
hDC;
CDC*
pDC;
HGDIOBJ
hGdiObj;
CGdiObject*
pGdiObj;
HPEN
hPen;
CPen*
pPen;
HBRUSH
hBrush;
CBrush*
pBrush;
HFONT
hFont;
CFont*
pFont;
HBITMAP
hBitmap;
CBitmap*
pBitmap;
HPALETTE
hPalette;
CPalette*
pPalette;
HRGN
hRgn;
CRgn*
pRgn;
HMENU
hMenu;
CMenu*
pMenu;
HWND
hCtl;
CStatic*
pStatic;
HWND
hCtl;
CButton*
pBtn;
HWND
hCtl;
CEdit*
pEdit;
HWND
hCtl;
CListBox*
pListBox;
HWND
hCtl;
CComboBox*
pComboBox;
VisualC++常用宏定义命名列表
前缀
符号类型
符号例子
范围
IDR_
标识多个资源共享的类型
IDR_MAINFRAME
1to0x6FFF
IDD_
对话框资源(Dialog)
IDD_SPELL_CHECK
1to0x6FFF
IDB_
位图资源(Bitmap)
IDB_COMPANY_LOGO
1to0x6FFF
IDC_
光标资源(Cursor)
IDC_PENCIL
1to0x6FFF
IDI_
图标资源(Icon)
IDI_NOTEPAD
1to0x6FFF
ID_IDM_
工具栏或菜单栏的命令项
ID_TOOLS_SPELLING
0x8000to0xDFFF
HID_
命令上下文帮助(CommandHelpcontext)
HID_TOOLS_SPELLING
0x18000to0x1DFFF
IDP_
消息框提示文字资源
IDP_INVALID_PARTNO
8to0xDFFF
HIDP_
消息框上下文帮助(Message-boxHelpcontext)
HIDP_INVALID_PARTNO
0x30008to0x3DFFF
IDS_
字符串资源(String)
IDS_COPYRIGHT
1to0x7FFF
IDC_
对话框内的控制资源(Control)
IDC_RECALC
8to0xDFFF
VISUALC++下的数据类型
类型
含义
ATOM
Atom.Formoreinformation,seeAtoms.
BOOL
Booleanvariable(shouldbeTRUEorFALSE).
BOOLEAN
Booleanvariable(shouldbeTRUEorFALSE).
BYTE
Byte(8bits).
CALLBACK
Callingconventionforcallbackfunctions.
CHAR
8-bitWindows(ANSI)character.Formoreinformation,seeCharacterSetsUsedByFonts.
COLORREF
Red,green,blue(RGB)colorvalue(32bits).SeeCOLORREFforinformationonthistype.
CONST
Variablewhosevalueistoremainconstantduringexecution.
DWORD
32-bitunsignedinteger.
DWORD_PTR
Unsignedlongtypeforpointerprecision.Usewhencastingapointertoalongtypetoperformpointerarithmetic.(Alsocommonlyusedforgeneral32-bitparametersthathavebeenextendedto64bitsin64-bitWindows.)
DWORD32
32-bitunsignedinteger.
DWORD64
64-bitunsignedinteger.
FLOAT
Floating-pointvariable.
HACCEL
Handletoanacceleratortable.
HANDLE
Handletoanobject.
HBITMAP
Handletoabitmap.
HBRUSH
Handletoabrush.
HCONV
Handletoadynamicdataexchange(DDE)conversation.
HCONVLIST
HandletoaDDEconversationlist.
HCURSOR
Handletoacursor.
HDC
Handletoadevicecontext(DC).
HDDEDATA
HandletoDDEdata.
HDESK
Handletoadesktop.
HDROP
Handletoaninternaldropstructure.
HDWP
Handletoadeferredwindowpositionstructure.
HENHMETAFILE
Handletoanenhancedmetafile.
HFILE
HandletoafileopenedbyOpenFile,notCreateFile.
HFONT
Handletoafont.
HGDIOBJ
HandletoaGDIobject.
HGLOBAL
Handletoaglobalmemoryblock.
HHOOK
Handletoahook.
HICON
Handletoanicon.
HIMAGELIST
Handletoanimagelist.
HIMC
Handletoinputcontext.
HINSTANCE
Handletoaninstance.
HKEY
Handletoaregistrykey.
HKL
Inputlocaleidentifier.
HLOCAL
Handletoalocalmemoryblock.
HMENU
Handletoamenu.
HMETAFILE
Handletoametafile.
HMODULE
Handletoamodule.Thevalueisthebaseaddressofthemodule.
HMONITOR
Handletoadisplaymonitor.
HPALETTE
Handletoapalette.
HPEN
Handletoapen.
HRGN
Handletoaregion.
HRSRC
Handletoaresource.
HSZ
HandletoaDDEstring.
HWINSTA
Handletoawindowstation.
HWND
Handletoawindow.
INT
32-bitsignedinteger.
INT_PTR
Signedintegraltypeforpointerprecision.Usewhencastingapointertoanintegertoperformpointerarithmetic.
INT32
32-bitsignedinteger.
INT64
64-bitsignedinteger.
LANGID
Languageidentifier.Formoreinformation,seeLocales.
LCID
Localeidentifier.Formoreinformation,seeLocales.
LCTYPE
Localeinformationtype.Foralist,seeLocaleandLanguageInformation.
LONG
32-bitsignedinteger.
LONG_PTR
Signedlongtypeforpointerprecision.Usewhencastingapointertoalongtoperformpointerarithmetic.
LONG32
32-bitsignedinteger.
LONG64
64-bitsignedinteger.
LONGLONG
64-bitsignedinteger.
LPARAM
Messageparameter.
LPBOOL
PointertoaBOOL.
LPBYTE
PointertoaBYTE.
LPCOLORREF
PointertoaCOLORREFvalue.
LPCRITICAL_SECTION
PointertoaCRITICAL_SECTION.
LPCSTR
Pointertoaconstantnull-terminatedstringof8-bitWindows(ANSI)characters.Formoreinformation,seeCharacterSetsUsedByFonts.
LPCTSTR
AnLPCWSTRifUNICODEisdefined,anLPCTSTRotherwise.
LPCVOID
Pointertoaconstantofanytype.
LPCWSTR
Pointertoaconstantnull-terminatedstringof16-bitUnicodecharacters.Formoreinformation,seeCharacterSetsUsedByFonts.
LPDWORD
PointertoaDWORD.
LPHANDLE
PointertoaHANDLE.
LPINT
PointertoanINT.
LPLONG
PointertoaLONG.
LPSTR
Pointertoanull-terminatedstringof8-bitWindows(ANSI)characters.Formoreinformation,seeCharacterSetsUsedByFonts.
LPTSTR
AnLPWSTRifUNICODEisdefined,anLPSTRotherwise.
LPVOID
Pointertoanytype.
LPWORD
PointertoaWORD.
LPWSTR
Pointertoanull-terminatedstringof16-bitUnicodecharacters.Formoreinformation,seeCharacterSetsUsedByFonts.
LRESULT
Signedresultofmessageprocessing.
LUID
Locallyuniqueidentifier.
PBOOL
PointertoaBOOL.
PBOOLEAN
PointertoaBOOL.
PBYTE
PointertoaBYTE.
PCHAR
PointertoaCHAR.
PCRITICAL_SECTION
PointertoaCRITICAL_SECTION.
PCSTR
Pointertoaconstantnull-terminatedstringof8-bitWindows(ANSI)characters.Formoreinformation,seeCharacterSetsUsedByFonts.
PCTSTR
APCWSTRifUNICODEisdefined,aPCSTRotherwise.
PCWCH
PointertoaconstantWCHAR.
PCWSTR
Pointertoaconstantnull-terminatedstringof16-bitUnicodecharacters.Formoreinformation,seeCharacterSetsUsedByFonts.
PDWORD
PointertoaDWORD.
PFLOAT
PointertoaFLOAT.
PHANDLE
PointertoaHANDLE.
PHKEY
PointertoanHKEY.
PINT
PointertoanINT.
PLCID
PointertoanLCID.
PLONG
PointertoaLONG.
PLUID
PointertoaLUID.
POINTER_32
32-bitpointer.Ona32-bitsystem,thisisanativepointer.Ona64-bitsystem,thisisatruncated64-bitpointer.
POINTER_64
64-bitpointer.Ona64-bitsystem,thisisanativepointer.Ona32-bitsystem,thisisasign-extended32-bitpointer.
PSHORT
PointertoaSHORT.
PSTR
Pointertoanull-terminatedstringof8-bitWindows(ANSI)characters.Formoreinformation,seeCharacterSetsUsedByFonts.
PTBYTE
PointertoaTBYTE.
PTCHAR
PointertoaTCHAR.
PTSTR
PWSTRifUNICODEisdefined,aPSTRotherwise.
PTBYTE
PointertoaTBYTE.
PTCHAR
PointertoaTCHAR.
PTSTR
APWSTRifUNICODEisdefined,aPSTRotherwise.
PUCHAR
PointertoaUCHAR.
PUINT
PointertoaUINT.
PULONG
PointertoaULONG.
PUSHORT
PointertoaUSHORT.
PVOID
Pointertoanytype.
PWCHAR
PointertoaWCHAR.
PWORD
PointertoaWORD.
PWSTR
Pointertoanull-terminatedstringof16-bitUnicodecharacters.Formoreinformation,seeCharacterSetsUsedByFonts.
REGSAM
Securityaccessmaskforregistrykey.
SC_HANDLE
Handletoaservicecontrolmanagerdatabase.Formoreinformation,seeSCMHandles.
SC_LOCK
Handletoaservicecontrolmanagerdatabaselock.Formoreinformation,seeSCMHandles.
SERVICE_STATUS_HANDLE
Handletoaservicestatusvalue.Formoreinformation,seeSCMHandles.
SHORT
Shortinteger(16bits).
SIZE_T
Themaximumnumberofbytestowhichapointercanpoint.Useforacountthatmustspanthefullrangeofapointer.
SSIZE_T
SignedSIZE_T.
TBYTE
AWCHARifUNICODEisdefined,aCHARotherwise.
TCHAR
AWCHARifUNICODEisdefined,aCHARotherwise.
UCHAR
UnsignedCHAR.
UINT
UnsignedINT.
UINT_PTR
UnsignedINT_PTR.
UINT32
UnsignedINT32.
UINT64
UnsignedINT64.
ULONG
UnsignedLONG.
ULONG_PTR
UnsignedLONG_PTR.
ULONG32
UnsignedLONG32.
ULONG64
UnsignedLONG64.
ULONGLONG
64-bitunsignedinteger.
UNSIGNED
Unsignedattribute.
USHORT
UnsignedSHORT.
VOID
Anytype.
WCHAR
16-bitUnicodecharacter.Formor