I have a console program I’m trying to put into an dialog MFC api… I’ve implemented the class… fixed syntax and linking errors and so on but now that I’m trying to actually use it I’m having some problems.
In the example program they connect to the server as such:
I was thinking just throwing this into the constructor:Code:int _tmain(int, _TCHAR*) { Trade tc; if ( tc.Startup() ) {
But, this I couldn’t axcess any of the Trade class functions from event handlers attached the buttons in the dialog. I figured it might calling maybe calling the constructor over and over causing problems… I’m not experaince in Windows Programming. So I created a connect button (that way I could make sure it would only be called once. But, when I click connect now I get theCode:CBasic_Order_WindowDlg::CBasic_Order_WindowDlg(CWnd* pParent /*=NULL*/) : CDialog(CBasic_Order_WindowDlg::IDD, pParent) , m_equity_option(-1) , m_operation(-1) , m_quantity(_T("")) , m_option_symbol(_T("")) , bconnected(false) { Trade tc; if(tc.Startup()){ AfxMessageBox("You connected to the server."); } else { AfxMessageBox("You couldn't connect to the server.\nPlease set the UserConfig.ini file."); } m_hIcon = AfxGetApp()->LoadIcon(IDR_MAINFRAME); }
Dialog but then the program just hangs. So I guess my question is how do you referance and create an object of another class which I can repeatly referance from a dialog box, this dialog box loops until the user hits an exit button.Code:AfxMessageBox("You connected to the server.");



LinkBack URL
About LinkBacks


