"Joseph M. Newcomer" :
See below...
On Fri, 6 Nov 2009 17:55:42 -0800 (PST), Aegis Delacour
<eloquent1@gmail.com> wrote:
Thanks for the answers.
im guessing this is what you mean...
HWND hdc = CreateWindow();
****
In MFC, you would create a subclass of CWnd, e.g.,
class CMyFullScreen : public CWnd {
};
you would do this using the "Add New Class" function in VS.
Therefore, you would NOT be calling CreateWindow. Also, you would
never call GetDC; that piece of code is completely irrelevant
****
HDC GetDC( HWND hdc );
****
Having created the class, you would now create a window. You need a
variable which you declare in a place (such as some view class you are
using, or dialog class, or something, but NOT a local variable); for
example put it in your CLowerEicasDlg class
CMyFullScreen screen;
then in response to a button click you would do
void CLowerEicasDlg::OnSomeCondition()
{
LPCTSTR classname = AfxRegisterWndClass(0);
screen.CreateEx(0,
NULL,
WS_OVERLAPPED | WS_VISIBLE,
x0, y0,
width, height,
NULL,
NULL);
}
Note that error detection and recovery is left as an Exercise For The
Reader.
Also, I did not specify x0, y0 and width, height since I leave those
up to you to figure out. They may be local variables you compute on
the fly in OnSomeCondition method, or class variables of
CLowerEicasDlg that you have computed earlier.
Then to your CMyFullScreen class, you will add an OnPaint handler
using the ClassWizard:
void CMyFullScreen::OnPaint()
{
CPaintDC dc(this);
... do your drawing here
}
Note that you do not ever, under any circumstances, do a GetDC. In
those very rare and exotic situations where you might need to draw
outside the OnPaint handler, you would declare a CClientDC variable,
but you do not have that situation here. ****
but im not too sure about the parameters, could you help me fill it in
plz?
HWND CreateWindow(
LPCTSTR lpClassName,
LPCTSTR lpWindowName,
DWORD dwStyle,
int x,
int y,
int nWidth,
int nHeight,
HWND hWndParent,
HMENU hMenu,
HINSTANCE hInstance,
LPVOID lpParam
);
****
This would be the raw API. But you are programming in MFC and this is
irrelevant.
Note that your calls on CreateDC are also irrelevant. If you wanted
to create a memory DC to reduce flicker, you would declare
CDC memDC;
memDC.CreateCompatibleDC(&dc);
and work with the MFC methods for doing the drawing.
joe
****
Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
.....
....