Click here to Skip to main content
15,927,592 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Running my application when Windows starts Pin
Brian Olej9-Apr-04 11:09
Brian Olej9-Apr-04 11:09 
GeneralRe: Running my application when Windows starts Pin
toxcct9-Apr-04 11:14
toxcct9-Apr-04 11:14 
GeneralRe: Running my application when Windows starts Pin
Prakash Nadar9-Apr-04 15:18
Prakash Nadar9-Apr-04 15:18 
GeneralRe: Running my application when Windows starts Pin
2249179-Apr-04 19:04
2249179-Apr-04 19:04 
GeneralRe: Running my application when Windows starts Pin
Renjith Ramachandran9-Apr-04 19:38
Renjith Ramachandran9-Apr-04 19:38 
GeneralRe: Running my application when Windows starts Pin
Anonymous10-Apr-04 0:01
Anonymous10-Apr-04 0:01 
GeneralRe: Running my application when Windows starts Pin
Anonymous10-Apr-04 0:02
Anonymous10-Apr-04 0:02 
GeneralRe: Running my application when Windows starts Pin
Renjith Ramachandran10-Apr-04 0:44
Renjith Ramachandran10-Apr-04 0:44 
GeneralRight Solution from right person only Pin
ThatsAlok10-Apr-04 0:58
ThatsAlok10-Apr-04 0:58 
GeneralRe: Right Solution from right person only Pin
toxcct10-Apr-04 1:20
toxcct10-Apr-04 1:20 
GeneralRe: Right Solution from right person only Pin
Renjith Ramachandran10-Apr-04 2:45
Renjith Ramachandran10-Apr-04 2:45 
GeneralPreProcessor defines Pin
The Bowman9-Apr-04 10:40
The Bowman9-Apr-04 10:40 
GeneralRe: PreProcessor defines Pin
Michael Dunn9-Apr-04 14:56
sitebuilderMichael Dunn9-Apr-04 14:56 
GeneralRe: PreProcessor defines Pin
The Bowman9-Apr-04 15:11
The Bowman9-Apr-04 15:11 
Generalftp .... Pin
Shay Harel9-Apr-04 9:37
Shay Harel9-Apr-04 9:37 
GeneralRe: ftp .... Pin
Prakash Nadar9-Apr-04 9:42
Prakash Nadar9-Apr-04 9:42 
GeneralRe: ftp .... Pin
Shay Harel9-Apr-04 9:47
Shay Harel9-Apr-04 9:47 
GeneralRe: ftp .... Pin
Prakash Nadar9-Apr-04 15:14
Prakash Nadar9-Apr-04 15:14 
GeneralStatic library and dialog box Pin
Liobsynde9-Apr-04 9:00
Liobsynde9-Apr-04 9:00 
GeneralRe: Static library and dialog box Pin
Prakash Nadar9-Apr-04 9:11
Prakash Nadar9-Apr-04 9:11 
GeneralRe: Static library and dialog box Pin
Liobsynde9-Apr-04 9:28
Liobsynde9-Apr-04 9:28 
GeneralRe: Static library and dialog box Pin
Prakash Nadar9-Apr-04 9:41
Prakash Nadar9-Apr-04 9:41 
GeneralRe: Static library and dialog box Pin
Liobsynde9-Apr-04 9:57
Liobsynde9-Apr-04 9:57 
GeneralRe: Static library and dialog box Pin
Prakash Nadar9-Apr-04 15:05
Prakash Nadar9-Apr-04 15:05 
GeneralRe: Static library and dialog box Pin
Ravi Bhavnani9-Apr-04 9:23
professionalRavi Bhavnani9-Apr-04 9:23 
Ideally, the data processing library (MCB_Library) shouldn't contain any GUI calls. If there's a need for MCB_Library to get information from the client application at run-time, you might want to make MCB_Library call into its client and execute a known data retrieval method.

For example, define an interface (an abstract base class with a single pure virtual method) called IMCB_Client.

class IMCB_Client
{
public:
  IMCB_Client() {};
  virtual ~IMCB_Client() {};

public:
  virtual bool getDataFromUser
    (void* pData) = 0;
}
Your MIM application should "implement" the interface (by simply multiply inheriting from IMCB_Client), like so:
class CMimApp : public CWinApp,
                public IMCB_Client()
{
  ...
  // IMCB_Client implementation
  public:
    bool getDataFromUser
      (void* pData);
}
The implementation of CMimApp::getDataFromUser() should display the appropriate dialog and store the desired information in pData. The method could return false to indicate the data is not available. CMimApp should register itself as a client of MCB_Library. This just means storing a pointer to CMimApp in MCB_Library.

Finally, replace your call to display the dialog in MCB_Library with this code:
ASSERT (m_pClient != NULL);
DATA someData;
bool bGotData = m_pClient->getDataFromUser (&someData);
if (bGotData)
   ...
/ravi

My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.