资源描述:
《Windows脚本编程核心技术精解Chapter04.pdf》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、4684-8ch04.f.qc3/3/009:32AMPage117Chapter4DevelopingYourOwnScriptComponentsInThisChapterGetaccustomedtothefreeVisualBasicControlCreationEditionDevelopyourownscriptextensionsusingWindowsAPIfunctionsOpenandclosetheCD-ROMtraybyscriptLookatWindowsAPIfunctionsa
2、ndDECLAREin-depthExaminefunctionsstoredinDLLfilesDevelopyourowndialogboxesDiscoverpropertiesanddesignyourownCreateoptionalparametersanddefaultvaluesChangewindowstyleMakewindowsresizableDistributeself-madeCOMobjectstoothersCOMobjectsworklikecommandextens
3、ionsandprovideallthefunctionsmissinginVBScript.Inthepreviouschapter,yousawhowusefulitistoaccessCOMobjects.YouarenotlimitedtotheCOMobjectsotherpeoplehavedeveloped.Youcandesignyourown.It’’sveryeasy,andit’sfree,too.Microsoftprovidesallthenecessarydevelopmenttools
4、,andyoucanfindthemonthecompanionCD.DevelopingyourownCOMobjectsallowsyoutoaccesseventhemostbasicWindowsApplicationProgrammingInterface(API)functions.COMobjectscandoanythinga“C”orVisualBasicprogrammercando.Inthischapter,I’llshowyouhowtodevelopyourownCOMobjects.I
5、t’seasy,becauseyoucanuseVisualBasictodevelopCOMobjects.VisualBasicisverysimilartoVBScript.Infact,VBScriptisjustasubsetofVisualBasic,soyoualreadyknowmostofwhatisneeded.4684-8ch04.f.qc3/3/009:32AMPage118118PartI:ScriptingKickstart■■COMdevelopmentisthesecondstep,
6、notthefirst.BeforeyoustartdevelopingyourownCOMobjects,browsethroughPartIIandgetfamiliarwithVBScriptandthescriptexamples.OnceyoufeelcomfortablewithVBScript,it’sonlyasmallsteptoCOMdevelopment.Youdon’tneedtobuyVisualBasicinordertodevelopCOMcomponents.Microsofthas
7、createdaspecialversionofVisualBasiccalledVisualBasicControlCreationEdition.It’safullVisualBasicdevelopmentenvironment.Microsofthasjustdisabledsomeoptionssoyoucan’tcreate“regular”programs.Youcan,however,easilycreateCOMobjects,andthat’sallyouneed.TheVBCCEisinclu
8、dedonthecompanionCD.Youjustneedtoinstallit.MicrosofthasreleasedtheVBCCEprimarilytopromotetheuseofActiveXInternetcontrols.So,theprimarytargetgroupisWebdevelopers.However,ActiveXcont