dialogboxparamdialogboxparam
DialogBoxParam
TheDialogBoxParamfunctioncreatesamodaldialogboxfromadialogboxtemplateresource.Beforedisplayingthedialogbox,thefunctionpassesanapplication-definedvaluetothedialogboxprocedureasthelParamparameteroftheWM_INITDIALOGmessage.Anapplicationcanusethisvaluetoinitializedialogboxcontrols.
INT_PTRDialogBoxParam(
HINSTANCEhInstance,//handletomodule
LPCTSTRlpTemplateName,//dialogboxtemplate
HWNDhWndParent,//handletoownerwindow
DLGPROClpDialogFunc,//dialogboxprocedure
LPARAMdwInitParam//initializationvalue
);
Parameters
hInstance
[in]Handletothemodulewhoseexecutablefilecontainsthedialogboxtemplate.
lpTemplateName
[in]Specifiesthedialogboxtemplate.Thisparameteriseitherthepointertoanull-terminatedcharacterstringthatspecifiesthenameofthedialogboxtemplateoranintegervaluethatspecifiestheresourceidentifierofthedialogboxtemplate.Iftheparameterspecifiesaresourceidentifier,itshigh-orderwordmustbezeroanditslow-orderwordmustcontaintheidentifier.YoucanusetheMAKEINTRESOURCEmacrotocreatethisvalue.
hWndParent
[in]Handletothewindowthatownsthedialogbox.
lpDialogFunc
[in]Pointertothedialogboxprocedure.Formoreinformationaboutthedialogboxprocedure,seeDialogProc.
dwInitParam
[in]SpecifiesthevaluetopasstothedialogboxinthelParamparameteroftheWM_INITDIALOGmessage.
ReturnValues
Ifthefunctionsucceeds,thereturnvalueisthevalueofthenResultparameterspecifiedinthecalltotheEndDialogfunctionusedtoterminatethedialogbox.
IfthefunctionfailsbecausethehWndParentparameterisinvalid,thereturnvalueiszero.ThefunctionreturnszerointhiscaseforcompatibilitywithpreviousversionsofWindows.Ifthefunctionfailsforanyotherreason,thereturnvalueis–1.Togetextendederrorinformation,callGetLastError.
Remarks
TheDialogBoxParamfunctionusestheCreateWindowExfunctiontocreatethedialogbox.DialogBoxParamthensendsaWM_INITDIALOGmessage(andaWM_SETFONTmessageifthetemplatespecifiestheDS_SETFONTorDS_SHELLFONTstyle)tothedialogboxprocedure.Thefunctiondisplaysthedialogbox(regardlessofwhetherthetemplatespecifiestheWS_VISIBLEstyle),disablestheownerwindow,andstartsitsownmessagelooptoretrieveanddispatchmessagesforthedialogbox.
WhenthedialogboxprocedurecallstheEndDialogfunction,DialogBoxParamdestroysthedialogbox,endsthemessageloop,enablestheownerwindow(ifpreviouslyenabled),andreturnsthenResultparameterspecifiedbythedialogboxprocedurewhenitcalledEndDialog.
Windows95/98:Thesystemcansupportamaximumof255controlsperdialogboxtemplate.Toplacemorethan255controlsinadialogbox,createthecontrolsintheWM_INITDIALOGmessagehandlerratherthanplacingtheminthetemplate.
本文来自电脑杂谈,转载请注明本文网址:
http://www.pc-fly.com/a/jisuanjixue/article-33495-1.html
请你永远做千纸鹤心里完美的小王子#1128迈全员加速中#
我们的原则是不惹事人怕事
或许会误射