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
CODE PROJECT For Those Who Code
  • Home
  • Articles
  • FAQ
Community
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. Need help communicating with MFC dialog boxes (domodal) [modified]

Need help communicating with MFC dialog boxes (domodal) [modified]

Scheduled Pinned Locked Moved C / C++ / MFC
8 Posts 3 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.
  • C Offline
    C Offline
    CoffeeAddict19
    wrote on last edited by
    #1

    Basically what I am trying to do is have two text strings pop in text boxes (CEdit) for the user when they open a dialog box. The problem is that when you call domodal, all control transfers to the dialog box, so everything has to be done before the call. In the past I have just set a flag in the dialog box class to let it know that something needs to be loaded, and placed the information there beforehand, and then called domodal. OnInitDialog gets called when the dialog pops up, checks for the flag, and loads whatever. It seems kind of messy though. Is there another more elegant way to do it? Is there some way I can modify DoModal to accept arguments?

    T 1 Reply Last reply
    0
    • C CoffeeAddict19

      Basically what I am trying to do is have two text strings pop in text boxes (CEdit) for the user when they open a dialog box. The problem is that when you call domodal, all control transfers to the dialog box, so everything has to be done before the call. In the past I have just set a flag in the dialog box class to let it know that something needs to be loaded, and placed the information there beforehand, and then called domodal. OnInitDialog gets called when the dialog pops up, checks for the flag, and loads whatever. It seems kind of messy though. Is there another more elegant way to do it? Is there some way I can modify DoModal to accept arguments?

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

      have you seen This[^] article ?


      [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

      A 2 Replies Last reply
      0
      • T toxcct

        have you seen This[^] article ?


        [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

        A Offline
        A Offline
        andersod2
        wrote on last edited by
        #3

        Along these same lines, do you know how to put carriage returns into the CEdit? Yeah, I know, noob question, but I haven't worked much with CStrings and CEdit controls, and I just realized that putting a "\n" into a char buffer then converting it to a CString won't work in a CEdit...how do I do this?

        C 1 Reply Last reply
        0
        • T toxcct

          have you seen This[^] article ?


          [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

          A Offline
          A Offline
          andersod2
          wrote on last edited by
          #4

          Also, a totally unrelated way of doing this, but may be of use if you're using a DLL, is to create a shared data segment with #pragam data_seg() and put in a global variable in there which will keep track of the number of instances of subscribers to the DLL. Of course your program will have to import the DLL etc, which is not preferable at all, but like I said if you're already using a DLL it's another option.

          T 1 Reply Last reply
          0
          • A andersod2

            Along these same lines, do you know how to put carriage returns into the CEdit? Yeah, I know, noob question, but I haven't worked much with CStrings and CEdit controls, and I just realized that putting a "\n" into a char buffer then converting it to a CString won't work in a CEdit...how do I do this?

            C Offline
            C Offline
            CoffeeAddict19
            wrote on last edited by
            #5

            I think you have to use "\r \r". Edit...sorry that's wrong here...it's "\r\n". http://microsoft.ease.lsoft.com/scripts/wa-msn.exe?A2=ind9709a&L=mfc&T=0&P=10710[^] -- modified at 0:29 Thursday 15th March, 2007

            A 1 Reply Last reply
            0
            • C CoffeeAddict19

              I think you have to use "\r \r". Edit...sorry that's wrong here...it's "\r\n". http://microsoft.ease.lsoft.com/scripts/wa-msn.exe?A2=ind9709a&L=mfc&T=0&P=10710[^] -- modified at 0:29 Thursday 15th March, 2007

              A Offline
              A Offline
              andersod2
              wrote on last edited by
              #6

              that did the trick...thanks...seems counterintuitive, like I was programming for unix or something...I never even would have guessed that in a million years...

              1 Reply Last reply
              0
              • A andersod2

                Also, a totally unrelated way of doing this, but may be of use if you're using a DLL, is to create a shared data segment with #pragam data_seg() and put in a global variable in there which will keep track of the number of instances of subscribers to the DLL. Of course your program will have to import the DLL etc, which is not preferable at all, but like I said if you're already using a DLL it's another option.

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

                globals are most of the time bad, and can be avoided using OOP data members.


                [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                A 1 Reply Last reply
                0
                • T toxcct

                  globals are most of the time bad, and can be avoided using OOP data members.


                  [VisualCalc][Binary Guide][CommDialogs] | [Forums Guidelines]

                  A Offline
                  A Offline
                  andersod2
                  wrote on last edited by
                  #8

                  I made that post in the wrong thread...my bad

                  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