I'm coding an MFC application on visual studio using C++. I'm using some header file that contains some classes. I'm using an OnTimer event. I want to declare an object to use it in the timer function, the class of the object I want to declare is called CFSUIPC and it is defined in a header file called "FSUIPC". I want to call the object I declare: FSConnection.
When I declare and initilize the object in the OnTimer Methode like this
CFSUIPC FSConnection(SIM_ANY)
every thing works well.
The problem is that this initialization using the non-default constructor takes a lot of time and this affect the real time aspect of my application. My idea was to declare and initialize my object in my ApplicationDlg.h file, in the private part of the CDialogEx method so that all functions in the applicationDlg.cpp can use it, but writing it in this way gives an error, in fact I can declare may object like this: CFSUIPC FSConnection but I can't initialize it using the non-default constructor inside the header file. other idea was to declare and initialize the object in the OnInitDialog method in the applicationDlg.cpp file, same result, it doesn't work I thought to declare the object in the applicationDlg.h and initialize it in the applicationDlg.cpp but as I'm a beginner in OOP I didn't know how to do it. So if any one can help me out to do it or give me the wright way to have this object used by my timer without being declared in it I would appriciate Thank You
Aucun commentaire:
Enregistrer un commentaire