Hey all I have a problem... and I have just about exhausted my avenues... now I have searched but haven't found anything which adequately answers my question, and have done a lot of research on it, but no luck so far.
So... I turn to you the community for help.
So my problem sounds simple enough, I am using MFC.
I have a dialog which I want to basically popup and minimize the main view until it is fully connected to something. I.E. when it connects to the server it should just display a modal dialog and wait, continually updating messages until it completes, then it minimizes itself and is no longer used.
Relevant code
file globals.h
file StatusMonitor.hCode:class CtesterView; ///supposedly a forward definition extern CtesterView * ct;
file StatusMonitor.cppCode:#pragma once #include <winsock.h> #include "globals.h" // StatusMonitor dialog class StatusMonitor : public CDialog { DECLARE_DYNAMIC(StatusMonitor) public: StatusMonitor(CWnd* pParent = NULL); // standard constructor virtual ~StatusMonitor(); void setPtr(); void mess(); // Dialog Data enum { IDD = IDD_CONNECT }; CtesterView * myct; protected: virtual void DoDataExchange(CDataExchange* pDX); // DDX/DDV support DECLARE_MESSAGE_MAP() };
as you can see its just mostly generated code via msvc .net 2003...Code:#include "stdafx.h" #include "tester.h" #include "StatusMonitor.h" // StatusMonitor dialog IMPLEMENT_DYNAMIC(StatusMonitor, CDialog) StatusMonitor::StatusMonitor(CWnd* pParent /*=NULL*/) : CDialog(StatusMonitor::IDD, pParent) { } StatusMonitor::~StatusMonitor() { } void StatusMonitor::mess() { myct->msg(); } void StatusMonitor::setPtr() { myct = ct; } void StatusMonitor::DoDataExchange(CDataExchange* pDX) { CDialog::DoDataExchange(pDX); } BEGIN_MESSAGE_MAP(StatusMonitor, CDialog) END_MESSAGE_MAP() // StatusMonitor message handlers
basically how can I make it so I can pass the pointer from CtesterView (the generated view class) to my dialog class (StatusMessage) and allow it to call certain functions?
Or is there a better way to implement it? I could only think of global pointers... and everytime I try to use them, msvc tells me that in StatusMonitor.cpp the CtesterView is undefined. Or am I just missing something glaringly obvious? Any help would be appreciated, thanks.



LinkBack URL
About LinkBacks



