Variable "transfer"

This is a discussion on Variable "transfer" within the Windows Programming forums, part of the Platform Specific Boards category; What would be the most efficient way to "transfer" a variable from one switch case to the next? Ex. Code: ...

  1. #1
    Rad gcn_zelda's Avatar
    Join Date
    Mar 2003
    Posts
    942

    Variable "transfer"

    What would be the most efficient way to "transfer" a variable from one switch case to the next?
    Ex.

    Code:
    case ID_FILE_SAVE:
    {
       OPENFILENAME ofn;
       //ofn stuff
    }
    case ID_VIEW_PREVIEW:
    {
        ShellExecute(hwnd, open, ofn...)
    }
    I need to "retrieve" the data from the first ofn to the second.

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,674
    Declare it outside the switch statement so that it will be in scope for all case blocks.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. How accurate is the following...
    By emeyer in forum C Programming
    Replies: 22
    Last Post: 12-07-2005, 11:07 AM
  2. static class variable vs. global variable
    By nadamson6 in forum C++ Programming
    Replies: 18
    Last Post: 09-30-2005, 03:31 PM
  3. Replies: 2
    Last Post: 04-12-2004, 01:37 AM
  4. write Variable and open Variable and get Information
    By cyberbjorn in forum C++ Programming
    Replies: 2
    Last Post: 04-09-2004, 01:30 AM
  5. Variable question I can't find answer to
    By joelmon in forum C++ Programming
    Replies: 3
    Last Post: 02-12-2002, 03:11 AM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21