|
the destructors will call RemoveAll (or equivalent).
-c
Cheap oil. It's worth it!
|
|
|
|
|
I have an SDI MFC application, and I use OnPaint() to draw something to my view. Since my view is updated very frequently, (less than 1 second), I am thinking of using memory DC to reduce the flickering. I tried this:
{
CPaintDC dc(this);
CDC memDc;
memDc.CreateCompatibleDC(&dc);
dc.BitBlt(0,
0,
displayWidth,
displayHeight,
&memDc,
0,
0,
SRCCOPY);
memDc.DeleteDC();
}
but there is nothing on the display. The MSDN document said that I should select a bitmap to my memDc. I did so with a dummy blank bitmap resource I created using resource editor. After I select it to the memDc, there will only be the dummy bitmap displayed on my screen. How could I get my drawing displayed?
|
|
|
|
|
you need to create a compatible bitmap and select it into the memDc before you draw to memDc.
-c
Cheap oil. It's worth it!
|
|
|
|
|
Thank you for your fast help. Now I got my drawing dislayed on the monitor, but the background is totally black. And it flickers even worse. what could be wrong?
|
|
|
|
|
let me try OnEraseBkGround.
|
|
|
|
|
Got it. After overwrite the OnEraseBkgnd(), no flicker anymore. Happy..
|
|
|
|
|
I still couldn't figure out why the background color turns to be black instead of the default one. could you give me some clue?
|
|
|
|
|
Call FillSolidRect(...) with the memory object.
One good thing about getting older, you don't lose the ages you've been!
|
|
|
|
|
|
|
Hi everybody,
On windows xp netstat -o command can show the process id of an open tcp port.
Can i do the same thing on windows nt/9x using an API ?
Thank you,
Orcun Colak
|
|
|
|
|
Hi.
I have discovered a problem with multithreading processes in my program. Here is an example.
- program starts
- CMyProgramApp::InitInstance() calls RestoreState() in CMainFrame()
- RestoreState() restores the windows positions via registry
- RestoreState() restores data (int, char, binary, etc) from registry to variables in CMyProgramDoc()
- RestoreState() calls a function in CMyProgramDoc() which begins a worker thread
- worker thread does some calculation
Problem: For some reason, I have found that if the calculation is big i.e. it takes a long time, the thread never gets closed and deleted.
The worker thread PostMessage main frame a message indicating that it is done. However, sometimes main frame never received the message!
-----
UINT WorkerThreadFunc(LPVOID pParam)
{
...
pWnd->PostMessage(WM_USER_WORKERTHREAD_CLOSED, 0, 0);
return 0;
-----
There is a handler in main frame to handle the message that class a function in doc to close the worker thread; however, I found that if the worker thread takes a long time to finish a calculation, main frame never receive or ignores the PostMessage.
The only problem I can think of right now is I am starting the worker thread too early. In other words, I should start the worker thread after the program has started and all window positions have been restored.
Do you see any other flaws? Please post.
Thanks,
Kuphryn
|
|
|
|
|
Okay.
Damn. The problem was not anything except bad debugging. I made a small mistake that caused a program loop inside the worker thread. The worker thread never PostMessage! It there is a loop that never exits.
The solution was to reset one of the variables I used inside the while look.
The breakpoint feature in Visual C++ is extremely useful!.
Special thanks to IndirectX of GameDev for breaking up the subject about breakpoint.
Kuphryn
|
|
|
|
|
OK, i need to make a dll that will add an entry to the windows explorer context menu, i had a look at this article on codeproject but found that I could not make sense of the code, that i need and know is in there. Cananyone help me out?
==================================================
Homepage: www.onyeyiri.co.uk
Email: theeclypse@hotmail.com
"I think Microsoft has invented A.I. My computer has a mind of its own!"
|
|
|
|
|
look around a bit on this site... there are a ton of articles on shell extensions.
-c
Cheap oil. It's worth it!
|
|
|
|
|
I have tutorials [part 1 and part 2] on this subject. Maybe a tutorial format will be easier for you to digest.
--Mike--
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Sonork-100.10414 AcidHelm
|
|
|
|
|
I saw your tutorials soon after I made this thread. IT was just right for me, understood it ( 'cos its made for idiots )
==================================================
Homepage: www.onyeyiri.co.uk
Email: theeclypse@hotmail.com
"I think Microsoft has invented A.I. My computer has a mind of its own!"
|
|
|
|
|
Michael Dunn wrote:
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
you know, i dont think you should be advertising your own software (shareware i might add) on codeproject, unless its one of those big banners, am i right?
==================================================
Homepage: www.onyeyiri.co.uk
Email: theeclypse@hotmail.com
"I think Microsoft has invented A.I. My computer has a mind of its own!"
|
|
|
|
|
No, it's acceptable here to pimp your own stuff in your signature. Else I wouldn't be doing it.
--Mike--
Just released - RightClick-Encrypt - Adds fast & easy file encryption to Explorer
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Sonork-100.10414 AcidHelm
|
|
|
|
|
I can't find how can I use WM_ONKEYDOWN or WM_ONSYSKEYDOWN when I 've somme buttons on my
application. If I erase them, it workds perfectly, but either not...
If I have buttons, they take the input focus, and I can't find the way to keep the focus on my
window
|
|
|
|
|
|
Hi people,
I'm trying to change the font used to draw in my view class, but there's something wrong. This is the code in my view's OnDraw handler:
CFont NewFont;
LOGFONT LogFont;
GetFont()->GetLogFont(&LogFont);
LogFont.lfWeight = FW_NORMAL;
NewFont.CreateFontIndirect(&LogFont);
I found this code in quite a few examples in forums, but the call to GetLogFont causes an assertion failure:
_AFXWIN_INLINE int CFont::GetLogFont(LOGFONT* pLogFont)
{ ASSERT(m_hObject != NULL);
return ::GetObject(m_hObject, sizeof(LOGFONT), pLogFont); }
I can't even figure out what the m_hObject is supposed to contain, let alone why it's NULL. Anyone have a clue?
Thanks a lot,
ren
|
|
|
|
|
The GetFont() call is returning NULL. This will normally only work if a call to SetFont() or WM_SETFONT message has already been done/sent to the window in question.
Roger Allen
Sonork 100.10016
If I had a quote, it would be a very good one.
|
|
|
|
|
How can I send an EMail from an MFC Project without DOC/VIEW Architecture and without MAPI messanging?
|
|
|
|
|
SMTP is an option. there is code here that will help.
-c
Cheap oil. It's worth it!
|
|
|
|