匈牙利命名法则_第1页
匈牙利命名法则_第2页
匈牙利命名法则_第3页
匈牙利命名法则_第4页
匈牙利命名法则_第5页
已阅读5页,还剩9页未读 继续免费阅读

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

匈牙利命名法规则大全一般情况下,变量的取名方式为:<scope_>+<prefix_>+vqualifier>范围前缀一类型前缀_,限定词特殊的类型命名,前缀表示:类、接口前缀类型例子备注LmClassLmObject表示类型本身IInterface接口IUnknown不与范围前缀结合使用注:类名前缀改为Lm,对于非全局的类最好有语义表示其所属模块。类的实例命名与类名大致相同,只是类名语义表示类的通用含义,而类名表示此实例的具体语义。如类名LmSketPoint表示草图点的类定义,而它的两个实例_StartPoint,_EndPoint分别代表起点和终点的语义。类的实例命名带上前缀O特殊约定:a.MouseTool的派生类的前缀为_Mt.b.对话框类的前缀为CDlg.c.橡皮条类的前缀为_Rb.范围前缀:前缀类型例子备注「g全局作用域gServersm成员变量mpDoc,l局部作用域lstrName少用:注:编程时尽量少用全局变量,对于全局变量还应在类型前缀后加上如下天特征模块 :Fea草图模块:Sket装配模块 :Asm工程图模块:Lay曲面模块:Surf界面模块 :Ui常用的一般数据类型的前缀前缀类型内存规格描述例子chchar8-bitcharacterchGradechTCHAR16-bitcharacterif_UNICODEisdefinedchNamebBOOLBooleanvaluebEnablednintInteger(sizedependentonoperatingsystem)nLengthnUINTUnsignedvalue(sizedependentonoperatingsystem)nLengthwWORD16-bitunsignedvalue wPoslLONG32-bitsignedinteger lOffset

dwDWORD32-bitunsignedintegerdwRangeP *AmbientmemorymodelpointerpDoc 1 IP FAR*FarpointerlpDocIpszLPSTR32-bitpointertocharacterstringlpszName 1 k—■ IpszLPCSTR32-bitpointertoconstantcharacterstringlpszNameIpszLPCTSTR32-bitpointertoconstantcharacterstringif_UNICODEisdefinedlpszNameh handleHandletoWindowsobjecthWndIpfn (*fn)()callbackFarpointertoCALLBACKfunctionlpfnAbort常用Windows 对象名称缩写Windows对象例子变量MFC类例子对象HWNDhWnd;CWnd*pWnd;HDLGhDlg;CDialog*pDlg;HDChDC;CDC*pDC;HGDIOBJhGdiObj;CGdiObject*pGdiObj;HPENhPen;CPen*pPen;HBRUSHhBrush;CBrush*pBrush;HFONThFont;CFont*pFont;HBITMAPhBitmap;CBitmap*pBitmap;HPALEIIEhPalette;CPalette*pPalette;HRGNhRgn;CRgn*pRgn;HMENUhMenu;CMenu*pMenu;HWNDhCtl;CStatic*pStatic;HWNDhCtl;CButton*pBtn;HWNDhCtl;CEdit*pEdit;HWNDhCtl;CListBox*pListBox;HWNDhCtl;CComboBox*pComboBox;VisualC++常用宏定义命名列表前缀符号类型符号例子范围IDR_标识多个资源共享的类型IDR_MAINFRAME1to0x6FFFIDD_对话框资源(Dialog)IDD_SPELL_CHECK1to0x6FFFIDB_位图资源(Bitmap)IDB_COMPANY_LOGO1to0x6FFFIDC光标资源(Cursor)IDCPENCIL1to0x6FFFIDI图标资源(Icon)IDINOTEPAD1to0x6FFFIDIDM工具栏或采单栏的IDTOOLSSPELLING0x8000to

命令项OxDFFFHID_命令上下文帮助(CommandHelpcontext)HID_IOOLS_SPELLING0x18000toOxIDFFFIDP_消息框提示文字资源IDP_INVALID_PARTNO8to0xDFFFHIDP_消息框上下文帮助(Message-boxHelpcontext)HIDP_INVALID_PARTNO0x30008to0x3DFFFIDS_字符串资源(String)IDS_COPYRIGHT1to0x7FFFIDC_对话框内的控制资源(Control)IDC_RECALC8to0xDFFFVISUALC++下的数据类型类型含义ATOMAtom.Formoreinformation,seeAtoms.BOOLBooleanvariable(shouldbeTRUEorFALSE).BOOLEANBooleanvariable(shouldbeTRUEorFALSE).BYTEByte(8bits).CALLBACKCallingconventionforcallbackfunctions.CHAR8-bitWindows(ANSI)character.Formoreinformation,seeCharacterSetsUsedByFonts.COLORREFRed,green,blue(RGB)colorvalue(32bits).SeeCOLORREFforinformationonthistype.CONSTVariablewhosevalueistoremainconstantduringexecution.DWORD32-bitunsignedinteger.DWORD_PTRUnsignedlongtypeforpointerprecision.Usewhencastingapointertoalongtypetoperformpointerarithmetic.(Alsocommonlyusedforgeneral32-bitparametersthathavebeenextendedto64bitsin64-bitWindows.)DWORD3232-bitunsignedinteger.DWORD6464-bitunsignedinteger.

