mfc >> How to use Cwnd.CreateEx()

by May Young » Wed, 03 Dec 2003 06:35:35 GMT

Hi,

My application has a left window showing a treeview and a right window
showing some 3D objects. When a treeview item is clicked on, I want to
create a 3rd window (probably a child of the right window) for showing
relevant texts.

This new window, showing texts, should have no menu bar and a wide
frame, To create it using CreateEx(),

(1) how do I specify the 2nd parameter, lpszClassName? Is it _T("plain")?

(2) Can lpszWindowName be anything?

(3) how to specify nIDorHMenu if no menu is needed?

Thanks for your help.

Tony



mfc >> How to use Cwnd.CreateEx()

by Ali R. » Wed, 03 Dec 2003 06:44:17 GMT


> This new window, showing texts, should have no menu bar and a wide

If it's a plain window NULL


That would be the title of your window, since you don't have a title bar,
pass ""


That's the child control ID if you specify WS_CHILD, if it's not going to be
a child window, it is the menu that you want on top of your window, since
you don't have one of those either that would be 0.

Ali R.





mfc >> How to use Cwnd.CreateEx()

by May Young » Wed, 03 Dec 2003 07:38:29 GMT


Is there a set of existing, predefined class names (for lpszClassName)
that I can use? Thanks.

Tony





How to use Cwnd.CreateEx()

by Jase » Wed, 03 Dec 2003 10:06:38 GMT





Indeed there are... Unfortunately, I don't know if a list exists. I just
create a window using a defined class (CEdit for example), and trace into
the mfc code to find the class name (which I think is "EDIT" in this case).

Jase




How to use Cwnd.CreateEx()

by Ali R. » Thu, 04 Dec 2003 00:14:32 GMT

The ones defined by microsoft are listed on the bottom of the help page for
CreateWindow.
BUTTON
COMBOBOX
EDIT
LISTBOX
MDICLIENT
RichEdit
RICHEDIT_CLASS
SCROLLBAR
STATIC

and of course you can define your own using RegisterWindow

Ali R.







_T("plain")?
bar,
to be
since




Similar Threads

1. CWnd::CreateEx fails with GetLastError 0

Hi,

I am creating a transparent child window in my process which is child of 
another window in a different process ( against documentation but it works 
very well ).

Sometimes i am getting CWnd::CreateEx API failure with GetLastError 0. One 
more 
issue with this is that CreateEx API do not return failure immediately. It 
gets blocked for some time ( about 5 seconds ) and then it returns FALSE. 
GetLastError gives 0.

I checked.. When this happens,  other process in which parent window resides 
is not hanged or anything. 

Any clues ?

Thanks in advance,
MSB

2. CreateEx used with manifest...

3. Creating Owner-Drawn Listbox using CreateEx function

I have created an owner drawn list box as follows
    DWORD dwFlags = 
WS_CHILD|LBS_OWNERDRAWFIXED|WS_BORDER|WS_POPUP|LBS_NOTIFY|LBS_NOINTEGRALHEIGHT;
    m_ListBox.CreateEx( 0, WC_LISTBOX, _T("ListBox"), dwFlags, 
CRect(10,10,250,250),this, 0 );

But the DrawItem call is not happening to the listbox.

Any clues?

-- 
-Sarath

4. What happen if delete a CWnd without calling CWnd::DestroyWindow()

5. MFC -- Why CWnd::SetFont don't work for CWnd derived class

Hi, 

I have a CWnd derived class CDerived. I call CWnd::SetFont
(pFont) in CDerived::OnCreate(...) and expect pFont be the 
selected font in dc created by CPaintDC(this). But it 
seems dc is still using system default font. pFont is not 
deleted in this period. 

Does CWnd::SetFont only work for controls?

Thanks, 
Nathan

6. Help with CWnd::SetFont and CWnd::GetFont

7. CClientDC(CWnd*).GetCurrentFont() and CWnd::GetFont() ??

Hello.

It seem I have missed something here ...
In a CTreeCtrl derived Class of mine I do:
...
CClientDC dc(this);
CFont* pDCFont = dc.GetCurrentFont();
CFont* pWndFont = this->GetFont();
LOGFONT fontInfo;
pDCFont->GetLogFont(&fontInfo);
pWndFont->GetLogFont(&fontInfo);
...

I would have assumed that the DC has the same font as the Window it is 
obtained for, but that is not the case.
The Font for the DC is reported as "System" and the Font for the Window 
is reported as "Tahoma" (this would be correct as this is the font for 
the dialog where the control is placed.)

Can someone explain?

cheers,
Martin

8. CWnd::Attach or CWnd::SubclassWindow???