|
ashtwin wrote: But if we restore the temporary pointer returned from SelectObject in the DC immediately, the DC may be having some dangling references after the current call.
I think you mean: "the device-context hold a pointer that could became invalid". Isn't it?
Don't worry about it: once you have selected back the original object inside the device-context, everything will works fine. What you cannot do is to store that pointer and use it explicitly later.
|
|
|
|
|
There is a difference. The temporary object is a temporary MFC object wrapping the underlying HGDIOBJECT. The gdi object the handle is pointing to is not temporary.
|
|
|
|
|
I understood. Thanks you all for your replies.
|
|
|
|
|
Hello,
I created an ActiveXDll on C# and set parameters of COM in its interface.
And now I need to integrate this ActiveXDll in my C++ Form.
So can you help me?
|
|
|
|
|
If you're using MFC , then Visual Studio may generate a wrapper C++ class for you.
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]
|
|
|
|
|
Hello,
When running MFC\C++ project in 2003 VC++.NET env, resource files are always out of date,
even though there are no changes made.
Whenever I hit F5, it gives me the "These project configuration(s) are out of date:"
msgbox.
When building again, I see that all sources are up to date except resources
In the output window I see:
all is "up-to-date"
then "compiling resources..
Linking.."
Can anyone know how to get rid of this annoying msgbox?
Thanks,
Dor
|
|
|
|
|
in win32, where will keep the all messages are generated by the window? and how do know this message is belongs to this window? and who will maintain the message queue? what happand in background? what is the code in c++? what are the methods are fallows in background?
Regards,
Srinivas
|
|
|
|
|
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
|
|
|
|