Thread: Returning variables from dialogs

  1. #1
    Registered User
    Join Date
    Jun 2005
    Posts
    8

    Returning variables from dialogs

    I have a program that spawns a dialog with DoModal. The new dialog class has a variable declared in my main dialog, as it should. How do I pass a variable from my spawned dialog to my main dialog. It is an int array. I tried passing the whole array to another array from my main dialog program, but it didnt work right. Should I use a pointer? Also, should I pass the info in the array from inside the code of my spawned dialog back to the main dialog (maybe a public variable can be used to store it?), or is it better to just get it straight from my main dialog and ask that it be returned? Geez what a headache.

    Thanks.
    Last edited by CPPguy1111; 06-22-2005 at 07:47 AM.

  2. #2
    Work in Progress..... Jaken Veina's Avatar
    Join Date
    Mar 2005
    Location
    Missouri. Go Imos Pizza!
    Posts
    256
    Well, for one, this would be better in the Windows Programming.

    And the easiest way I see to do that would be to create a global variable, or at least with a scope of both dialogs, and just have the spawned dialog edit that. I can't think of any way to actually return a variable from a dialog, much less an array. Might just be me, though.
    Code:
    void function(void)
     {
      function();
     }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 15
    Last Post: 09-30-2008, 02:12 AM
  2. Declaring an variable number of variables
    By Decrypt in forum C++ Programming
    Replies: 8
    Last Post: 02-27-2005, 04:46 PM
  3. hwnd and variables in them
    By underthesun in forum Windows Programming
    Replies: 6
    Last Post: 01-16-2005, 06:39 PM
  4. Returning Variables
    By drdroid in forum C++ Programming
    Replies: 6
    Last Post: 09-08-2002, 02:37 PM
  5. functions to return 2 variables?
    By tim in forum C Programming
    Replies: 5
    Last Post: 02-18-2002, 02:39 PM