DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 15 of 19
  1. #1
    Join Date
    Jan 2005
    Posts
    17

    Duplicate IDD_Dialog_xxx

    Hi, if I have a program with different menus. For example, phone book, message, Image, ect...

    If I want to make a new feature but by using the same dialog and program as the one of the menu. How do I duplicate the IDD_Dialog_xxx.. I realized by copy and paste the IDD didn't work. I have to declare the class and other stuff. I was wondering if someone can help me...

    Thank you..
    Larry Tsai

  2. #2
    Join Date
    Dec 2003
    Posts
    3,366
    you can just spawn a new instance of that class, include the .h file and do
    your_class dlg;

    dlg.domodal();

    //there are a couple of ways to do this, if you want the dialog to sieze focus (cannot get to parent until closed) or not, but the help on domodal will point the way to the others.

  3. #3
    Join Date
    Jan 2005
    Posts
    17

    What are...

    What is the Class wizard?

    For example, I have duplicated all the CPP and .H files in the source and header files.

    Now I should duplicate all the DLG. The problem I am having is I do not understand anything that is inside or the process of a DLG.

    For example what is a ClassWizard do?
    Then what is to make a Class? If I do make a class I add the CPP + H but when I want to add the Name: I can't name it as the same as the File. Why is that?
    What is a base class?
    What is a Dialog ID?

    [edit] I tried it again and what does "The Files (xxx.h, xxx.cpp) for the new class "xxxxxx" contain remnants of that class."
    what does that mean?

    Then I double click on a Tree Ctrl and it goes into my new duplicated Code with the new Variable. Why does it do that and how do I fix it.

    Then how do I set the Member Variables?

    I'm sorry I believe I need to find an online source because I am asking a lot of questions. I hope you can help me by answering these questions and maybe give me more info on what I need to know.

    Thank you very very much!!
    Last edited by mocolt; 01-24-2005 at 08:08 AM.
    Larry Tsai

  4. #4
    Join Date
    Dec 2003
    Posts
    3,366
    you can't copy and hack on the code the thing makes for you without being an expert. You are not really going about it correctly.

    To make a new window of the same type, you just need to make a variable of that class and call it with a variable_name.domodal();

    The classwizard is a tool for working with your gui stuff (it can do more as well).

    If you do not understand what a base class is, you are needing to back up and learn the language. It is a class that is inherited into a new class to extend the functionality of the old class.

    A dialog ID is a number, used internally by visual studio. every item you add has one, its basically an enum. I'm sure there is a reason for it, but I have not found one yet.

    The compiler is unhappy (remnents thingy) because you hacked on its generated code without knowing what you are doing. Don't do that (yet)

    If you double click, it will add code, you can remove it but you have to remove the related afx(?) code (in funny looking comment areas).


    Next message: a short tutorial.

  5. #5
    Join Date
    Dec 2003
    Posts
    3,366
    Ok ..
    once you have a dialog, add an edit box.

    right click on it and choose properites. you can name it here, and change a bunch of interface related stuff.

    now right click it again and choose class wizard.
    pick the second tab for member variables, and add a member variable, change it to control and give it a name.

    now add a button.
    double click the button, and the handler (onbutton1) will appear. (rename it now to a good name!) inside this function is what will happen when you click that button.

    type:
    whatever_you_named_the_edit_variable.SetWindowText("hello world, win32 style!");

    compile, run, and hit the button, and the message should pop into your edit box.

    Note how when you typed the . on the edit variable, that you can see all the class stuff. The names are pretty good too, so you can find what you need pretty fast for most controls.

    Once you get this far, you should be able to ask if you have more questions.

  6. #6
    Join Date
    Jan 2005
    Posts
    17

    following directions

    Hi Jonnin,

    thanks so much for your help. I am following your direction right now but i came to a dead end.

    When I created a new Dlg, the class name I'm trying to use says "The Class "xxxxxxx" is in use. Please choose a different class name"...
    How do I delete the old class name?

    [edit] For Adding a Member variable, can I add the same Member as the one I want to Duplicate?
    Also if they don't show up the Variable Type I need for the Member what should I do?

    [edit]I am using VC++6.0 so I was wondering when you said "see all the class stuff" is that for VC.net? Cause I actually don't see it.. However I know what you mean cause I see that when I program in VB..

    [edit] are "#if !defined(AFX_MMSTOOLBARVIEW_H__B2227A5D_EF0A_45EB_A1AF_BB1D213E185D__INCLUDED_)"

    all have their own unque ID?
    what happen if 1 of the H file has it but it doesn't have a DLG Box?



    oh I moved all the CPP & H file to another folder so it wouldn't have the same conflict..




    Am I going in the right direction?

    Thanks again.
    Last edited by mocolt; 01-24-2005 at 10:44 PM.
    Larry Tsai

  7. #7
    Join Date
    Dec 2003
    Posts
    3,366
    Do you understand c++ ? its ok if you don't, but clue me in on what you know and what you don't so I can answer better.

    It sounds like you are having trouble understanding the difference between a class and an instance.

    class foo
    {
    int x;
    };

    foo a, b; //two instances of foo, this is what you want to do with the dialog...

    but it sounds like you are trying to make 2 files, each with a class foo in it. That won't work, you can only have one thing with the same name in the same namespace.

    these # defines are called include guards, they keep you from a linker mistake where two files #include the same header, which looks like you are trying to make the same stuff more than once (same error described above). That is not the ID -- its just a random string that you are unlikely to duplicate by accident.


    the folder does not matter. The problem is elsewhere.


    sometime vc 6.0 'loses' the class members and you can't see the list until a successful compile. I use 6 at work, sadly, so I'm on the same version. Sometimes it never comes back.

  8. #8
    Join Date
    Jan 2005
    Posts
    17
    Hi Jonnin,

    Your right I'm not very good with C++... Also this is my first time working with GUI...

    I believe the whole GUI is harder than I thought, inaddition, not very easy compare to VB.

    Therefore, if you have the time and patient to teach me step by step by duplicating a GUI tell me.

    I will give you names of my files.

    SmsFormView.CPP
    SmsFormView.H

    duplicate into

    MmsFormView.CPP
    MmsFormView.H

    IDD_DIALOG_SMS_VIEWER
    duplicate into
    IDD_DIALOG_MMS_VIEWER

    I believe I got this done packed. I made a new IDD_DIALOG_MMS_VIEWER Dlg with the name of CMmsFormView and it created the cpp & h file for me. Then I copy the IDD_DIALOG_SMS_VIEWER dlg into the MMS and changed all the names that had SMS in it into MMS. Then I kepted the # defines in the MmsFormView.H but copy backed up codes from the previous MmsFormView.H into the new MmsFormView.H file. I believe that worked.


    however I did not know most Header files has an if # defines even for the one that don't have an actual Dlg such as SmsToolbarView.cpp + SmsToolbarView.H. but inside the .H file there is a # defines, what do I do?

    Thanks again!

    [edit] I have changed all the IDD, IDB, & IDR.
    Now I need to start adding all the classes into the new IDD. I have not been successful of adding at least one new one..

    I believe after I make a new Class. I open my old CPP & H file and copy/paste into the New One. From there I'm stock. I know you said I can't do that but I actually don't understand your intruction what I should do next.
    [edit]
    i realized the Gray area of my MmsFormView.CPP is the Message Maps. The issue is I try to input all the ones from SmsFormView.CPP but some can't be found through the list. So because of that I added the Gray info manually. The problem now is when I compile MmsFormView.CPP, I get these kind of errors.
    "MMSFormView.cpp(48) : error C2065: 'OnUpdateMmsFolderNew' : undeclared identifier" How do I declare it? I think I'm getting close but I know i'm still way off..

    Thanks so much for helping me.
    Last edited by mocolt; 01-25-2005 at 06:46 AM.
    Larry Tsai

  9. #9
    Join Date
    Dec 2003
    Posts
    3,366
    the gui is fairly easy, if you use the tools.

    you had something in your original code that was a button or something, called folder new, and there is no connection in the new form to anything of that name, because you have not (fully) created it. The easy way is to add a similar control to the new form, double click it, rename the handler to the old name, and it should make the connection. The hard way is to find all the references to folder new in the original code and see which piece of it you did not transfer over correctly.

  10. #10
    Join Date
    Jan 2005
    Posts
    17
    MmsEditorDlg.cpp(129) : error C2061: syntax error : identifier 'MmsMessage'

    \MmsEditorDlg.cpp(130) : error C2511: 'CMmsEditorDlg::CMmsEditorDlg' : overloaded member function 'void (const char *,const char *,int,int,class MFolder<class MMSMessage> *
    ,class MFolder<class MMSMessage> *,class MFolder<class PhoneBookItem> *)' not found in 'CMmsEditorDlg'

    \mmseditordlg.h(119) : see declaration of 'CMmsEditorDlg'

    \MmsEditorDlg.cpp(1337) : fatal error C1004: unexpected end of file found


    When I compile one of my file.. these 4 errors shows up.. How do I fix them? what do they each me?:confused:

    These 4 errors are the one that I don't really understand...
    Last edited by mocolt; 01-26-2005 at 06:49 AM.
    Larry Tsai

  11. #11
    Join Date
    Dec 2003
    Posts
    3,366
    1) you have a variable creation that is wrong or in the wrong place. Its hard to have one in the wrong place, its legal almost everywhere, so likely you have the wrong thing in parameters to the constructor?


    2) The function was found, but not with that parameter set, so your parameters are wrong. If it can't find the function, its a different error.

    3) unexpected end of file is probably caused by the above errors, if not, its likely a missing } somewhere in the file, making it seem incomplete, or a similar error.

    there are only 3 errors - the fourth is that you had errors at all. The 'see delcaration' one is part of the one before it.

  12. #12
    Join Date
    Jan 2005
    Posts
    17
    1) & 2) CMmsEditorDlg::CMmsEditorDlg(LPCTSTR strTo, LPCTSTR strMessage, int nItem, BOOL bLast, MmsFolder *pFolder, MmsFolder *pFolderOutbox, PbFolder *pFolderPb, MmsMessage *pMsg, CWnd* pParent /*=NULL*/)
    : CMmsDialog(CMmsEditorDlg::IDD, pParent)
    {
    //{{AFX_DATA_INIT(CMmsEditorDlg)
    m_nItem = nItem;
    m_bLast = bLast;
    m_strTo = strTo;
    m_strMessage = strMessage;
    m_pFolder = pFolder;
    m_pFolderOutbox = pFolderOutbox;
    m_pFolderPb = pFolderPb;
    m_pMsg = pMsg;
    //}}AFX_DATA_INIT
    }

    Does that mean inside the CDiaglog is where I created the wrong thing in the parameters?



    3) I'm going to look through the hold file to see if I was missing any } probably not so it's probably the error above

    thanks
    Larry Tsai

  13. #13
    Join Date
    Dec 2003
    Posts
    3,366
    wherever you called it, something does not match the function's arg list. example:

    member_function func(int parameter);

    .....

    z = func("oops!"); //error: no overloaded function takes type const char whatever and stuff.

  14. #14
    Join Date
    Jan 2005
    Posts
    17
    what does

    error C2664: 'MmsSetStatus' : cannot convert parameter 1 from 'eMemStatus' to 'const MMSeMemStatus'
    Conversion to enumeration type requires an explicit cast (static_cast, C-style cast or function-style cast)

    mean?

    What is a parameter?
    Larry Tsai

  15. #15
    Join Date
    Dec 2003
    Posts
    3,366
    a parameter is the thing in () 's that is fed to a subroutine.

    and its saying the same thing I have said for 3 posts:

    you cannot do things like

    int function(some_type x)
    {
    return 3;
    }


    ...
    some_other_type y;
    function ( y);

    unless there is an automatic conversion between x and y, ints and floats can be converted automatically for example.

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


Top DevX Stories

Easy Web Services with SQL Server 2005 HTTP Endpoints
JavaOne 2005: Java Platform Roadmap Focuses on Ease of Development, Sun Focuses on the "Free" in F.O.S.S.
Wed Yourself to UML with the Power of Associations
Microsoft to Add AJAX Capabilities to ASP.NET
IBM's Cloudscape Versus MySQL


Sponsored Links