The situation:
When the program is loaded, it's to check registry settings to determine whether to automatically connect to the last used MDB file or not. If it is to connect, it connects to the file, then is to update the status bar to reflect that is either connected or disconnected.
The layout:
The main frame contains a CSplitterWnd window that contains a listbox in the left pane, and a CView in the right pane. The CView actually contains the CDatabase variable, as all the database activity occurs within the CDialogs that get loaded into the CView to reflect the selected listbox item. The CView should send a user defined message to the Main frame in order to tell the main frame to update the status bar appropriately.
The Problem:
When the application initializes, the connection to the database is established correctly. However, no matter what I try I cannot show the connected state in the status bar.
I've tried getting the handle to the main frame by using GetParent(), which never returns a valid handle to the main frame. I've tried setting a public variable through a function in the CView class when it's created through the CSplitterWnd initialization (I have to get those handles in order to pass messages for the listbox selection). This also fails when attempting to set the status bar text.
I'm apparently missing something when it comes to window creation or something. Perhaps I'm thinking about this wrong way or something. Does any have any suggestions on how to initialize a frame window object from a child object at least 2 levels beneath?
When the program is loaded, it's to check registry settings to determine whether to automatically connect to the last used MDB file or not. If it is to connect, it connects to the file, then is to update the status bar to reflect that is either connected or disconnected.
The layout:
The main frame contains a CSplitterWnd window that contains a listbox in the left pane, and a CView in the right pane. The CView actually contains the CDatabase variable, as all the database activity occurs within the CDialogs that get loaded into the CView to reflect the selected listbox item. The CView should send a user defined message to the Main frame in order to tell the main frame to update the status bar appropriately.
The Problem:
When the application initializes, the connection to the database is established correctly. However, no matter what I try I cannot show the connected state in the status bar.
I've tried getting the handle to the main frame by using GetParent(), which never returns a valid handle to the main frame. I've tried setting a public variable through a function in the CView class when it's created through the CSplitterWnd initialization (I have to get those handles in order to pass messages for the listbox selection). This also fails when attempting to set the status bar text.
I'm apparently missing something when it comes to window creation or something. Perhaps I'm thinking about this wrong way or something. Does any have any suggestions on how to initialize a frame window object from a child object at least 2 levels beneath?