资源描述:
《whcbt回调函数》由会员上传分享,免费在线阅读,更多相关内容在应用文档-天天文库。
1、CBTProcCallbackFunctionAnapplication-definedorlibrary-definedcallbackfunctionusedwiththeSetWindowsHookExfunction.Thesystemcallsthisfunctionbeforeactivating,creating,destroying,minimizing,maximizing,moving,orsizingawindow;beforecompletingasystemcommand;beforeremov
2、ingamouseorkeyboardeventfromthesystemmessagequeue;beforesettingthekeyboardfocus;orbeforesynchronizingwiththesystemmessagequeue.Acomputer-basedtraining(CBT)applicationusesthishookproceduretoreceiveusefulnotificationsfromthesystem.TheHOOKPROCtypedefinesapointertoth
3、iscallbackfunction.CBTProcisaplaceholderfortheapplication-definedorlibrary-definedfunctionname.Syntax复制LRESULTCALLBACKCBTProc(__in intnCode,__in WPARAMwParam,__in LPARAMlParam);ParametersnCode[in]Type:intThecodethatthehookprocedureusestodeterminehowtoprocessth
4、emessage.IfnCodeislessthanzero,thehookproceduremustpassthemessagetotheCallNextHookExfunctionwithoutfurtherprocessingandshouldreturnthevaluereturnedbyCallNextHookEx.Thisparametercanbeoneofthefollowingvalues.ValueMeaningHCBT_ACTIVATE5Thesystemisabouttoactivateawind
5、ow.HCBT_CLICKSKIPPED6Thesystemhasremovedamousemessagefromthesystemmessagequeue.Uponreceivingthishookcode,aCBTapplicationmustinstallaWH_JOURNALPLAYBACKhookprocedureinresponsetothemousemessage.HCBT_CREATEWNDAwindowisabouttobecreated.Thesystemcallsthehookprocedure3b
6、eforesendingtheWM_CREATEorWM_NCCREATEmessagetothewindow.Ifthehookprocedurereturnsanonzerovalue,thesystemdestroysthewindow;theCreateWindowfunctionreturnsNULL,buttheWM_DESTROYmessageisnotsenttothewindow.Ifthehookprocedurereturnszero,thewindowiscreatednormally.Atthe
7、timeoftheHCBT_CREATEWNDnotification,thewindowhasbeencreated,butitsfinalsizeandpositionmaynothavebeendeterminedanditsparentwindowmaynothavebeenestablished.Itispossibletosendmessagestothenewlycreatedwindow,althoughithasnotyetreceivedWM_NCCREATEorWM_CREATEmessages.I
8、tisalsopossibletochangethepositioninthez-orderofthenewlycreatedwindowbymodifyingthehwndInsertAftermemberoftheCBT_CREATEWNDstructure.HCBT_DESTROYWND4Awindowisab