|
Roger Stoltz wrote: Rajesh R Subramanian wrote:
I said a Window (the program) can have more than one Message Queue running
I think this adds to the confusion. It looks like you're saying that a window is a program and of course it's not.
I took the simplest example - a dialog application, where there's just one message queue and that holds the messages posted to that very window by the outside world.
Roger Stoltz wrote: I interpret the OP's question in short terms as "does the message queue belong to a thread or a window" and the correct answer for that in equally short terms can only be "the thread".
Which I mentioned as well, only with added information that there could be additional message queues without windows associated to them.
I reckon we both have a way with our words, and we always get into discussions only to settle on the same boat after a while; saying: Oh yeah? You meant *that*. Right! Fun thing, if you ask me.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
sharda.bhagwatkar wrote: Are there separate message queues for each window or each thread has its own message queue.
A window does not have a message queue of its own. Multiple windows may be served by the message queue and message pump in the User Interface thread that the windows are created from.
In e.g. a simple dialog-based application there is initially only one thread and even if you create new windows, they will be served by the message queue in that thread. Keep in mind that all those small buttons and other controls are windows as well.
Every thread spawned is initially without a message queue. There are two kind of threads: worker threads and User Interface threads. Worker threads won't have a message queue, but UI-threads will get a message queue created when a message is sent, or posted, to the thread.
Read more about it in this small section[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
As Rajesh mentioned, message queue is associated with the thread. Not with the window.
|
|
|
|
|
i am working with an MFC application which handles images using an imaging library.
the application works fine for any image operation with small size images but for large size images, the application crashes.
if i try to debug in the visual studio 2008 then the application breaks with an heap corrupt message:
Heap block at 062E0E18 modified at 062FF378 past requested size of 1e558
Windows has triggered a breakpoint.
i tried for handling the exception using CMemoryException but it doesnt throw this kind so i am catching it this way:
try
{
}
catch(...)
{
}
now in the catch block i want to know the kind of exception which caused the problem.
is there a way to know this?
thanks
|
|
|
|
|
Whether memory allocation of huge size taking place inside the try block? Величие не Бога может быть недооценена.
|
|
|
|
|
One of the problems with this issue is that you have a memory leak in your code that is possibly not diagnosed until some time after the event. This means that even if you catch this exception it may only tell you what you see above: the heap is corrupt. You have allocated a buffer of 1E558 bytes (124248 decimal) but written in the heap somewhere beyond the end. You probably need to trace through your code as you load and process the image to ensue your index values are not corrupt. txtspeak is the realm of 9 year old children, not developers. Christian Graus
|
|
|
|
|
|
hai,
I want to create an application which will run 24 hrs a day & it should call a fn in every x minutes.
|
|
|
|
|
You can use a timer to do that.
|
|
|
|
|
Hello,
How can i access class member variable directly without creating object of that class.
I think there are two way, one way is declaring member variable as static.
What is the other way to access it?Abhijit
|
|
|
|
|
Abhijit D. Babar wrote: I think there are two way, one way is declaring member variable as static.
What is the other way to access it?
There isn't another way.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
learn about the class concept. A member makes only sence if have an instance.
if it is a global values (as computer name) use a static variable.Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hello,
Why MFC application create two resource file ".rc" and ".rc2" or What is the difference between .rc and .rc2 files.
.rc2 file does not contain anything, then why it use or created by MFC.Abhijit
|
|
|
|
|
In the *.rc2 file it is said:
#ifdef APSTUDIO_INVOKED
#error this file is not editable by Microsoft Visual C++
#endif //APSTUDIO_INVOKED
Regards.
--------
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
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Ok, it is having something in file, but what is use of that.
What it indicates.Abhijit
|
|
|
|
|
Take a look on documentation[^]Regards.
--------
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
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
you can include resources, which will not be editable in the Resource editor of the VS. Interesting for constant stuff as error messages or data as images. Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Hello,
In my MFC application, i added one Dialog resource and give class name as CSample.
I can invoke this dialog through;
CSample obj;
obj.DoModal();
Can i create user defined constructor for dialog class CSample.
If i want to pass some parameter to this class through constructor, can i pass it?Abhijit
|
|
|
|
|
Yes, you can. Just declare the type in the header file and add the definition in the cpp file.
I wonder why haven't you tried?!
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
I just want to pass the parameter for dialog class before dialog get invoke.
|
|
|
|
|
Abhijit D. Babar wrote: I just want to pass the parameter for dialog class before dialog get invoke.
Go ahead.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Abhijit D. Babar wrote:
Can i create user defined constructor for dialog class CSample.
Yes.
Abhijit D. Babar wrote: If i want to pass some parameter to this class through constructor, can i pass it?
Yes.If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Yes, you can create user defined constructor, and yes, you can pass parameters through the constructor to the dialog, but as the CDialog already gets a CWnd* as constructor parameter, NULL if nothing else is said.
CSample (CWnd* pParent = NULL);
I would use Set/Get methodes to pass parameters, because if you overload the constructor parameters, it may be that the MFC (if you use it) gives you problems if you have an error overloading the constructor. After just use the contructor to initialize the member variables/pointers
I mean:
CSample obj;
obj.SetParam1(value1);
obj.SetParam2(value2);
...
obj.DoModal ();
So you are passing the parameters before it gets invoked as you said in an answer to RajeshRegards.
--------
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
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
Nelek wrote: I would use Set/Get methodes to pass parameters, because if you overload the constructor parameters, it may be that the MFC (if you use it) gives you problems if you have an error overloading the constructor. After just use the contructor to initialize the member variables/pointers
Well, it looks to me a super-defensive approach.
[added]
Actually, I suppose I didn't get you. You are right, error handling in class constructor is troublesome.
[/added]
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Thanks Regards.
--------
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
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|