Problem with form project

Hi,
Further to this thread
http://www.experts-exchange.com/Programming/Languages/CPP/Q_28629782.html#a40677458

I want to retrieve the details of one of the files, like
https://dl.dropboxusercontent.com/u/40211031/flname_1.idx

on the form. As C++ is not supposed to handle Windows form, should I use C# instead, to do this? Is there any similar example, that is doing the similar thing?
LVL 11
HuaMin ChenSystem AnalystAsked:
Who is Participating?
 
sarabandeCommented:
did you achieve to creating the binaryfile.h and binaryfile.cpp and adding both files to MFCApplication project such that it still compiles and builds?

that would be 1st step.

Next step is to edit the dialog form that was generated by the wizard:

you may add radio buttons for
 
index number
 
index name
 
record structure

by those the User may chose which kind of binary data they would like to look for. name the id's of the 3 radio buttons IDC_RAD_NUMBER, IDC_RAD_NAME, IDC_RAD_RECORD. the idc numbers will be stored in resource.h. make sure that the 3 numbers are contiguous (what is automatical the case if you define them straight one after the other.

right-click on the top radio button and add an int member variable m_rad_selected. this member will be 0 if the User selected the top radio button, it will be 1 for the middle one, and 2 for the last one.

then add a static control with text "Path to File". Then an edit control long enough to take a path to the file. right-click and add a CString member variable for the edit control.

add a further pair of static prompt "Key to Lookup"and edit control to take the key. again add a CString member variable m_key which would take the key. the key is a number in case of number index, a name in case of name index and either name or number in case of record structure.

finally add a push button "Lookup" to the form. right-click and add an event handler for BN_CLICKED event. you were directed to generated function in your dialog class. Here you add UpdateData(TRUE); to the handler function what would fill the members you defined for the radio buttons and edit fields with the values the User had entered in the screen.

if that works we could add code to read from binary files using the functions from binaryfile.h and binaryfile.cpp.

Sara
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
>>As C++ is not supposed to handle Windows form

C++.net does work with Windows Forms.  (Not quite the same as classical, unmanaged, C++ which I guess is what you are thinking of).
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Yes, is there any example of C# codes, doing the similar like what I mentioned? Thanks.
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

 
HuaMin ChenSystem AnalystAuthor Commented:
Any other help?
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
I don't actually know what you want to do, it isn't clear here or in the link you posted.
If you have a C++ example why isn't that good enough for you?  You could try to use the code in a win form app with C++.net OR put the C++ code into a dll which you call from a C# win form app if you would prefer.
0
 
HuaMin ChenSystem AnalystAuthor Commented:
I mean one other example/notes to retrieve records from the relevant binary file.
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Did you open and see the binary file, I mentioned in above? Thanks
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
I don't actually know what you want to do, it isn't clear here or in the link you posted.

>>Did you open and see the binary file, I mentioned in above? Thanks
No, what application is it supposed to be opened with ?


ps.  If you have an example I really don't see what your problem is.  You can either use the code directly in your app or indirectly by wrapping it in a dll that your app calls.
0
 
HuaMin ChenSystem AnalystAuthor Commented:
I need the way to retrieve records from the given binary file. This is what I expect to have.
0
 
sarabandeCommented:
the file flnames_1.idx contains records of the following structure:

struct index_name
{
    char name[21];
    unsigned int recnum;
};

Open in new window


depending on whether the structure is packed or not, one record has a size of 25 or 28 bytes.

you can access the file by code like

