control flicker when I use double buffering to avoid window flicker
Now i need to draw some graphics on the entire
dialog ......also ,on the dialog i have some drag Bars(for
I use double buffer to avoid the dialog flicker ,do something like
1. CRect rect;
//.........draw graphics into memDC...
2. override the OnEraseBkgnd function ,just to return TRUE;
With the two steps above ,the dialog's flickering can be avoided..
...but when i drag the button to move ,the button flickers....
is there anyway to solve this problem?
thanks for any reply
X-Hamster-Info: Score=0 ScoreLoad=0 ScoreSave=0 Received 110531230252
Xref: localhost microsoft.public.vc.mfc:11609
From: Dani Peer <firstname.lastname@example.org>
Subject: Re: CEdit does not get WM_CHAR in a DLL when the main application is minimized
Date: Tue, 31 May 2011 09:32:35 -0700 (PDT)
References: <email@example.com> <firstname.lastname@example.org>
Content-Type: text/plain; charset=ISO-8859-1
X-Trace: posting.google.com 1306859556 5636 127.0.0.1 (31 May 2011 16:32:36 GMT)
NNTP-Posting-Date: Tue, 31 May 2011 16:32:36 +0000 (UTC)
Injection-Info: 22g2000prx.googlegroups.com; posting-host=184.108.40.206; posting-account=bjRrlAoAAADujcN-Kpy9j4fdhMD-q3UH
X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; WOW64;
Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR
3.0.30729; Media Center PC 6.0; InfoPath.2; GTB7.0),gzip(gfe)
X-Old-Xref: news.ett.com.ua microsoft.public.vc.mfc:34947
On May 31, 7:15 pm, Joseph M. Newcomer <newco...@flounder.com> wrote:
On Tue, 31 May 2011 07:45:59 -0700 (PDT), Dani Peer <danip...@gmail.com> =
I have a simple application that lunch a DLL. The DLL opens a window
with a splitter of 2 CFormView and each one of the forms there is an
Note that applications do not "launch" DLLs. They merely use them. =
Or, as you indicate
below, dynamically load them.
****>The code is as following:
You really have to stop using the stupid names that VS assigns to control=
s and change the
names to something that has meaning.
HINSTANCE hDLL; // Handle to DLL
hDLL = LoadLibrary("SessionWindow.dll");
Might as well start programming Unicode-aware. It is a good habit to d=
thinking that 8-bit characters are useful.
****> if (hDLL == NULL)
This is silly. If the hDLL is NULL, there is no possible way you can c=
all FreeLibrary on
a NULL handle. Note that what you wrote here is
if(hDLL == NULL)
which does not make sense
typedef BOOL (CreateObject3)();
CreateObject3* pCreateObject3 = (CreateObject3
It might be really, really useful here to see if pCreateObject3 is NULL b=
efore trying to
Note that GetProcAddress is the *only* API that uses 8-bit only character=
s, so using _T()
around the second argument would actually be incorrect. But this is ju=
st about the only
exception to using _T() you will encounter, except in very rare and exoti=
****> BOOL bRet = (pCreateObject3)();
You do not need to put pCreateObject3 in parentheses; you can write
BOOL bRead = pCreateObject3();
The method in the DLL is as following:
extern "C" __declspec(dllexport) BOOL CreateObject3()
SessionFrame2* pSessionFrame2 = new SessionFrame2;
pSessionFrame2->Create(NULL, _T("Session Frame"),
WS_OVERLAPPEDWINDOW , CRect(20, 20, 400, 400), NULL, NULL,
I'm not sure what the totally random numbers 20, 20, 400, 400 could possi=
bly mean. If you
care about window sizes, you will compute them dynamically based upon oth=
characteristics of the screen, its resolution, the parent frame size, etc=
.. There is no
way these values can have meaning other than on one machine with one curr=
ent default font,
a particular graphics card, a particular screen resolution, a particular =
version of the
device driver for the card, and a particular display screen.
Everything works fine, and when I minimized the main application I
still can type on the edits in the dll.
But, when I'm adding the method
I can not type on the edits in the DLL when I minimized the
What is SessionFrame2 derived from; I can't tell what Create means unless=
I know the class
of the object being created. However, I'm guessing from the name it mi=
ght be a class
derived from CMDIChildWnd, in which case the fifth parameter is the paren=
t window which
you have specified as NULL, which means the parent is supposed to be the =
window. In this case, if you minimize the application, the frame windo=
w you just created
should disappear as well. The fact that it does not means that I may h=
ave guessed wrong
about the class this is derived from.
Note that I have no idea about what AFX_MANAGE_STATE does to the ability =
to find the main
application window, but if this SessionFrame2 class really is derived fro=
the first thing I'd do is start single-stepping to see what the parent AC=
computed as being, or I'd use Spy++ to identify the parent window; it sou=
like you have a parent that is the desktop, which allows the window to ig=
nore what happens
to the main frame.
Also, you have not indicated how the edit control is created, or who crea=
tes it; if you
have a CFormView in this view, that would be an interesting fact to know.=
I'm not sure at
this point it helps, but it would be useful to know.
Note that if the parent of the window is the desktop, then what you are s=
*exactly* how it is *supposed* to behave. But I suspect that you do no=
t want the parent
of the window in question to be to the desktop, but to be the main applic=
Any idea ?
Joseph M. Newcomer [MVP]
1. SessionFrame2 derived from CFrameWndEx.
2. The Edit are created as part of the CFormView resources.