FLOAT Floating-pointvariable.HACCELHandietoanacceleratortable. 1―1 M1 1——■1 HANDLEHandletoanobject.HBITMAP 1—1 H1 1——J Handletoabitmap.HBRUSH 1—1 H1 1 1 Handletoabrush.HCONVHandletoadynamicdataexchange(DDE)conversation.HCONVLISTHandletoaDDEconversationlist.HCURSOR 1—1 H1 Handletoacursor.HDCHandletoadevicecontext(DC).HDDEDATAHandletoDDEdata.HDESKHandletoadesktop.HDROPHandletoaninternaldropstructure.HDWPHandletoadeferredwindowpositionstructure.HENHMETAFILEHandletoanenhancedmetafile.HFILEHandletoafileopenedbyOpenFile,notCreateFile.HFONTHandletoafont.HGDIOBJHandletoaGDIobject.HGLOBALHandletoaglobalmemoryblock.HHOOKHandletoahook.HICONHandletoanicon.HIMAGELISTHandletoanimagelist.HIMCHandletoinputcontext.HINSTANCEHandletoaninstanee.HKEYHandletoaregistrykey.HKLInputlocaleidentifier.HLOCALHandletoalocalmemoryblock.HMENUHandletoamenu.HMETAFILEHandletoametafile.HMODULEHandletoamodule.Thevalueisthebaseaddressofthemodule.HMONITORHandletoadisplaymonitor.HPALEIIEHandletoapalette.HPENHandletoapen.HRGNHandletoaregion.HRSRCHandletoaresource.HSZHandletoaDDEstring.HWINSTAHandletoawindowstation.HWNDHandletoawindow.

INT32-bitsignedinteger.INT_PTRSignedintegraltypeforpointerprecision.Usewhencastingapointertoanintegertoperformpointerarithmetic.INT3232-bitsignedinteger.INT6464-bitsignedinteger.LANGIDLanguageidentifier.Formoreinformation,seeLocales.LCIDLocaleidentifier.Formoreinformation,seeLocales.LCTYPELocaleinformationtype.Foralist,seeLocaleandLanguageInformation.LONG32-bitsignedinteger.LONG_PTRSignedlongtypeforpointerprecision.Usewhencastingapointertoalongtoperformpointerarithmetic.LONG3232-bitsignedinteger.LONG6464-bitsignedinteger.LONGLONG64-bitsignedinteger.LPARAMMessageparameter.LPBOOLPointertoaBOOL.LPBYTEPointertoaBYTE.LPCOLORREFPointertoaCOLORREFvalue.LPCRITICAL_SECTIONPointertoaCRITICALSECTION .LPCSTRPointertoaconstantnull-terminatedstringof8-bitWindows(ANSI)characters.Formoreinformation,seeCharacterSetsUsedByFonts.LPCTSTRAnLPCWSTRifUNICODEisdefined,anLPCTSTRotherwise.LPCVOIDPointertoaconstantofanytype.LPCWSTRPointertoaconstantnull-terminatedstringof16-bitUnicodecharacters.Formoreinformation,seeCharacterSetsUsedByFonts.LPDWORDPointertoaDWORD.LPHANDLEPointertoaHANDLE.

LPINTPointertoanINT.LPLONGPointertoaLONG.LPSTRPointertoanull-terminatedstringof8-bitWindows(ANSI)characters.Formoreinformation,seeCharacterSetsUsedByFonts.LPTSTRAnLPWSIRifUNICODEisdefined,anLPSTRotherwise.LPVOIDPointertoanytype.LPWORDPointertoaWORD.LPWSTRPointertoanull-terminatedstringof16-bitUnicodecharacters.Formoreinformation,seeCharacterSetsUsedByFonts.LRESULTSignedresultofmessageprocessing.LUIDLocallyuniqueidentifier.PBOOLPointertoaBOOL.PBOOLEANPointertoaBOOL.PBYTEPointertoaBYTE.PCHARPointertoaCHAR.PCRITICAL_SECTIONPointertoaCRITICALSECTIONPCSTRPointertoaconstantnull-terminatedstringof8-bitWindows(ANSI)characters.Formoreinformation,seeCharacterSetsUsedByFonts.PCTSTRAPCWSTRifUNICODEisdefined,aPCSTRotherwise.PCWCHPointertoaconstantWCHAR.PCWSTRPointertoaconstantnull-terminatedstringof16-bitUnicodecharacters.Formoreinformation,seeCharacterSetsUsedByFonts.PDWORDPointertoaDWORD.PFLOATPointertoaFLOAT.PHANDLEPointertoaHANDLE.PHKEYPointertoanHKEY.PINTPointertoanINT.PLCIDPointertoanLCID.PLONGPointertoaLONG.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.PTBYTEPointertoaTBYTE.PTCHARPointertoaTCHAR.PTSTRPWSIRifUNICODEisdefined,aPSIRotherwise.PTBYTEPointertoaTBYTE.PTCHARPointertoaTCHAR.PTSTRAPWSTRifUNICODEisdefined,aPSTRotherwise.PUCHARPointertoaUCHAR.PUINTPointertoaUINT.PULONGPointertoaULONG.PUSHORTPointertoaUSHORT.PVOIDPointertoanytype.PWCHARPointertoaWCHAR.PWORDPointertoaWORD.PWSTRPointertoanull-terminatedstringof16-bitUnicodecharacters.Formoreinformation,seeCharacterSetsUsedByFonts.REGSAMSecurityaccessmaskforregistrykey.SC_HANDLEHandletoaservicecontrolmanagerdatabase.Formoreinformation,seeSCMHandles.SC_LOCKHandletoaservicecontrolmanagerdatabaselock.Formoreinformation,seeSCMHa

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论