how to put a window on dialog in MFC

M

Marcin

I have to write a small program in Visual C++ using MFC. Problem is that I
have no idea how to create and show windows i MFC when the parent is a
dialog window. At the beginning I decided to choose "dialog based project"
becouse it seemed to be simmillar to progrmming in C++ Builder but it was
only the illussion.
What I want to do:
I want to put a window (not a control fom toolbox but regular blank
window) on my dialog to do some drawing on it.
What I don't know:
How to Create the window?
Where to create the window? In what class, module ?

I tried to write like this (I placed this code into dialog constructor )....

(...)
CmapaDlg::CmapaDlg(CWnd* pParent /*=NULL*/)
: CDialog(CmapaDlg::IDD, pParent)
{
CString classname = AfxRegisterWndClass(CS_HREDRAW | CS_VREDRAW);
CWnd okno;
okno.Create((LPCTSTR)classname, "moje_okno", WS_CHILD | WS_VISIBLE |
WS_BORDER, CRect(1,1,20,20), this, NULL, NULL);
okno.ShowWindow(SW_SHOW);
}

.... and it doesn't work
 
V

Victor Bazarov

Marcin said:
I have to write a small program in Visual C++ using MFC. Problem is that I
have no idea how to create and show windows i MFC [...]

Wrong newsgroup. Try comp.os.ms-windows.programmer.tools.mfc or
microsoft.public.vc.mfc

V
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,479
Members
44,899
Latest member
RodneyMcAu

Latest Threads

Top