首页 MS-DOS6.0完整源代码45docsmm

MS-DOS6.0完整源代码45docsmm

举报
开通vip

MS-DOS6.0完整源代码45docsmm1¾«<žŸC:\EDITORS\C#.STYHPLASMS --SMMFeatureGuideCharacterWindowsStandardMenuManagerFeatureGuideDRAFTBryanFeirMicrosoftApplicationsDivision.c.1.IntroductionThisd...

MS-DOS6.0完整源代码45docsmm
1¾«<žŸC:\EDITORS\C#.STYHPLASMS --SMMFeatureGuideCharacterWindowsStandardMenuManagerFeatureGuideDRAFTBryanFeirMicrosoftApplicationsDivision.c.1.IntroductionThisdocumentdescribesthefeaturesofthenewStandardMenuManagerinterfacetotheCharacterWindows(CW)system.ThissystemreplacestheoldCWmenucommandswithanewAPIsimilartothatofWindowswhichisolatestheapplicationwriterfromthestructureandallowsmenustobemodifieddynamicly..c.2.GeneralFeaturesThefollowingisalistofthefeaturesoftheStandardMenuManager.PleaseseetheInterfacesectionfordetaileddescriptionofthesefeatures.DynamicmenumodificationissimplifiedMulti-linemenubarssupportedtransparentlyHierarchalandPop-upmenussupportedScrollingmenussupportedifmenuislargerthanscreenApplicationdefinabledataspacewithinitemstructureApplicationdefinablestringfunctionforfarstringsordynamicstringchangesSupportforKanaacceleratorsinDBCSMenubarnolongerhastobeontoplineofscreenPreviousmenusystemstillavailablevia#ifdef.c.3.Implementation.c.:3.1CStructuresUsedThemenusystemmakesuseoftwobasicstructurestodescribethemenutree.Theyareasfollows:typedefstruct{HMTMhmtmNext;BITSfDisabled:1BITSfChecked:1BITSfSeparator:1;BITSfString:1;BITSfHelp:1;BITSfMenuBreak:1BITSfiller:10;union{WORDsid;WORDcwString;}WORDid;HMTMhmtmSub;WORDrgwExtra[];}MTM;typedefMTM**HMTM;NOTE:thesestructuresareforinformationonly,andshouldnotbeaccessedbytheapplication.hmtmNext:nextiteminlinkedlistofitems.fDisabled:aflagwhichtellswhetherornottheitemisenabled.Iftheitemisdisabledandhasanattachedmenu,themenucanstillbepulleddown,butallitemsonitwillappeardisabled.fChecked:TRUEiftheitemhasacheckmark.fSeparator:TRUEiftheitemisamenuitemseparator.fString:TRUEiftheitemcontainsthestringwithinit.fHelp:TRUEifthemenuisaspecialhelpmenu,whichwillberightjustifiedonthemenubar.Onlyonehelpmenushouldbeonanylineofthemenubar,andthehelpmenushouldbethelastiteminthebar.fMenuBreak:TRUEifthismenuwillforcethestartofanewlineinthemenubar.Thiswaytheapplicationcancontrolthevariouslinesonthemenubar.sid:thestringIDnumberwhichissenttoSzFromSidtogetthestring;usediffStringisFALSE.Thedefaultinterpretationisthatthisvalueisanearpointertoastring.cwString:thenumberofwordstoskipbeforethestringisfound;usediffStringisTRUE.id:theitemIDnumberpassedtoWM_COMMANDmessagesandusedtolocatetheitem.hmtmSub:themenuattachedtothisitem;NULLindicatesnosubmenu.rgwExtra:extradataforusebytheapplication..c.:3.2SetupInmemory,amenuconsistsofhandletoanMTMwiththemenubartitleandIDinformation,ifwanted.ThisitemcontainsahandletoalinkedlistofMTMstructures,whicharetheitemsofthemenu.AnyoneoralloftheseMTMsmayeitherbeaterminalitem,oramenuinitself,withitsownlistofitems.Menubars,menus,hierarchalmenus,andpopupmenusarealltreatedidentically.TheonlydifferenceisthatthetopmostitemiseithersetwithInitMenu,partofamenubar,partofanothermenu,orjustfloating,respectively..c.:3.3ItemStringsAsshownabove,therearetwopossiblemethodsofstoringstrings:Initem:thestringisphysicallycopiedintothestructureafterthereservednumberofwords.ThisismarkedbyfStringTRUE.cwExtraissettothereservednumberofwordssothatthestringcanbefoundquickly.Stringid#:sidcontainsavaluewhichispassedtoSzFromSidtogetthestring.ThisisusediffStringisFALSE.TheinternalSzFromSidstubjustreturnssid,assumingitisapointertothestring.Inbothcasesthestringwillbeoftheform"Cu~t\tDel",wherethecharacterafterthetildeishilightedasthemenuaccelerator,andthecharactersafterthetabwillberight-justifiedtodesignatethekeyboardacceleratorfortheitem.InKanjiversions,theformatis"~RK/Cut\tDel".Thecharacter'K'istheKanaaccelerator,whichwillbedisplayediftheglobalfKanaAccelisTRUE;otherwise'R',theRomanaccelerator,isdisplayed..c.:3.4ItemID#'sThemenuitemID0xFFFF(idSysMenu)isreservedforsystemuse.ItisusedforVAPcommandsandothersystemwork.TheapplicationshouldneverreceiveamessageaboutamenuitemwithanIDof0xFFFF..c.4.ChangestoCWAPI.c.:4.1NewCommandsThefollowingCWAPIcallswillbeaddedforthemainapplicationtointerfacetotheSMM:.c.::4.1.1HmtmAddItemHMTMHmtmAddItem(hmtmMenu,idBefore,sid,idNew,cwExtra,wFlags)HMTMhmtmMenu;WORDidBefore;WORDsid;WORDidNew;WORDcwExtra;WORDwFlags;ThehmtmMenuparameteristhehandletothemenutobeedited.ThenewitemwillgobeforetheitemwithID#idBefore;ifidBeforeisidNil,itgoesattheend.Thevaluesofsid,idNew,andcwExtradescribethenewitem.TheyrepresentthestringID,theitemID#,andthenumberofextrawordstoallocaterespectively.ThebasicactionMF_valuesareasfollows:ThevaluestospecifythestringIDarecoveredbelow:MF_STRING-thissignifiesthatsidmustbeanearpointertoastring.Thestringwillbecopiedintotheitemhandle.MF_SID-inthiscasesidisavalueusedbytheapplicationtogetthestring.IfthefunctionSzFromSidisnotsupplied,thedefaultfunctionwillassumethatsidisapointertoastring.(default)Andtheinitialstateoftheitemcanbespecifiedwith:MF_SEPARATOR-Theitemisamenuseparator.MF_ENABLED-Theitemisenabled.(default)MF_DISABLED-Theitemisdisabledandgreyed.MF_UNCHECKED-Theitemisunchecked.(default)MF_CHECKED-Theitemhasacheckmark.MF_HELP-Themenuwillberightjustifiedonthemenubar.MF_MENUBREAK-Themenuwillbeatthestartofanewrowonthemenubar..c.::4.1.2DeleteItemVOIDDeleteItem(hmtmMenu,id)HMTMhmtmMenu;WORDid;Thiscommandtakesanitemanddeletesit.Iftheitemisamenu,themenuwillnotbedeleted;atpresent,allitemsmustbedeletedindividually..c.::4.1.3OpenPopupMenuVOIDOpenPopupMenu(hmtmMenu,axLeft,ayTop)HMTMhmtmMenu;AXaxLeft;AYayTop;ThisroutinetakesthemenuspecifiedbyhmtmMenuandputsituponthescreen.Thesystemwillattempttodrawthemenuwiththetopleftcornerat(axLeft,ayTop).Ifthiswouldcausethemenutofallofftherightsideofthescreen,thenthemenuisplacedflushtotherightside..c.::4.1.4CchGetMenuStringWORDCchGetMenuString(id,pch,cchMac)WORDid;CHAR*pch;WORDcchMac;(NYI)ThisfunctionwillcopyuptocchMaxbytesfromthestringinitemidtothebufferpointedtobypchString.Thenumberofcharactersactuallycopiedisreturnedbythefunction..c.::4.1.5HmtmFindExternIdHMTMHmtmFindExternId(hmtm,id)HMTMhmtmMenubar;WORDid;ThisextensionofthestandardHmtmFindIdwillsearchforitemsnotinthepresentmenubar.Itwilldoarecursivesearchofallsubmenusofhmtm.Thisallowsmodificationofitemsinpopupmenus..c.::4.1.6HmtmFindFlatIdHMTMHmtmFindFlatId(hmtmMenubar,id)HMTMhmtmMenubar;WORDid;ThisversionofthestandardHmtmFindIdwillsearchforitemsonlyinhmtmMenubar,andnotinanyofitssubmenus..c.:4.2ModifiedCommandsThefollowingcommandsaredirectreplacementsofsomeofthecommandsintheoldAPI..c.::4.2.1InitMenubarVOIDInitMenubar(pwnd,hmtm,parc,daxSpace)PWNDpwnd;HMTMhmtm;PARCparc;WORDdaxSpace;InitMenubarreplacestheoldInitMenucommand,withaddedfunctionality.Thepwndisthesameasbefore,thehmtmisnowahandletothemenubar,theparccontainstherectangleinwhichthemenubaristobedrawn,anddaxSpacecontainsanumber(0to3)whichrepresentsthenumberofspacesbetweenitemsonthebar.Onreturnfromthefunction,parcismodifiedtocontaintherealrectanglethemenubarfills.Thisistogivetheapplicationknowledgeabouthowmaylinesthebartakesup..c.::4.2.2HmtmFindIdHMTMHmtmFindId(id)WORDid;HmtmFindIdreplacestheoldFindMenuItem,andisalmostidenticaltoitinfunction.However,HmtmFindIdcouldreturnamenuID#aswellasanitemID#..c.:4.3ApplicationSuppliedProcedures.c.::4.3.1SzFromSidCHAR*SzFromSid(sid)WORDsid;ThisfunctionissuppliedbytheapplicationifitwantsspecialtreatmentforStringID's.NormallytheSIDisinterpretedasanearpointertoazero-terminatedcharacterstring.Iftheapplicationsuppliesthiscommand,itwillbepassedsidforeveryDrawItemcommand,andshouldreturnapointertoazero-terminatedstringwhichwillbedrawninthemenuitem.(Optional).c.::4.3.2QuickHelpSzVOIDQuickHelpSz(sz)CHAR*sz;Thisfunctionisusedtoimplementthesingle-linehelpfeatureforsystemmenuitems.IfaitemwithidSysMenuishilited,insteadoftheWM_MENUCOMMANDmessagecomingup,thiscommandwillbecalledwithapointertothetexttobeplacedonthestatusline..c.5.AcceleratorTablesSincekeyboardacceleratorsarenolongerpartofthemenubar,theymustbesetupseparately.Twocommandshavebeenaddedtodothis.Also,aminorchangeintheformathasbeenmadetotheacceleratortable.Thefirstvalueisnowadummyvaluewhichcontainstwopiecesofdata:thevkeyvaluecontainsahashvalueequaltothenegationofalltheothervkey'sinthelistORedtogether,andtheidItemisinterpretedasahandletoanotheracceleratortableinalinkedlist.Anulllinkistheendofthelist.Thevkeyvalueisusedtoquicklydeterminewhetherthetableinquestioncouldpossiblycontainthekey.BothofthesepiecesofdataarecalculatedbyAddAccelTable..c.:5.1AddAccelTableVOIDAddAccelTable(prgmpvkeyid)MPVKEYID**prgmpvkeyid;Thiswilladdanewacceleratortabletothebeginningofthepresentlist.Thefirstentryismodifiedtocontainthehashedvkeyandthehandletothetablethatwasinthefront.Note:sincethenewtableisaddedtothefront,themostrecentlyaddedtablestakeprecedenceovertheolderones.IfprgmpvkeyidisNULL,thiswillbeignored..c.:5.2DeleteAccelTableVOIDDeleteAccelTable(prgmpvkeyid)MPVKEYID**prgmpvkeyid;Thisremovesatablefromthelist.Thehandleisnotdeallocated,itisjustdisconnectedfromthelist.Anyinvalidvalueisignored.z.c.6.ChangestoWndProcsIntheWM_INITMENUPOPUP,WM_COMMAND,andWM_MENUSELECT,intheLOWORD(lParam)value,anypointertoamenuitemormenuisreplacedwiththehandletotheitem.ThisreplacementalsooccursintheHelpcommand..c.7.MenuCreationExampleTocreatethefollowingmenus:FileEditTextNewUndo*HiliteOpen...-------Color:BlackSaveCutBlueSaveAs...CopyGreen----------PasteCyanExitEraseRedAboutDemo...MagentaYellow*WhiteThefollowingsetofcommandsshouldbeused:HMTMHmtmAddItem(hmtmMenu,wId,sid,wIdNew,cwExtra,wFlags)hmtmMenubar=HmtmAddItem(NULL,NULL,NULL,midMenubar,0,MF_ENABLED);hmtmFileMenu=HmtmAddItem(hmtmMenubar,NULL,"~File",midFile,0,MF_ENABLED);HmtmAddItem(hmtmFileMenu,NULL,"~New",midNew,0,MF_ENABLED);HmtmAddItem(hmtmFileMenu,NULL,"~Open...",midOpen,0,MF_DISABLED);HmtmAddItem(hmtmFileMenu,NULL,"~Save",midSave,0,MF_DISABLED);HmtmAddItem(hmtmFileMenu,NULL,"Save~As...",midSaveAs,0,MF_DISABLED);HmtmAddItem(hmtmFileMenu,NULL,NULL,0,0,MF_SEPARATOR);HmtmAddItem(hmtmFileMenu,NULL,"E~xit",midExit,0,MF_ENABLED);HmtmAddItem(hmtmFileMenu,NULL,"A~boutDemo...",midNew,0,MF_ENABLED);hmtmEditMenu=HmtmAddItem(hmtmMenubar,NULL,"~Edit",midEdit,0,MF_DISABLED);HmtmAddItem(hmtmEditMenu,NULL,"~Undo",midUndo,0,MF_DISABLED);HmtmAddItem(hmtmEditMenu,NULL,NULL,0,0,MF_SEPARATOR);HmtmAddItem(hmtmEditMenu,NULL,"~Cut",midCut,0,MF_DISABLED);HmtmAddItem(hmtmEditMenu,NULL,"C~opy",midCopy,0,MF_DISABLED);HmtmAddItem(hmtmEditMenu,NULL,"~Paste",midPaste,0,MF_ENABLED);HmtmAddItem(hmtmEditMenu,NULL,"~Erase",midErase,0,MF_DISABLED);hmtmTextMenu=HmtmAddItem(hmtmMenubar,NULL,"~Text",midText,0,MF_ENABLED);HmtmAddItem(hmtmTextMenu,NULL,"~Hilite",midHilite,0,MF_ENABLED|MF_CHECKED);hmtmColorMenu=HmtmAddItem(hmtmTextMenu,NULL,"~Color",midColor,0,MF_ENABLED);HmtmAddItem(hmtmColorMenu,NULL,"~Black",midBlack,0,MF_ENABLED);HmtmAddItem(hmtmColorMenu,NULL,"Bl~ue",midBlue,0,MF_ENABLED);HmtmAddItem(hmtmColorMenu,NULL,"~Green",midGreen,0,MF_ENABLED);HmtmAddItem(hmtmColorMenu,NULL,"~Cyan",midCyan,0,MF_ENABLED);HmtmAddItem(hmtmColorMenu,NULL,"~Red",midRed,0,MF_ENABLED);HmtmAddItem(hmtmColorMenu,NULL,"~Magenta",midMagenta,0,MF_ENABLED);HmtmAddItem(hmtmColorMenu,NULL,"~Yellow",midYellow,0,MF_ENABLED);HmtmAddItem(hmtmColorMenu,NULL,"~White",midWhite,0,MF_ENABLED|MF_CHECKED);arcMenubar.axLeft=arcWindow.axLeft+1;arcMenubar.ayTop=arcWindow.ayTop+1;arcMenubar.axRight=arcWindow.axRight-1;arcMenubar.ayBottom=arcWindow.ayTop+2;InitMenu(pwndMain,hmtmMenubar,&arcMenubar,2);NotethatunlikeWindows,thissystemisbuiltfromthetopdown:themenubarfirst,thenthemenus,thentheitemsonthemenus.Also,iftheapplicationusestheoldwParamUservariable,thenthecwExtravalue(0inthisexample)shouldbesetto1togiveonewordoffreespace.Thatwordmustbesetbytheapplication..c.8.ProposedExtensionstoMenuManagerThefollowingadditionswillpossiblybeinafutureversionofthemenumanager,buthavenotyetbeenwrittenintothecode:Multi-columnmenus,usingMF_MENUBREAKtogobetweencolumns.Properlyhandledmouseactioninscrollingmenus.Delaybeforesubmenuappearswheninmousemode.DocumentRevisionHistoryOct17/88(1.10)[BKF]FirstDraftproposalOct27/88(1.11)[BKF]Structuressimplified,menuID#'sreturned,APIsimplified,handlesforacceleratortables,Kanainfomovedintostring,andexampleadded.Nov15/88(1.12)[BKF]CleanupofAddItemdescription,additionofextensionssection,fHelpadded,fEnabledchangedtofDisabled.Dec16/88(1.20)[BKF]Hungariannamesfixed,moreparametersforInitMenu[bar],fSubMenuremoved,scrollingmenusadded.TableOfContents.BeginTableC.Introduction1GeneralFeatures1Implementation2CStructuresUsed2Setup3ItemStrings3ItemID#'s3ChangestoCWAPI3NewCommands3HmtmAddItem3DeleteItem4OpenPopupMenu4CchGetMenuString4HmtmFindExternId5HmtmFindFlatId5ModifiedCommands5InitMenubar5HmtmFindId5ApplicationSuppliedProcedures6SzFromSid6QuickHelpSz6AcceleratorTables6AddAccelTable6DeleteAccelTable6ChangestoWndProcs7MenuCreationExample7ProposedExtensionstoMenuManager8.EndTableC.twouldsettheprojectbackabit,recreatingtheworkalreadydone,itwouldbuyAdamsthetimeheneeded.€ƒÿÿ„vœÿÿqêÿÿmhÿÿfUÿÿXdÞÿÿábôÿÿø`gÿÿ@@@@@gjy{ÿÿwãÿÿëusqÒoÔÿÿÜmki9g@escxaxCyMwÝuàsqo-m/kŽi–gØeßcêaì_=]x=Dy‚wŠu±s´ÿÿ¸qÃoÞmâkôi«g²eºcÁa_x"yGwPuus|q•ožm±k´iTg^ec¡a±ÿÿÊ_xÊÓy}w€u–ÿÿšsÿÿqÿÿ%o0m¶ÿÿ¾ki(g-e5c59y>wYucÿÿfshqmosmzkÍi%ÿÿg‚eñcôa5cô<yEw}u€sZq_ovÿÿ€m¨k>ÿÿCi]ÿÿjgÒÿÿÚeÇcÇÉÿÿÎyëÿÿûwüuTÿÿZsyÿÿ{q˜ÿÿ¡oëÿÿðmÿÿkicÿÿcmyÒwÖusÿÿq,ÿÿ:o;m…ÿÿk®i¹gÚeÜÿÿàccàOÿÿTylÿÿwwÅuÐsâqêomk3i7g\e`c¡aàcc¡©y#w'u·s¼qÓÿÿÝoÞmìÿÿök!ÿÿ!iK!ÿÿU!g‡!ÿÿ‹!ec‹!°!yµ!wÆ!uÌ!sÕ!qÙ"oÜ"mc#kh#i{#ÿÿ€#g‹#e$c$a¢$_‹!e¢$¥$y¼$wÞ%uâ%s&&q*&oP&mV&kË&iÏ&ga'en'cq'au'_ˆ']‹!ˆ''yš'w@(uD(sò(qý(o)m")k8)i=)gM)eÿ)c*a*_a*]‹!a*g*yð*wó*u+ÿÿ-+s.+q4+o5+m;+k<+iA+gB+eG+cH+aO+_‹!O+P+yV+wW+uk+sl+qr+ot+my+kz+i€+g+eŠ+c‹+a’+_“+]‹!“+š+y›+w¡+u£+sµ+q¶+o¾+mÀ+kÄ+iÅ+gË+eÌ+cÔ+aÖ+_Ú+]‹!Ú+Û+yì+wî+uü+sþ+q,o,mG,kR,i,ÿÿ‚5gŒ5e 5c§5a!6_‹!!6$6yL6ÿÿp7wy9ÿÿŠ9r<ÿÿ<mG,kR,i,ÿÿ‚5gŒ5e 5c§5a!6_‹!@€@€€ˆYŸ7Þ53!.˜)<m=€±A?!H$ð p`'!H$ð €`'˜Uvmql-g\g…gÀgúgMgvg«gÞgôb]`'!H$³±E€=€±=€svmq‚qãlgÔgg9gsgCgÝgŽgêg=g‚g´g±E€=€W€=€´ÃvÞqôl8gbßbÑ]]±X}S–N¬Iê³±=€³=€E€=€³=€³¬vq²l%g]gÙb¦bà]X?XqX¤XÏXX=€E€=€E€=€W€µ=€Zvqq¨l>gXb©]ÉXæS/N6IëD¤=€a€W€µ=€W€µ=€W€µE€ëvDql'ghbÜ]÷XOSgNÅI·D¤=€W€µ=€³=€W€µ=€W€µ·Îvìq‡!l°!gÆ!bæ!]c#X{#S›#N¢$I¼$D¤±=€W€µ=€W€µ³=€W€µ¼$q'vˆ'qÁ'l)g8)bt)]ÿ)X*Sð*N+I-+D¤=€±=€±=€W€³=€W€³=€-+,vB,q,qÊ,l-lö.lH/lÔ0l%1lË1lý3l§4lÙ4l!6gL6b€W€±=€W€=€W€L6Ì6v7q>7qp7qŒ7l»7gb8gè8ge9gf9by9]Š9ÿÿÙ4l!6gL6b€?€=€U€?€E€=€Š99a´9aÉ9aâ9Gï9G:G:Gè8ge9gf9by9]Š9ÿÀ€ûðÀ!€€ûðÀ!:-:aA:GV:-j:-:-›:-µ:-è8€ûðÀ!À€ûðÀ!€€ûðÀ!µ:Í:aæ:Gû:-;-:-›:-µ:-è8€ûðÀ!À€ûðÀ!€ûðÀ!;6;aI;G^;Gw;-:-›:-µ:-è8€€ûðÀ!€ûðÀ!À€ûðÀ!w;Œ;a¤;a¾;GÚ;G<G<ÿÿ<ÿÿè8€€ûðÀ!€€ûðÀ!À€ûðÀ!æ8ÿÿÿÿ”;ÿÿÿÿ^2¯!)K1ñ6æ8,016EMU]NewStandardMenuManagerBKFMenuStillvolatile1.02.0012/16/8810/18/88“;
本文档为【MS-DOS6.0完整源代码45docsmm】,请使用软件OFFICE或WPS软件打开。作品中的文字与图均可以修改和编辑, 图片更改请在作品中右键图片并更换,文字修改请直接点击文字进行修改,也可以新增和删除文档中的内容。
该文档来自用户分享,如有侵权行为请发邮件ishare@vip.sina.com联系网站客服,我们会及时删除。
[版权声明] 本站所有资料为用户分享产生,若发现您的权利被侵害,请联系客服邮件isharekefu@iask.cn,我们尽快处理。
本作品所展示的图片、画像、字体、音乐的版权可能需版权方额外授权,请谨慎使用。
网站提供的党政主题相关内容(国旗、国徽、党徽..)目的在于配合国家政策宣传,仅限个人学习分享使用,禁止用于任何广告和商用目的。
下载需要: 免费 已有0 人下载
最新资料
资料动态
专题动态
is_402718
暂无简介~
格式:doc
大小:20KB
软件:Word
页数:0
分类:互联网
上传时间:2018-09-04
浏览量:5