Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Code for Dialog in C++

Code for Dialog in C++

Scheduled Pinned Locked Moved C / C++ / MFC
c++helpquestion
7 Posts 5 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    pcxboy
    wrote on last edited by
    #1

    Hello. Ive asked this question before. Ive read tutorials, and looked online at google. The problem is, most of this assumes that you have knowledge of MFC, and programming with CDialog. I do not. Now I will present my problem. I have an ATM Gui type project. When I run this project, a dialog window pops up that has two buttons. These buttons are "Savings" and "Checking". When the "Savings" button is clicked, the Dialog window should SWITCH to the savings Dialog Window. This should also be the same for the "Checking" button. There is already a Checking and Savings class, and an ATM class, and each of them have their own Dialog Window. I have already used ClassWizard, and read tutorials, but I require some code. Anyone with knowledge in this area, anyone at all, I am begging for help. When I use class wizard, it makes two functions: void CATM_gui1Dlg::OnChecking() { // TODO: Add extra validation here } void CATM_gui1Dlg::OnSavings() { // TODO: Add extra validation here } I Dont know what code to put in there to "invoke the other class dialog windows." That is my question, what would the code be, or the functions be, to switch to other Dialog Windows once the button is clicked? :(( Mike -- I Code Because I love to

    T M B 3 Replies Last reply
    0
    • P pcxboy

      Hello. Ive asked this question before. Ive read tutorials, and looked online at google. The problem is, most of this assumes that you have knowledge of MFC, and programming with CDialog. I do not. Now I will present my problem. I have an ATM Gui type project. When I run this project, a dialog window pops up that has two buttons. These buttons are "Savings" and "Checking". When the "Savings" button is clicked, the Dialog window should SWITCH to the savings Dialog Window. This should also be the same for the "Checking" button. There is already a Checking and Savings class, and an ATM class, and each of them have their own Dialog Window. I have already used ClassWizard, and read tutorials, but I require some code. Anyone with knowledge in this area, anyone at all, I am begging for help. When I use class wizard, it makes two functions: void CATM_gui1Dlg::OnChecking() { // TODO: Add extra validation here } void CATM_gui1Dlg::OnSavings() { // TODO: Add extra validation here } I Dont know what code to put in there to "invoke the other class dialog windows." That is my question, what would the code be, or the functions be, to switch to other Dialog Windows once the button is clicked? :(( Mike -- I Code Because I love to

      T Offline
      T Offline
      toxcct
      wrote on last edited by
      #2

      search for GetOpenFileName() and GetSaveFileName() in the MSDN.


      TOXCCT >>> GEII power

      P B 2 Replies Last reply
      0
      • T toxcct

        search for GetOpenFileName() and GetSaveFileName() in the MSDN.


        TOXCCT >>> GEII power

        P Offline
        P Offline
        pcxboy
        wrote on last edited by
        #3

        I seached in MSDN, and it told me what the functions do. Again, I am very new to all of this. What..would...the..code be so I could link the checking button to the checking dialog window, and the savings button to the savings dialog window. How would I use OpenFileName() and SaveFileName()? Mike -- I code because I love to

        T 1 Reply Last reply
        0
        • P pcxboy

          I seached in MSDN, and it told me what the functions do. Again, I am very new to all of this. What..would...the..code be so I could link the checking button to the checking dialog window, and the savings button to the savings dialog window. How would I use OpenFileName() and SaveFileName()? Mike -- I code because I love to

          T Offline
          T Offline
          toxcct
          wrote on last edited by
          #4

          void CATM_gui1Dlg::OnSavings() {
          char strDestFile[260] = "";
          OPENFILENAME file;

          // Initialisation...
          ZeroMemory(&file, sizeof(file));
          file.lStructSize     = sizeof(file);
          file.hWndOwner       = this\->m\_hWnd;
          file.lpstrFile       = strDestFile;
          file.nMaxFile        = sizeof(strDestFile);
          file.lpstrFilter     = "Text files\\0\*.TXT\\0"
                                 "All files\\0\*.\*\\0";
          file.nFilterIndex    = 0;
          file.lpstrFileTitle  = NULL;
          file.nMaxFileTitle   = 0;
          file.lpstrInitialDir = NULL;
          file.Flags           = OFN\_OVERWRITEPROMPT |
                                 OFN\_PATHMUSTEXIST;
          
          // Opens the dialog...
          if (GetSaveFileName(&file) == TRUE) {
              // Do whatever you want with the complete file
              // name and path contained into strDestFile...
          }
          

          }


          TOXCCT >>> GEII power

          1 Reply Last reply
          0
          • P pcxboy

            Hello. Ive asked this question before. Ive read tutorials, and looked online at google. The problem is, most of this assumes that you have knowledge of MFC, and programming with CDialog. I do not. Now I will present my problem. I have an ATM Gui type project. When I run this project, a dialog window pops up that has two buttons. These buttons are "Savings" and "Checking". When the "Savings" button is clicked, the Dialog window should SWITCH to the savings Dialog Window. This should also be the same for the "Checking" button. There is already a Checking and Savings class, and an ATM class, and each of them have their own Dialog Window. I have already used ClassWizard, and read tutorials, but I require some code. Anyone with knowledge in this area, anyone at all, I am begging for help. When I use class wizard, it makes two functions: void CATM_gui1Dlg::OnChecking() { // TODO: Add extra validation here } void CATM_gui1Dlg::OnSavings() { // TODO: Add extra validation here } I Dont know what code to put in there to "invoke the other class dialog windows." That is my question, what would the code be, or the functions be, to switch to other Dialog Windows once the button is clicked? :(( Mike -- I Code Because I love to

            M Offline
            M Offline
            Michael P Butler
            wrote on last edited by
            #5

            Do you want to keep the CATM_gui1Dlg window open, or do you want to replace it with the new dialog To show another dialog, you need to CSavingsDlg dlg; dlg.DoModal(); Michael CP Blog [^]

            1 Reply Last reply
            0
            • T toxcct

              search for GetOpenFileName() and GetSaveFileName() in the MSDN.


              TOXCCT >>> GEII power

              B Offline
              B Offline
              benjymous
              wrote on last edited by
              #6

              I think you're getting the wrong end of the stick - he's talking about a Savings dialog - i.e. a dialog for his ATM application that shows the user's financial savings (not a file save dialog) -- Help me! I'm turning into a grapefruit! Phoenix Paint - back from DPaint's ashes!

              1 Reply Last reply
              0
              • P pcxboy

                Hello. Ive asked this question before. Ive read tutorials, and looked online at google. The problem is, most of this assumes that you have knowledge of MFC, and programming with CDialog. I do not. Now I will present my problem. I have an ATM Gui type project. When I run this project, a dialog window pops up that has two buttons. These buttons are "Savings" and "Checking". When the "Savings" button is clicked, the Dialog window should SWITCH to the savings Dialog Window. This should also be the same for the "Checking" button. There is already a Checking and Savings class, and an ATM class, and each of them have their own Dialog Window. I have already used ClassWizard, and read tutorials, but I require some code. Anyone with knowledge in this area, anyone at all, I am begging for help. When I use class wizard, it makes two functions: void CATM_gui1Dlg::OnChecking() { // TODO: Add extra validation here } void CATM_gui1Dlg::OnSavings() { // TODO: Add extra validation here } I Dont know what code to put in there to "invoke the other class dialog windows." That is my question, what would the code be, or the functions be, to switch to other Dialog Windows once the button is clicked? :(( Mike -- I Code Because I love to

                B Offline
                B Offline
                Bob Stanneveld
                wrote on last edited by
                #7

                If the Savings and the Cheking class are derived from CDialog (which they should be...) then take a look at CDialog::DoModal(). This will show the dialog in a modal state. (Information found in MSDN) If you want the ATM window to be invisible, then call ShowWindow(SW_HIDE) before the DoModal() call.. Hope this solves your problem. :-D Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.

                1 Reply Last reply
                0
                Reply
                • Reply as topic
                Log in to reply
                • Oldest to Newest
                • Newest to Oldest
                • Most Votes


                • Login

                • Don't have an account? Register

                • Login or register to search.
                • First post
                  Last post
                0
                • Categories
                • Recent
                • Tags
                • Popular
                • World
                • Users
                • Groups