|
If your doing this loop in your user interface thread, then its not allowing the messages generated from your loop to be processed. Try adding this into the loop:
MSG msg ;
while (::PeekMessage(&msg, NULL, 0, 0, PM_NOYIELD | PM_REMOVE))
{
::TranslateMessage(&msg) ;
::DispatchMessage(&msg) ;
}
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Thanks.
Why is it not allowing me to update the progress bar in the UI thread?
Kuphryn
|
|
|
|
|
The UI thread pumps the windows messages that allows you controls to draw themselves. In your original function, you entered a lopp that updtaes the position in the control and then pauses the thread until you want to update it again. As the UI thread is not pumping the message queue in the loop, your controls never update, if effect the UI of your app is stalled until the function completes. You should then find all the messages get processed, and the progress will be shown at 100% complete.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
Thanks.
I do not see the progressbar anywhere on the statusbar (in main) at all.
A member at Codeguru posted a segment of code he used for a something I am trying to implement. He used CDialogBar and CProgressCtrl.
Here is the link to that thread:
http://www.codeguru.com/cgi-bin/bbs/wt/showpost.pl?Board=vc&Number=367944&page=2&view=collapsed&sb=5
He used some really innovative MFC tools such as the CDialogBar and ShowControlBar() function. I have Jeff Prosise's MFC reference, but I do not remember Prosise mentioning those about those tools.
I had problems getting the code from the link above to run. I got the error "bardlg.cpp" debug error. Maybe you can test it out too.
Kuphryn
|
|
|
|
|
Oh, I understand now. I receive a response at Gamedev about the UI thread (main frame) not able to update the progress bar. I am not familiar with the reason behind that.
I would like to have the progress bar in a pane of a statusbar. That means I will have to declare the progress bar in main (UI thread) and update it from there. If the UI thread cannot update the progress bar, then is it possible to even have a progress bar in main (UI thread) at all?
Kuphryn
|
|
|
|
|
Okay. I finally implemented that progress bar in my program. It works great.
I have a question. A member at Anandtech posted a link to a source code from CodeProject. The author of the progress bar uses the function PeepAndPump(). He uses it to process other messages while the progress bar updates. I do not see that function in MSDN. Is there a similar function in MFC?
Kuphryn
|
|
|
|
|
Hi,
I am using the COM interface given below for getting
the history of Internet Explorer..
IEnumSTATURL* pIEnumSTATURL = NULL; // Enumerated URLs
UrlHistoryStg2* pUrlHistoryStg2 = NULL;
After getting the history i clear the history using
ClearHistory()\
And i am facing a problem, Sometimes some URLs are not deleted from the history and are there in it...
What may be the cause of this behaviour..
And how to delete them.
Regards
Sameer
|
|
|
|
|
Hi.
I can considering to add a new feature to a program I am current working on. I will explain briefly on the program.
I am working on a program that is basically a text editor. it looks and feels almost like Notepad.
I want to add a feature similar that includes a split view. The program will operate using two views. The views are split in horizontally. The top view is the original text. So if the user opens a text file that has "Hello MFC," then the program will always display the original text on the top view. The second view located at the bottom is the modified view. I have a feature in the program where, for example, it will seach a text file and capitalize the first letter of a sentence. Once done, I want to display the modified text in the second view.
I would like to know the best approach for something like that with these key feature:
1) separate and unique saves
--- the user can save *both* files separately. the save features on the menu applies to the original text (top view).
What is the best approach to somehow mark what view the user wants to save? I have two ideas.
1) upon save, the program would save whatever view is *active* (cursor).
2) have a second toolbar for the view #2
I am not sure how to implement either of the above. I tried adding a second toolbar, but the program ignores it (I did not see it).
Thanks,
Kuphryn
|
|
|
|
|
You could use the GetDocument of the CView then use the IsModified of the CDocument , to check if the data in document is dirty , note you could use explicitily the SetModifiedFlag of the CDOcument associated with the current View then override the SaveModified function of the CDocument to do the proper action, since the default use a normal prompt to present the user the option of saving the changes.
Cheers,
Joao Vaz
The Most Unhappy and Frustrated TCL programmer,besides that a Happy guy
|
|
|
|
|
|
I am creating a MDI application and I want an icon at the taskbar for every child like Excel has an icon for every workbook. I tried to create a dialog for every child and minimize it, I can activate the corresponding doc, but the icon is not being checked, I also can not minimize the window and at slower systems, you see the dialog appear and "fly away" to the taskbar.
I hope somebody knows a solution.
Regards,
Danny Springer
|
|
|
|
|
If you have VC 7 there is an option for a Doc/View like that. I can't remember the name off hand.
- Matt Newman / Windows XP Activist
-Sonork ID: 100.11179
†
|
|
|
|
|
Nope, VC6, but I will remember this.
Regards,
Danny Springer
|
|
|
|
|
I am not sure whether this is a nice idea, but make each of those mdi children a direct child of the desktop.
Nish
The rumours that I am an AI bot are absolutely false. These rumours have been propogated by *them* to focus all the attention on to me, while *their* bots take over the planet. Thank y%%%% Divide by zero. Cannot proceed. Abort(y/y)?
|
|
|
|
|
Why you think, that it's MDI? It's another architecture, and required another programming. See sources of MFC 7.0 for details.
|
|
|
|
|
Use the WS_EX_APPWINDOW style for every window that you want to appear in the taskbar.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hi.
Microsoft offers an impressive feature in MFC that routes WM_COMMAND and COMMAND_UPDATE messages via command routering using OnCmdMsg(...) in main and a function in doc to traverse through all active view. The drawback, however, is that it only works for COMMAND messages, not any messages.
I wonder if there is a technique similar to the one mentioned above for specific command type such as user commanders (WM_USER_MYCOMMAND, etc). The message map would look like this:
// ON_MESSAGE(WM_USER_MYCOMMAND, OnMyCommand)
Thanks,
Kuphryn
|
|
|
|
|
kuphryn wrote:
ON_MESSAGE(WM_USER_MYCOMMAND, OnMyCommand)
Yeah, this is allowed. People use it a lot in task tray notification handlers. They have a custom message and they use this macro.
Nish
The rumours that I am an AI bot are absolutely false. These rumours have been propogated by *them* to focus all the attention on to me, while *their* bots take over the planet. Thank y%%%% Divide by zero. Cannot proceed. Abort(y/y)?
|
|
|
|
|
|
Check this out
http://mycrib.kicks-ass.net/project4.gif
I have no idea how to start other then the class declaration.... anyone have any examples on how templates/containers are done, I need something to read to learn this, the book we use for my course doesn't help at all on templates and containers.
Thanks in advance!
BTW If someone has the urge to do what the project asks, don't hesistate, go with the flow, write it and post the code somewhere.
|
|
|
|
|
One hint about this homework: The template aspect of your asignment is trivial. Work posIntSet out as a non-template class with maxsize define as a macro somewhere:
#define maxsize 10 Concentrate on the containter issue and when you're done you'll be able to turn your solution into a templatized one with little effort (ask then here, or get some mate to help you.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I have a modal dialog, and I want to change its title bar before I call DoModal(). (not use the string which is in caption box in resource editor) How can I do this?
Thank you very much!
|
|
|
|
|
Before calling DoModal , the real control is not created yet, only its encapsulating CDialog . So, you'd have to store the new caption in some member variable of the CDialog and later use it (with SetWindowText ) in OnInitDialog .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I see. I thought there was a member variable of CWindow which I can change directly. I am wrong.
Thank you, Joaquín.
|
|
|
|
|
lucy wrote:
I thought there was a member variable of CWindow which I can change directly. I am wrong.
I am not aware of any CWnd member for this. Add your own and then in
your OnInitDialog() call SetWindowText().
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|