Application gets slower when having ~50 dialogs in memory.
-
Hi, I have an MDI application. In view, I have created a property sheet. In one of the pages of this property sheet, I have to create ~50 different kinds of modeless dialogs, owned by property page. All these dialogs are needed in memory as long as the document is open in the session. I have created them at application start up. However, when I create two to three documents, my application gets very slow (~50 * 3 documents = ~150 dialogs in memory). The API
CDialog::Create
is taking time. Could you please suggest a solution for this ? Any help would be highly appreciated. Regards, Paresh. -
Hi, I have an MDI application. In view, I have created a property sheet. In one of the pages of this property sheet, I have to create ~50 different kinds of modeless dialogs, owned by property page. All these dialogs are needed in memory as long as the document is open in the session. I have created them at application start up. However, when I create two to three documents, my application gets very slow (~50 * 3 documents = ~150 dialogs in memory). The API
CDialog::Create
is taking time. Could you please suggest a solution for this ? Any help would be highly appreciated. Regards, Paresh.Can each document share the dialogs, so you only have to create 50? Why not create each dialog dynamically when it's needed, or are all 50 visible all the time. Sounds like a pretty intense app if that's the case. Could combine some of the dialogs?
- S 50 cups of coffee and you know it's on!
-
Can each document share the dialogs, so you only have to create 50? Why not create each dialog dynamically when it's needed, or are all 50 visible all the time. Sounds like a pretty intense app if that's the case. Could combine some of the dialogs?
- S 50 cups of coffee and you know it's on!
Hi Steve, Thanks for your reply.
Steve Echols wrote:
Can each document share the dialogs, so you only have to create 50?
A particlaur dialog has its own data. A data in a dialog in one document is different from another dialog from another document. Could you please let me know, How could I share the dialogs across two documents ?
Steve Echols wrote:
Why not create each dialog dynamically when it's needed, or are all 50 visible all the time.
Then also application gets slow. Regards, Paresh.
-
Hi Steve, Thanks for your reply.
Steve Echols wrote:
Can each document share the dialogs, so you only have to create 50?
A particlaur dialog has its own data. A data in a dialog in one document is different from another dialog from another document. Could you please let me know, How could I share the dialogs across two documents ?
Steve Echols wrote:
Why not create each dialog dynamically when it's needed, or are all 50 visible all the time.
Then also application gets slow. Regards, Paresh.
I had the same problem when creating the parameter-dialogs for each element, when I had 20+ elements and tryed to open them the app was freezing. I got it improved by removing the CDialogs and using CFormViews, duplicating the views as I needed them. It gives more performance, more speed and more functionality (i.e. UpdateAllViews ()).
Paresh Chitte wrote:
How could I share the dialogs across two documents ?
At the same time you are not going to be able of that. If you open the window for a document you should close it and reopen for another document. Or delete the contents of all elements and then fill them with the datas of the second element. I made it adding a CMyDoc* pointer to the "parent" document as member variable in the CFormView, when I double-clicked on an element to be parametrized, then I got the document pointer in the CMyView and sent it to the CFormView of that element at the end of the opening process. Then used the OnInitialUpdate () to fill all the elements with the datas of the document. You can check this[^] and this[^] posts to have a look of what I made. Hope it helps :)
Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
-
I had the same problem when creating the parameter-dialogs for each element, when I had 20+ elements and tryed to open them the app was freezing. I got it improved by removing the CDialogs and using CFormViews, duplicating the views as I needed them. It gives more performance, more speed and more functionality (i.e. UpdateAllViews ()).
Paresh Chitte wrote:
How could I share the dialogs across two documents ?
At the same time you are not going to be able of that. If you open the window for a document you should close it and reopen for another document. Or delete the contents of all elements and then fill them with the datas of the second element. I made it adding a CMyDoc* pointer to the "parent" document as member variable in the CFormView, when I double-clicked on an element to be parametrized, then I got the document pointer in the CMyView and sent it to the CFormView of that element at the end of the opening process. Then used the OnInitialUpdate () to fill all the elements with the datas of the document. You can check this[^] and this[^] posts to have a look of what I made. Hope it helps :)
Greetings. -------- M.D.V. ;) If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about? Help me to understand what I'm saying, and I'll explain it better to you “The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Hi Nelek, Thanks for your reply. I will look into it. Regards, Paresh.