Let me talk about InitCommonControlsex(让我谈谈InitCommonControlsex的用法吧!)

     Sometimes,maybe you will not want to use doModal to create a Dialog!you are gonna use another method to handle the same question.That's is good!here,I give you another method to create a Dialog for all of the XXXControl and something like that....

   Primarily,I wanna talk about InitCommonControlsex.The MFC describe it like this:

   

  InitCommonControlsEx---->Registers specific common control classes from the common control dynamic-link library (DLL).

 

Parameters
lpInitCtrls
Address of an INITCOMMONCONTROLSEX structure that contains information specifying which control classes will be registered.

return Values:    Returns TRUE if successful, or FALSE otherwise.

  Usually,we get ICC_WIN95_CLASSES to apply to our project!Pay attention to this advise:

 By the way,let me see what INITCOMMONCONTROLSEX structure is?  the MFC describe it like this:

 

typedef struct tagINITCOMMONCONTROLSEX {
    DWORD dwSize;
    DWORD dwICC;
} INITCOMMONCONTROLSEX, *LPINITCOMMONCONTROLSEX;
Members
dwSize
Size of the structure, in bytes.
dwICC
Set of bit flags that indicate which common control classes will be loaded from the DLL. This value can be a combination of the following:
ICC_ANIMATE_CLASS Load animate control class.
ICC_BAR_CLASSES Load toolbar, status bar, trackbar, and tooltip control classes.
ICC_COOL_CLASSES Load rebar control class.
ICC_DATE_CLASSES Load date and time picker control class.
ICC_HOTKEY_CLASS Load hot key control class.
ICC_INTERNET_CLASSES Load IP address class.
ICC_LISTVIEW_CLASSES Load list view and header control classes.
ICC_PAGESCROLLER_CLASS Load pager control class.
ICC_PROGRESS_CLASS Load progress bar control class.
ICC_TAB_CLASSES Load tab and tooltip control classes.
ICC_TREEVIEW_CLASSES Load tree view and tooltip control classes.
ICC_UPDOWN_CLASS Load up-down control class.
ICC_USEREX_CLASSES Load ComboBoxEx class.
ICC_WIN95_CLASSES Load animate control, header, hot key, list view, progress bar, status bar, tab, tooltip, toolbar, trackbar, tree view, and up-down control classes.

 I interpret the main part of dwICC form Engish to Chinese like this:

 

       ICC_BAR_CLASSES——注册工具栏、状态栏、Trackbar和Tooltip类。

   ICC_COOL_CLASSES——注册Rebar类。

   ICC_DATE_CLASSES——注册Date and Time Picker类。

   ICC_HOTKEY_CLASS——注册Hot Key类。

   ICC_INTERNET_CLASSES——注册IP Address Picker类。

   ICC_LISTVIEW_CLASSES——注册ListView和Header类。

   ICC_PAGESCROLLER_CLASS——注册Pager类。

   ICC_PROGRESS_CLASS——注册Progress Bar类。

   ICC_TAB_CLASSES——注册Tab和Tooltip类。

   ICC_TREEVIEW_CLASSES——注册TreeView和Tooltip类。

   ICC_UPDOWN_CLASS——注册Up-Down类。

   ICC_USEREX_CLASSES——注册ComboBoxEx类。

   ICC_WIN95_CLASSES——注册InitCommonControls函数注册的所有类。

 

   especially If you use dll to callback some datas and then show them or display them to the dialog that you have setted to be ready to receive data from local dll or romote dll data.

  If you use window xp application procedure to generate a dialog or form,but you don't want to apply to traditional(conventional) method,so please try to make use of this way that I just told you above. here,I give you a simple instance.(The next content is the core of code)

 

BOOL CXXXXApp::InitInstance()

{

     // InitCommonControlsEx() is required on Windows XP if an application
     // manifest specifies use of ComCtl32.dll version 6 or later to enable
     // visual styles.  Otherwise, any window creation will fail.

 INITCOMMONCONTROLSEX InitCtrls;
 InitCtrls.dwSize = sizeof(InitCtrls);
   // Set this to include all the common control classes you want to use
   // in your application.
 InitCtrls.dwICC = ICC_WIN95_CLASSES;
 InitCommonControlsEx(&InitCtrls);

 CWinApp::InitInstance();
.........

 

//  here,you must write off DoModal function like:

   /* SetRegistryKey(_T("Local AppWizard-Generated Applications"));

       CPriceWindowDlg dlg;
     m_pMainWnd = &dlg;
      INT_PTR nResponse = dlg.DoModal();
   if (nResponse == IDOK)
   {
      // TODO: Place code here to handle when the dialog is
     //  dismissed with OK
    }
   else if (nResponse == IDCANCEL)
   {
      // TODO: Place code here to handle when the dialog is
      //  dismissed with Cancel
 }

*/

 

return FALSE;//here, Since the dialog has been closed, return FALSE so that we exit the
                    //application, rather than start the application's message pump.

}

 

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值