Preprocessor Directives in MFC Applications

This is a discussion on Preprocessor Directives in MFC Applications within the Windows Programming forums, part of the Platform Specific Boards category; Hi, I have defined a preprocessor define #SHOW_LJ_DATA in my project settings. In another .h file, I have the following: ...

  1. #1
    Registered User
    Join Date
    Mar 2005
    Posts
    11

    Preprocessor Directives in MFC Applications

    Hi,

    I have defined a preprocessor define #SHOW_LJ_DATA in my project settings. In another .h file, I have the following:

    Code:
    #define LJ_DATA_SERVER_PORT_NUM 5003
    #define NAPIE_DATA_SERVER_PORT_NUM 5004
    
    #ifdef SHOW_LJ_DATA
      #define SIOC_SERVER_PORT_NUM LJ_DATA_SERVER_PORT_NUM
    #elif SHOW_NAPIE_DATA
      #define SIOC_SERVER_PORT_NUM NAPIE_DATA_SERVER_PORT_NUM
    #else
      #define SIOC_SERVER_PORT_NUM 5002
    #endif
    Now here's the situation. I have two dialogs within one MFC application. One is called LJDlg and the other one is called NAPIEDlg. Depending on which dialog is opened, as you can see from this code, I select one port versus another to create sockets with (so that both windows can be opened at the same time). Problem is, I can't just define both #SHOW_LJ_DATA and #SHOW_NAPIE_DATA as a macro for that one project. If I do that, then it will always default to SHOW_LJ_DATA and therefore the wrong port number for the NAPIEDlg. I really don't want to have to move the NAPIE stuff to another application as it is a complete pain in the ass to do. Thanks for any help.

  2. #2
    Registered User
    Join Date
    Mar 2005
    Posts
    11
    Nevermind, wasn't as hard to do the new project idea as I thought it would be.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. First MFC app - Not listed in Task Manager Applications
    By Dino in forum Windows Programming
    Replies: 3
    Last Post: 03-08-2008, 10:06 AM
  2. A question about windows programming
    By Hussain Hani in forum Windows Programming
    Replies: 16
    Last Post: 05-23-2007, 07:38 AM
  3. Distributing MFC Applications
    By WiKiDJeFF in forum Windows Programming
    Replies: 4
    Last Post: 05-01-2003, 05:39 PM
  4. WIndows programming?
    By hostensteffa in forum Windows Programming
    Replies: 7
    Last Post: 06-07-2002, 08:52 PM
  5. Release MFC Programs & Dynamic MFC DLL :: MFC
    By kuphryn in forum Windows Programming
    Replies: 2
    Last Post: 05-18-2002, 06:42 PM

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