Source Code for Windows Create dialog box

Source: Internet
Author: User

Source Code for Windows Create dialog box

 Define a member variable, When calling DoModal (), the data to be added to the ComboBox is written into this member variable, and the ComboBox is initialized in OnInitDialog void Cmyview::onshow () {//Todo:add Your command handler code here CDIALOG1 dlg; Dlg. Create (IDD_DIALOG1); Dlg. ShowWindow (Sw_show); As a non-modal dialog box, the dlg you define is a local object, then the DLG is executed. ShowWindow (sw_show); At the end of the OnShow () function at the next to} symbol, the life cycle of the local object of Dlg is also destroyed, so you cannot see the dialog box display, You can change the dlg into a CMyView class member variable to define it cstring type = L ""; type. AppendFormat (L "All FILES (*%s) |*%s| |", Suffix,suffix); CFileDialog File_dlg (true,null,null,ofn_hidereadonly| Ofn_overwriteprompt,type,afxgetmainwnd ()); CString current_file = L ""; if (File_dlg. DoModal () = = IDOK) {current_file = File_dlg. GetPathName (); if (! ( Current_file. Right (strlen (SUFFIX)) ==suffix) {Current_file+=suffix;} CFile file (current_file,cfile::moderead);//int bufferlength = file. GetLength ();//char *buffer = (char *) malloc (bufferlength);//file. Read (buffer,bufferlength);//file. Close ();} 


Source Code for Windows Create dialog box

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.