|
Every thread has its own message queue that is setup by the system into which it posts the messages. Now that you have a start, dig into MSDN.
|
|
|
|
|
bleedingfingers wrote: Every thread has its own message queue that is setup by the system into which it posts the messages.
That's not completely true, see The Old New Thing - In pursuit of the message queue.
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]
|
|
|
|
|
CPallini wrote: bleedingfingers wrote:
Every thread has its own message queue that is setup by the system into which it posts the messages.
That's not completely true, see The Old New Thing - In pursuit of the message queue.
I know I know. And one would have to use PeekMessage(...) to force a queue to be created but I just gave him a start. Now, let him wipe that e-dust off his MSDN will ya
|
|
|
|
|
[Edit] I overlooked it - A 5 vote is offered. [/Edit]
There are some really weird people on this planet - MIM.
modified on Monday, October 18, 2010 1:52 PM
|
|
|
|
|
There are lots of things to say about your question. Let's say:
- the operating system handle a message queue for each thread in your process;
- it's up to you to write down the message loop for each thread
- each time you call the
DispatchMessage from your message loop, the message is dispatched to the window procedure of the window to which the message is targeted
To learn about this topic, start from Messages and Message Queues (Windows)[^]
|
|
|
|
|
who will create a thread and message queue?
what relation ship between operating system, thread, message queue, and application?
Regards,
Srinivas
|
|
|
|
|
vasu_sri wrote: who will create a thread and message queue?
The first thread is created by the operating system when you start an application. Other threads will be created by the application itself, for example by calling the CreateThread Function (Windows)[^].
A message queue is created and maintained by the operating system; the OS creates it only when needed, i.e. when your thread creates a window or calls any function that involves message queues.
vasu_sri wrote: what relation ship between operating system, thread, message queue, and application?
It's a very generic question, and answer it requires thousands of words... Have you had a look at the documentation on MSDN that I suggested you?
|
|
|
|
|
Application crashes at RichEditCtrl.StremOut(), It says attempt to read write protected memory. this often an indication that the other memory is corrupt.
May I know some path to find the issue and fix the issue. Any idea ?
.....
if (0 != file.Open(m_str, CFile::modeCreate | CFile::modeWrite, &e))
{
EDITSTREAM es = {0};
es.pfnCallback = COleElement::CallFunction;
es.dwError = 0;
es.dwCookie = (DWORD)&file;
lRet = m_cRichEdCt.StreamOut(SF_RTF, es);
}..........
DWORD CALLBACK CMyClass::CallFunction(DWORD dwCookie, LPBYTE lpBuf,LONG nCount, LONG* Write)
{
CFile* pFile = (CFile*)dwCookie;
if (pFile)
{
pFile->Write(lpBuf, nCount);
}
*Write = nCount;
return 0;
}
|
|
|
|
|
I have already responded to this question here[^]. Did you follow my suggestion and run it with the debugger?
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
I tried to debug and got the below values for es
es {dwCookie=1231056 dwError=0 pfnCallback=0x05151631 } _editstream
and the blreadk poing in the call back function is not getting hit.
Please advice
|
|
|
|
|
ptr_Electron wrote: the blreak point in the call back function is not getting hit.
This suggests (possibly) that the callback address is not valid, and the error occurs because of this. I have just noticed that in your code your callback is defined as :
DWORD CALLBACK CMyClass::CallFunction(DWORD dwCookie, LPBYTE lpBuf,LONG nCount, LONG* Write)
but your setting in the EDITSTREAM structure defines it as :
es.pfnCallback = COleElement::CallFunction;
which looks to be a different class. Are you sure this is correct?
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
Hi, I have a C++ program working on my C drive. Now I have uploaded it (using XP IE as my FTP client) to my website; together with the files that it needs to read. I want to able to run from a second PC thro' the web. I can just about get the program to start and find the files. But (a) I am probably not doing this in the best way. And (b) my program crashes with an access violation before doing anything useful. I am a complete newbie in this field, so what should I be looking out for?
Regards, George.
|
|
|
|
|
It's not clear what you are trying to do. As far as I understood, you would like other people to download your program (with all the files which are needed by it) and run it on their own machine. Is that correct ? So, there's nothing really related to web (except that they download the files).
Make sure that your program is compiled in release mode, that the target machine has all the required dll's. Which IDE did you use to create your program ?
Usually, if you have to supply an executable with additional files (like configuration files), it is best to provide an installer that installs everything at once. Take a look at InnoSetup[^] for instance.
|
|
|
|
|
Hello friends
i try to add button on CStatic control but button not show.How can i add button on CStatic?
|
|
|
|
|
If you show the code you used to add a button to a static, then maybe we can see what you did wrong. It will also give us a better idea of the context of this problem. So our help can be better targeted.
Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
|
|
|
|
|
Create the button as child control of your CStatic (meaning CStatic window is parent of the new button). Hope it helps!
|
|
|
|
|
Its probably a Z-Order issue.
In the dialog template press Ctrl+D and change the order of the controls.
|
|
|
|
|
In CStatic class, create a member variable of CButton;
oterwise it doesnt create a control.
in header file,
m_btnInStatic;
in cpp file,
m_btnStatic.Create(....);
like that.
Regards,
Srinivas
|
|
|
|
|
hello guys.... im new to this. Im using VS 2008 to create Windows Forms Project, and wanna show message box in it. But it is not working here is the code
MessageBox(NULL,"message box","title here",NULL);
im using vc++.
|
|
|
|
|
This works fine in my test program, perhaps you could add some more context. Alternatively run your program through the debugger with a breakpoint at the MessageBox() call.
Just say 'NO' to evaluated arguments for diadic functions! Ash
|
|
|
|
|
There's nothing wrong with the one line you showed. I'd suspect your code is not being reached, rather than being wrong if it ever was reached.
As Richard said: Breakpoint time!
Iain.
I am one of "those foreigners coming over here and stealing our jobs". Yay me!
|
|
|
|
|
Start ya good old debugger
|
|
|
|
|
What exactly do you mean by not working?
You're probably running a UNICODE build and are getting compile errors.
Try this - MessageBox(NULL, L"message box", L"title here", NULL);
|
|
|
|
|
Hello,
I am working with a large code base that is written entirely in C++, MFC as well as other API's, and which also link against various other projects (ie static libs written in C++). I am looking to replace some of the UI with WPF, and need advice on the most efficient way of going about this. If I host WPF content (created in C#\.NET) in a Win32 window so that I can reuse the C++ code, I encounter many loader lock issues, many of which I have been able to overcome, but am now running into cases that are difficult to debug and which may become time consuming. On the other hand I could also create a C++ DLL and load this in my WPF application, however creating a C++\CLI interface for the existing code also appears to be challenging and time consuming. I don't know what would be involved in creating a COM interface, and if this is has any advantages over the other approaches. I have spent a great deal of time trying various options but still without a clear choice. Is there a recommended approach or a resource where I can learn about the pros and cons of these approaches, including relative time investiment that is involved?
|
|
|
|
|
Huch, this is a huge topic and could take hours if not days to discuss... I try to comment some of the points you've made.
If I host WPF content (created in C#\.NET) in a Win32 window so that I can reuse the C++ code, I encounter many loader lock issues.
First, decide which way around you are going to interoperate. You have tried to embedd WPF content in Win32 windows. Then you (or the WPF itself) probably tried to embedd other (or probably the same) native Win32 content in the same WPF control which can lead to loader locks, since a safe recursive binding of this kind is hard to ensure. I recommend fixing the direction of interoperability once and for all times: The best choice is to let a WPF application be the master - then you can safely embedd Win32 native content including Direct3D, WinForms or whatever. Usage of Win32 or WinForms content in the WPF is well documented and supported on MSDN and in other WPF related sources since this is the intended way to do it.
On the other hand I could also create a C++ DLL and load this in my WPF application, however creating a C++\CLI interface for the existing code also appears to be challenging and time consuming.
But this is the only clean way to do it. It is also the intended way to do it, therefore it is quite well documented and has been subject to many articles and whole chapters of various WPF related books. I recommend reading on that a bit, it is not hard and can be automated to some extent.
Cheers,
Paul
|
|
|
|