bool getrecord(std::ifstream & file, unsigned int rec, index_name & index)
{
       long long pos = rec;
       pos *= sizeof(index_name);
       if (!file.seekg(pos))
       {
             std::cout << "error seekg at " << pos << "  last error " << errno << std::endl;
             return false;
       }
       if (!file.read((char*)&index, sizeof(index_name))
       {
             std::cout << "error read at " << pos << "  last error " << errno << std::endl;
             return false;
       }
       return true;
}

the records of the index files are sorted by name. because of that it is also possible to have an access by name by means of a binary search (there is already a program readbinaryfile which worked).

As C++ is not supposed to handle Windows form, should I use C# instead
beside of windows form, it is also possible to use an mfc application which might be easier.

if that is an option you may create a new project of type mfc application and make it of type dialog-based. then you could edit the form created by the wizard to contain a prompt + edit field for the file (path), and a prompt + edit field for the record number to search for. finally add two read-only edit fields for the index members and a button 'retrieve record'.

add a handler for button click, read path and record number from screen, then open the file and call above function to retrieve the record. if found you put the members to output fields.

Sara
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Many thanks Sara.
I want to read/retrieve all details from binary file and then display them record by record on the Windows form. How to call one mfc Application, from one C# Form project?
0
 
sarabandeCommented:
How to call one mfc Application, from one C# Form project?
that doesn't make sense. mfc (Microsoft foundation classes) is an alternative to windows form in c++. it doesn't need .net what is an advantage if you don't have much experience with gui programming. it is an disadvantage if you already made form programs with c#  or vb. in either case it is the fastest way for the task to read from binary files and show the records, since you can use many of the current structures and code directly without porting it to a new language.

Sara
0
 
AndyAinscowFreelance programmer / ConsultantCommented:
Your second comment in this question implied you have an example of doing what you want in C++.

Do you have a C++ example that does what you want?

If yes then what exactly is your problem?
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Many thanks Sara.
that doesn't make sense. mfc (Microsoft foundation classes) is an alternative to windows form in c++

Is it to call "ReadBinaryFile" within one .mfc project? Any example/demonstration to that?
0
 
sarabandeCommented:
- create a new project of type mfc application
   - make it of type dialog-based.
   - the wizard would show an empty form which you can edit
   - edit the form to contain
      - a prompt + edit field for the file (path),
      - a prompt + edit field for the record number to search for.
      - two read-only edit fields for the index members 'Name' and 'RecNum'
      - a button 'Retrieve Record'.
   - right-click at the edit field for file path and add a CString member variable by wizard
   - right-click at the edit field for record number and add a int member variable by wizard
   - right-click at the read-only edit field for name and add a CString member variable
   - right-click at the read-only edit field for recnum and add a int member variable
   - right-click at the button and add a handler for button click,
       - implement the handler of button-click
            - call UpdateData(TRUE); // gets data from screen to members
            - open the file and call function to retrieve the record (see code above)
            - if record found assign record members to corresponding dialog members
                - call UpdateData(FALSE);  // puts data from dialog to screen (shows record data)

Sara
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Many thanks. Which is the form below?
6a
0
 
sarabandeCommented:
you created an mdi mfc project (multi document interface). you should have created a dialog-based mfc project.

for an mdi project you have a view class CMfcAppView which currently is derived from CView. for your purposes you have to derive it from CFormView which would use a dialog resource same as a dialog-based mfc application. so you could add a dialog form to your project by using the resource editor. then change class CMfcAppView that it is derived from CFormView and not from CView (changes have to be made both in mfcappview.h and mfcappview.cpp where CView was exchanged by CFormView for any occasion). then you need to change the constructor of the CMfcAppView that it passes the IDD resource id to the CFormView.

an easier way is to create a further mfc application named ShowBinaryFile and make it dialog-based (what is one of the first decisions you have to take when using the wizard to generate the project).

Sara
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Many thanks. Is ChildFrm CFormView or not? If not, which is CFormView below?
Fig 10
0
 
sarabandeCommented:
your view class is CMfcAppView.

your frame class (that is the outer frame with menu and toolbar buttons) is CMainFrame as long as there is no document opened. it changes to CChildFrm after a document was loaded (opened) or a new document was created and a view was shown where you can edit the document. note, as long as the view class is not derived from CFormView you will not be able to bind the view to a form. the view would only show an empty window.

generally, an MDI application has an application class derived from CWinApp, a main frame class (linked to resource id IDR_MAINFRAME), and for each document type supported at least one triple of a document class derived from CDocument, a frame class derived from CMDIChildWnd, and a view class derived from CView (or CScrollView or CFormView, more ...). you could add more views by defining another triple for the same document class and the same frame class. this normally was done in the application class (mfcapp.cpp) in the Init_Instance member function. if you look into the code you will see a CMDIDocTemplate class used which is a helper for to creating such a triple of document, frame and view.

note, an MDI application is a framework for a rather big application with menus, toolbars, many docked windows, different models. visual studio is a sample of an mdi application. if you only need a form where you can input a path and a record number to lookup for a record in a binary file, an MDI application is not only an overkill, but simply not suitable for the task.

Sara
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Many many thanks Sara.
What should I choose below to the options of the project?
14
0
 
sarabandeCommented:
use the 3. option 'dialog based'.

that creates an application containing one form controlled by one dialog class. the class object was created in CMfcApp::InitInstance and invoked by DoModal call from there.

Sara
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Many thanks Sara. Do I need to further choose the options below?
14b
And also need to select anything below?
14c
0
 
sarabandeCommented:
you may use the defaults because it doesn't make a difference for your purposes.

the main thing of the defaults is the Unicode support and the precompiled headers via stdafx.h. I personally deselect both options but the options are not crucial and may deselected later if you don't need them.

Sara
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Good day Sara,
generally, an MDI application has an application class derived from CWinApp, a main frame class (linked to resource id IDR_MAINFRAME), and for each document type supported at least one triple of a document class derived from CDocument, a frame class derived from CMDIChildWnd, and a view class derived from CView (or CScrollView or CFormView, more ...). you could add more views by defining another triple for the same document class and the same frame class. this normally was done in the application class (mfcapp.cpp) in the Init_Instance member function. if you look into the code you will see a CMDIDocTemplate class used which is a helper for to creating such a triple of document, frame and view.

Do you mean  I should start with ClassView.cpp and MFCApp.cpp? Can I have more details to the way?
0
 
sarabandeCommented:
Do you mean  I should start with ClassView.cpp and MFCApp.cpp?
as far as i know your requirements, an mdi app is an overkill. my recommendation is (and was) to create a new mfc project which is dialog-based. the framework consists only of two classes then: an application class derived from CWinApp and a dialog class derived from CDialog.

that allows you to quickly edit the default form generated with the dialog class to your needs.

Sara
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Many thanks.
Is there one example to this?
0
 
sarabandeCommented:
if you choose the dialog-based mfc application, the wizard will generate a default project with all classes and a form which you easily can enhance to your requirements. by right-clicking on the controls you can add members and event handlers with a few mouse clicks.

Sara
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Many thanks Sara.
I don't know why I cannot build the project attached.
https://dl.dropboxusercontent.com/u/40211031/MFCApplication1.zip
0
 
sarabandeCommented:
what happens when you build the project?

as far as i could see, you didn't add neither resources nor code to the generated code.

Sara
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Many thanks Sara.
The following is what I got
22
0
 
sarabandeCommented:
as far as i could find an explanation, the problem can occur if you mix-up managed and unmanaged elements in your project. if you changed some of the defaults when creating the project (for example when you added CLI or X64 to the project), you should create a new mfc project where you create just a "normal" 32-bit MFC application, dialog-based without managed code. if that doesn't help, you can try to switch off precompiled header option in the c++ properties. after you did so, the stdafx.cpp (not the stdafx.h) should be deleted from project tree.

if the problem still occurs, check your configuration. you should begin with 'Debug' but if you make some changes there (for example when removing precompiled headers) also change the 'Release'  configuration accordingly. if you currently see a configuration which is neither 'Debug' nor 'Release' but soemthing like 'Mixed Mode', then this configuration most likely is responsible for your issues. change the configuration to 'Debug' and try again.

Sara
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Many thanks Sara.
I switch off precompiled header option but still get the same problem, while I see Configuration is "Debug".
0
 
sarabandeCommented:
this kind of error sometimes appears with visual studio (all versions since more than 20 years) and has different causes.

if it cannot be solved by changing configurations or undoing last changes you should close visual studio, reboot, and try again. if it is still there, delete the whole project induding all files and folders (you may save source files .cpp, .rc, .h, .c somewhere else) and create a new project using a different name (that is important to avoid issues due to ambiguous file names). don't do any changes to the defaults before your first successful build. for example, always use mfc from dll and from static libraries.

if nothing helped, the cause probably was because of the environment or because of some installations (3rd party, sdk, ...).  you either have to go to an older version of visual studio or reinstall or use a different system if possible.

Sara
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Many thanks Sara.
I really got the same problem within both Win 2008 server and Win 2012 server. Is there any other way to achieve the original request, other than using MFC dialog based application?
0
 
sarabandeCommented:
you could try mfc SDI application and turn your view class to CFormView by using the wizard. then the dialog form can be used in that form view.

but i have doubts that this will help to avoid the issues you had.

Sara
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Many thanks Sara.
I think I should also ask MSDN C++ forum to see if this is really one bug of VS 2013 or not.
I may close this thread soon.
0
 
sarabandeCommented:
compiler crashes are almost every time due to installation or environment conflicts.

so you may try to uninstall and reinstall the visual studio on the server and do the second "as administrator".

also if you run the visual studio at the server, you should have local administrator rights such that the registry entries below HKEY_LOCAL_MACHINE can be used without restrictions. finaly, the .NET installation on the server must fit to the one needed by the visual studio installation. normally, this is guaranteed by the setup but for a server installation there may be some restrictions that could prevent from a properly working visual studio.

Sara
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Many thanks Sara.
If I've re-done the same on another Win 8.1 machine, on which I've re-setup VS 2013, I then got this
Error	1	error C2471: cannot update program database 'f:\mfcapplication1\mfcapplication1\debug\vc120.idb'	f:\mfcapplication1\mfcapplication1\stdafx.cpp	9	1	MFCApplication1
Warning	2	warning D9028: minimal rebuild failure, reverting to normal build	f:\MFCApplication1\MFCApplication1\cl	MFCApplication1

Open in new window

0
 
sarabandeCommented:
error C2471: cannot update program database 'f:\mfcapplication1\mfcapplication1\debug\vc120.idb'

this can happen if the debugger was still active or if you opened the same project twice, or if you copied whole project with debug and release folder from other machine.

you may try to delete debug and release folder, or even better, create the project again from a new project folder.

did you check whether the file f:\mfcapplication1\mfcapplication1\debug\vc120.idb exists? if yes, try to delete it. if the file is locked or read-only and you can't delete it, you may reboot and/or login as administrator.

Sara
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Many thanks Sara.

It is fine now to setup. I don't see ClassView.cpp below
2a
what should I select to "Create project wizard"?
0
 
sarabandeCommented:
classview.cpp was only in sdi and mdi mfc application. it is a 'sample' view to be 'docked' into the main frame to visualize some arbitrary data in a tree.

your current choice is one dialog form coded in MfcApplication4Dlg and started from MfcApplication4 as a modal dialog.

you may now design the dialog form and post. then we could design the access to the files and the way hot to present the results.

Sara
0
 
HuaMin ChenSystem AnalystAuthor Commented:
classview.cpp was only in sdi and mdi mfc application. it is a 'sample' view to be 'docked' into the main frame to visualize some arbitrary data in a tree.

Many thanks Sara. Is there any sample project to this?
0
 
sarabandeCommented:
actually, the default project generated by wizard for mdi and sdi, already contains a 'sample' view. that is what you started with. in the left-bottom docking area was a 'class view' to 'fake' classes. the 'view' was created in mainfrm.cpp and implemented (only dummy contents) in classview.cpp.

i told you that such a 'huge' application with so many classes and framework stuff is much more than you would be able to overlook and have a chance to adopt to your needs.

perhaps you should describe what your application should do. try to design one or more forms and think about user input and possible visualisation. if you would post these considerations we surely can give you valid advice which way to go and how to proceed.
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Many thanks Sara.
I do not see

mainfrm.cpp

to the project shown below.
6awhat to adjust to the project, as I did choose "Dialog" to the project?
0
 
sarabandeCommented:
your current project is 'dialog-based' what is the 3rd choice after 'single-document' (sdi) and 'multi-document' (mdi). both in mdi and sdi there is a main frame with menus and toolbar. below is a frame area which could be filled with one or multiple views (windows) which are related to 'all' or to a 'document'.

a dialog-based mfc application is much simpler. it consists out of an application object and a dialog object. nothing else.

can you describe what you want to do?

Sara
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Many thanks Sara.
I can see MainFrm.cpp now. Is there any sample to refer to the previous structure we have, using MFC application?
0
 
sarabandeCommented:
do you mean the record and index structures?

if yes, copy the class and struct definitions from readbinaryfile.cpp and put them into a headerfile, say binaryfile.h.

// bianaryfile.h
#ifndef BINARYFILE_H
#define BINARYFILE_H

#include <string>
#include <fstream>
#include <sstream>
#include <iostream>

enum { NUM_ITEMS = 10 };

// here copy the structures and classes
struct index_name
{
       ....
};
struct index_number
{
       ....
};
struct item
{
      ...
};
struct rec_struct
{
    ...
};
// function prototypes
int randindex(int maxrand, int off = 0);
long long createItemNumber();
void createItemName(char name[], int sizname);
std::string createItemText(int maxsize);
bool parseSearchCriteria(const std::string & strsearch,
    std::string & strname, long long & number, bool & bsearchForName);
std::string createFilename(const std::string & strprefix, const std::string & strext, int filenum = -1);
bool performBinarySearch(const std::string & strname, long long number, bool & bsearchForName, 
     unsigned int & recnum_w, std::string & strresult);

// template functions
template <class index>
bool binarySearch(const std::string & strindexprefix, const index & searchindex, std::string & strresult, index & foundindex)
{
     ...
}

#endif  // BINARYFILE_H

Open in new window


the headerfile could be included in testmfcapplication4.h and is so available from all cpp files of your mfc project.

all functions where you have prototypes in binaryfile.h need to get an implementation in a cpp file. you should create a new cpp file binaryfile.cpp by adding a 'new item' to your mfc project. the only include it needs is binaryfile.h. then copy the functions from readbinaryfile.cpp to the new file. the only thing you have to change is to remove the default values in the function arguments (if any) since the compiler complains if it has the defaults twice in h file and cpp file, for example

std::string createFilename(const std::string & strprefix, const std::string & strext, int filenum /*  = -1 */)
{
      ....
}

Open in new window


with this two files you can open binary files and do the search like you did in readbinaryfile. you can add new functions, for example to show a hex table  or to read from index files ...

Sara
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Many thanks Sara. Is it a problem to 1st line below?
8a
0
 
sarabandeCommented:
yes. should be #ifndef and be closed by a corresponding #endif

this kind of macro is called header protection. it shall prevent the header to be included a second time, what would happen for example if b.cpp includes b.h and a.h and b.h also includes a.h. by using a header protection the second inclusion would find out the a.h already was included and do nothing.

Sara
0
 
HuaMin ChenSystem AnalystAuthor Commented:
the only include it needs is binaryfile.h. then copy the functions from readbinaryfile.cpp to the new file.

Many thanks Sara.
Is it to copy all codes from readbinaryfile.cpp into the current project, other than your advice to .h file?
0
 
sarabandeCommented:
Is it to copy all codes from readbinaryfile.cpp into the current project, other than your advice to .h file?
no. because you may need to include the h file from more than one cpp file in the mfc project. if the h file contains implementations of functions, multiple inclusions from different cpp file would lead to an error since the linker would complain about duplicate 'symbols'. you could try to make the functions 'inline' or put a class around them, what also would help, but in my opinion it is not worth the efforts.

so the easiest is to use a new cpp file binaryfile.cpp and put the functions like 'createItemText' into it. the binaryfile.h only contains a "declaration" (prototype) of the function what simply is the return type, the function name and the arguments closed by a semicolon ;.  note, when adding the binaryfile.cpp to your project, you should switch off 'precompiled header' for this cpp file (right-click in the solution tree, properties, select 'all configurations', goto 'configuration properties - c/c++ - precompiled headers - 'not using precompiled headers'). alternatively add #include "stdafx.h" as first statement.

note, if you do so, you could use the two binaryfile sources for readbinaryfile and savebinarfile as well (though i wouldn't change working projects only because of this).

Sara
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Many thanks Sara.
How does BinaryFile.cpp interact with MFCApplication2.cpp, while the latter is the one being created, when creating the project?
0
 
HuaMin ChenSystem AnalystAuthor Commented:
What is the purpose of BinaryFile.cpp? Is there any example to what you've suggested?
0
 
sarabandeCommented:
How does BinaryFile.cpp interact with MFCApplication2.cpp?
i don't know. you never told me what you intend to do with the form project.

What is the purpose of BinaryFile.cpp?
it provides the structures and access functions to the files created by savebibaryfile and queried by readbinaryfile.

Sara
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Thanks Sara.

How about that I want to show the details of the records we did create most recently? Is there any example to do this?
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Good day Sara,
Can you please see this only if available? thanks a lot
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Many thanks Sara.
Sorry for that I got problem to randindex below

Error      2      error C3861: 'randindex': identifier not found      c:\mfcapplication2\mfcapplication2\binaryfile.cpp      41      1      MFCApplication2
0
 
HuaMin ChenSystem AnalystAuthor Commented:
the binaryfile.h only contains a "declaration" (prototype) of the function what simply is the return type, the function name and the arguments closed by a semicolon

Exactly, what are the details I should put into binaryfile.cpp?
0
 
sarabandeCommented:
// binaryfile.cpp
// #include "stdafx.h"  // you have to switch off precompiled header or uncomment
#include "binaryfile.h"
#include <string>
#include <fstream>
#include <sstream>
#include <iostream>
#include <iomanip>
#include <algorithm>
#include <sys/stat.h>
#include <windows.h>


// here put the implementations of the functions prototypes of binaryfile.h
int randindex(int maxrand, int off)
{
     ....
}

long long createItemNumber()
{
     ....
}

void createItemName(char name[], int sizname)
{
     ....
}
std::string createItemText(int maxsize)
{
     ....
}
bool parseSearchCriteria(const std::string & strsearch,
    std::string & strname, long long & number, bool & bsearchForName)
{
    ....
}
std::string createFilename(const std::string & strprefix, const std::string & strext, int filenum)
{
   ....
}

bool performBinarySearch(const std::string & strname, long long number, bool & bsearchForName, 
     unsigned int & recnum_w, std::string & strresult)
{
    ....
}

Open in new window


you find the code for ... in readbinaryfile or savebinaryfile.

note, the template function must be implemented in the binaryfile.h because a template function will be compiled when it was instantiated, what means when the concrete template type was determined. so the implementation code must be provided by a header file.

Sara
0
 
HuaMin ChenSystem AnalystAuthor Commented:
Many many thanks Sara.
I can compile the codes now.

you may add radio buttons for
 
index number
 
index name
 
record structure

by those the User may chose which kind of binary data they would like to look for. name the id's of the 3 radio buttons IDC_RAD_NUMBER, IDC_RAD_NAME, IDC_RAD_RECORD. the idc numbers will be stored in resource.h. make sure that the 3 numbers are contiguous (what is automatical the case if you define them straight one after the other.


Should this to use form design, and if yes, is there any example to that?
0
 
sarabandeCommented:
the wizard already created an empty form for you. you may open it by choosing tab for resource view rather than solution explorer for the left tree in visual studio. then look in dialog resources where is one for your dialog. in 'view menu' you can choose 'tool box' where all available controls can be chosen and placed into the dialog form.

Sara
0
 
sarabandeCommented:
is there any example to that?
it is rather intuitive to use. if you have chosen a control on your form you may type ALT+ENTER to get the properties window for the control. if you got problems using it you may look for a mfc tutorial or youtube sample.

Sara
0
 
HuaMin ChenSystem AnalystAuthor Commented:
the wizard already created an empty form for you. you may open it by choosing tab for resource view rather than solution explorer for the left tree in visual studio.
Many thanks Sara.

Sorry for that I do not see one empty form, within the project.
15
0
 
sarabandeCommented:
as told, you see the dialog resources in the "resource view", which is available by a tab at the bottom of "Solution Explorer" (what is the tree in the image you posted).

alternatively, you could open the 'Resource Files' in the tree of solution explorer and double-click on .rc file (what should be named MfcApplication2.rc in your case).

Sara
0
 
HuaMin ChenSystem AnalystAuthor Commented:
I can see Class View but no resource view below.
15b
0
 
sarabandeCommented:
ok. you also find it in 'view' menu. or double-click on .rc file. it should add itself to the tabs after it was started once.

i see (now) that you were not using the dialog-based mfcapplication4 but mdi framework for multiple documents and multiple views for each document. it is not impossible to add your requirements to such a huge application framework but surely we can't do it in this thread especially not as it is your first approach to mfc programming. there are so much difficulties by this. for example, you probably created a 'regular' view derived from class CView when you created the project. but you would have need to change the baseclass of your view class from CView to CFormView in order to get a dialog resource created by wizard.

Sara
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.