CWnd creation question and CFrameWnd question

So you create a child window use CWnd::Create().  I can create a main window (windows window?) by using CFrameWnd::Create().  I'm trying to figure out how to create my own CFrameWnd from Cwnd and how they are related.  Since CFrameWnd is a subclass of CWnd, shouldn't I be able to create a main window using CWnd::Create?  It keeps asserting an error that I can't seem to trap (it just ends to app if I select Debug and if I step into it manually, I can hold down F11 for about a minute and it just keeps going through assembly code and such).  I'm thinking because I send it NULL for the parent window.  Is there a pointer to the desktop I should give it?  Or do I have to use CFrameWnd?
0
anonymous (74717)
5/14/2004 9:56:02 PM
vc.mfc 33608 articles. 0 followers. Follow

3 Replies
1100 Views

Similar Articles

[PageSpeed] 44

Np, you would use CFrameWnd::Create. If you are running under the debugger, you may have
more luck in getting control. F11 is probably the wrong approach to dealing with this.

Question: why do you need to create your own frame window? AppWizard generates all the
code to do this for you.
				joe

On Fri, 14 May 2004 14:56:02 -0700, "Yasoo" <anonymous@discussions.microsoft.com> wrote:

>So you create a child window use CWnd::Create().  I can create a main window (windows window?) by using CFrameWnd::Create().  I'm trying to figure out how to create my own CFrameWnd from Cwnd and how they are related.  Since CFrameWnd is a subclass of CWnd, shouldn't I be able to create a main window using CWnd::Create?  It keeps asserting an error that I can't seem to trap (it just ends to app if I select Debug and if I step into it manually, I can hold down F11 for about a minute and it just keeps going through assembly code and such).  I'm thinking because I send it NULL for the parent window.  Is there a pointer to the desktop I should give it?  Or do I have to use CFrameWnd?

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
5/14/2004 10:37:47 PM
> Np, you would use CFrameWnd::Creat

So you can't create a CWnd for your main window?  You have to use a CFrameWnd? 

> Question: why do you need to create your own frame window? AppWizard generates all th
code to do this for you

Which part of the Wizard?  I have used the Wizard for Dialogs, DOS apps, and dlls.  I am going with your theme of not painting on a Dialog except I'm trying to create a generic window and see how I can create it without a titlebar and all that to see how it works. 

0
anonymous (74717)
5/15/2004 12:16:02 AM
Yes. Otherwise, you have problems with menus, you don't get message routing, etc. There's
a lot of semantics to CFrameWnd that MFC assumes, and if you just create a raw CWnd, you
won't get the correct results.

AppWizard is used to generate dialog-based apps, console apps, and DLLs. 

This is not the correct solution for avoiding drawing on a dialog. The correct solution
for avoiding drawing on a dialog is to create a child window and draw on that. 
					joe

On Fri, 14 May 2004 17:16:02 -0700, "Yasoo" <anonymous@discussions.microsoft.com> wrote:

>> Np, you would use CFrameWnd::Create
>
>So you can't create a CWnd for your main window?  You have to use a CFrameWnd?  
>
>> Question: why do you need to create your own frame window? AppWizard generates all the
>code to do this for you.
>
>Which part of the Wizard?  I have used the Wizard for Dialogs, DOS apps, and dlls.  I am going with your theme of not painting on a Dialog except I'm trying to create a generic window and see how I can create it without a titlebar and all that to see how it works.  

Joseph M. Newcomer [MVP]
email: newcomer@flounder.com
Web: http://www.flounder.com
MVP Tips: http://www.flounder.com/mvp_tips.htm
0
newcomer (15974)
5/15/2004 4:39:02 AM
Reply:

Similar Artilces:

Questions RE: installation and set-up
Hello-I have an existing OE 5.0 account (at least I hope it stil exists). I just perfomed a complete system reboot, and now need t re-activate my account using my same address. How do I do that? I hav forgotten how since I purchased my computer 5 years ago. Also, wher would my inbox messages be (the ones I had before reboot)? Thank Yo ----------------------------------------------- ~~ Message posted from http://www.ExcelTip.com ~~View and post usenet messages directly from http://www.ExcelForum.com ...

CWnd::Attach or CWnd::SubclassWindow???
Hi guys, I'm trying to capture WM_SHOWWINDOW (for an example notepad.exe) from another CWnd object. I also want the CWnd object to be deleted away when the targeted CWnd destroys. Apart from using hook, can I achieve it by using CWnd::Attach or CWnd::SubclassWindow? If that's so, which one is a better approach? Thanks in advance. ...

Matching a Date question
Is there a way to match todays date with 2 other data ranges? One is in a named range on a data sheet and the other in a row on the page. When comparing the first two, there would only be the possibility of 1 match (I've been using an array formula for that. {=SUM(COUNTIF(RangeName,A1:AA1))} The end result is to populate a cell with a 5 when all three match each other. I hope this isn't too confusing. I'm trying to clarify a previous post. Do you mean =IF(AND(COUNTIF(RangeName,TODAY())>0,COUNTIF(A1:AA1,TODAY())>0),5,"") -- HTH Bob Phillips (remov...

Send e-mail to customer on creation of an appointment
I would like to create a workflow which will send an e-mail when an appointment is created. That e-mail should be sent to the required attendee of that appointment. It looks as if it is only possible to send e-mail to owner/owner manager. Does anyone know how this can be done? Remco Hi Remco, Did you find a solution for this? I am having a similar problem where I want to send an email to the account owner of a case but can only pick the owner of the case. Thanks Simon "Remco" wrote: > I would like to create a workflow which will send an e-mail when an > appointm...

Help with CWnd::SetFont and CWnd::GetFont
The documentation for CWnd::SetFont and CWnd::GetFont are horrible. I'm creating a custom window that works as a control on a dialog box. Ideally, the control would automatically use the dialog font but I'm not sure how best to hook that up. Since that wasn't working, I instead called SetFont on my control after it was created. Then, when the control paints, it uses GetFont to obtain the font. However, GetFont is returning NULL. I was carefully to make sure the font specified in SetFont was not destroyed until after the dialog box closed. Can anyone tell me what I'm missing ...

CWnd as a main application window
Hello, I have problem with parent wundow. I create MFC project based on CDialog as a main window of application. creator does it in OnInstance method of class derived from CWin|App. I woul like to change the CDialog class to CWnd. I would like to make CWnd instance and use CreateEx method to create it. as parent parameter I write NULL, becouse I want my window to be main window. but CreateEx always return FALSE. Could onybody help me?? regards woyt/. If you are directly using CWnd derived class means, first you have to register a window class and then use CreateEx CString csClassName = AfxR...

problem with scrollbars in cwnd
hi, I have a class derived from CWnd. Is it possible to use the scrollbars of cwnd to automatically scroll the content that is drawn on the window. I have enabled the scrollbars, but it seems they do not function with cwnd. thanks, hamid wrote: > hi, > I have a class derived from CWnd. Is it possible to use the scrollbars of > cwnd to automatically scroll the content that is drawn on the window. I have > enabled the scrollbars, but it seems they do not function with cwnd. > > thanks, > > Scroll bars in the CWnd class do not scroll the image. They merely notify...

Font Question
The default Font in Excel is #10 Arial. Is there a way to change that? Bernie Beal On May 26, 7:57=A0am, "Bernie Beal" <bqu...@optonline.net> wrote: > The default Font in Excel is #10 Arial. Is there a way to change that? > > Bernie Beal goto the TOOLS|OPTIONS menu then General tab regards David ...

Trendline Question
Hello, I have a chart from a simple data set that plots a new point each day. It's my blood p vs date. I also have it show on the chart a "Trendline" linear fit, which I guess is the rms of the data points. Works just fine. Question: Is it possible to have the Trendlinebe computed for, and show on the chart for, Only a particular range of dates in the data, rather than the for the whole data set ? e.g., if my data goes from Sept, 2006 to the present, can i just have the Trendline show for the Jan 2007 to the present data points ? How, please ? Thanks, Bob Hi, Ye...

OnDrop Question
Hi Everyone, What I am trying to figure out is: When my COleOnDropTarget::OnDrop is called, is there a way to find out where the COleDataObject came from? I have a window that allows drag and drop and also excepts drops of the same clipboard format. I want to know if the item begin dropped originated from the same window. Since I am using a none standard clipboard format, I could place the for example the HWND of the source in the data being passed to my COleDataSource, but I am hoping there is a better way. Thanks AliR Unfortunately, there doesn't appear to be any way to determine ...

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 contro...

A Concatenate Formula Question
I am using Concatenate to build strings from a spreadhsheet. Mostly these are based on prior records. My data was delivered sort of like this Parent | Name "" | Dockmaster Dockmaster | Level 1 Dockmaster | Level 2 Dockmaster | Level 3 None | Wharfloader Wharfloader | Level 1 etc So I created a new field FullName and used Concatenate to say if Parent<>"" then Concatenate PriorRecord#_FullName + CurrentRecord_Name e.g. Dockmaster Level 1 Obviously when ti gets to Wharfloader si...

Built in Form Question
Is there any way to have the form created by Data/Form come up showing the info for the selected row in a Excel database? When I choose Data/Form, it pops up showing the header for the database. I would like it to show the info for the row that is selected. Perhaps a macro of some sort? Thank you. In article <118p9n0n9hddh64@corp.supernews.com>, "Jack Gillis" <XXXXXXXX@widomaker.com> wrote: > Is there any way to have the form created by Data/Form come up showing > the info for the selected row in a Excel database? When I choose > Data/Form, it p...

2 Questions
my first question is i have a recipe web site up but i have tried almost every search engine i can not seem to find any kitchen utensil clip art to use in the ingredients sections of the recipes. The web site is: http://shirleysrecipes.awardspace.biz. I need clip art that is applicable to the ingredients listed. Does anyone know what i can do? My other question is does anyone know of any free sub-domain web hosts that give the best bang for you time, including the capability to publish office 2007 and earlier files so they can be opened on the web instead of saved to the hard di...

query question 12-05-07
Hi all, I need some help with this one not sure if it even possible. I have a table that has identifier number, transaction number, status, and comments field. In the 1st query I look in the comments field to find a specific date (using Like). That query shows me all that is Postperiod. What I need is for the preperiod records to show up in a query by themselves. I have tried to use NOT Like but this doesn't provide me with correct results. Anyone have any idea how I can do this? thanks in advance! -- Message posted via AccessMonster.com http://www.accessmonster.com/Uwe/Forums.aspx/acces...

HQ Licensing question V.2
I have a client running HQ client at 8 stores + HQ server at the warehouse. They would like to be able to use transfers from the warehouse to the stores, so I would have to setup a new PC running Store Ops and a new database, however, in order for the transfers to take place, I need a HQ Client License correct? Do I also need a POS key? I appreciate any insights you may have. Thanks in advance Hi Phil yes - you'll need an HQ Client license so it can exchange with your headquarters - "export" the wh database as you would any store from HQ no - you won't need a PO...

Problem with CWnd Derived class
Hi! I'm making an sdi aplication in the client area I would like to put a child window. I have try it with a child window derived form CFrameWnd, but it doesn´t work so i'm trying it now with a window derived from CWnd, but it doesn´t work i have an asser when i try to modify the window style. Is this the right way to make a derived class from CWnd ? How can I resolve my problem? Thank you very much. PTZControlWindow::PTZControlWindow(PlayFile *pf) { CString strMyClass; strMyClass = AfxRegisterWndClass( CS_VREDRAW | CS_HREDRAW, ::LoadCursor(NULL, IDC_...

Excel 2000 Question #3
I have a workbook with 4 sheets and I need the date to copy or duplicate everytime I open it up on all 4 pages in one cell how do i do this?? Thanks John Hi you may give some more details what you're trying to achieve: - what date should be copied - Do you want to put this in a specific cell on each worksheet Maybe the following will do what you want. Put the code in your workbook module Private Sub Workbook_Open() worksheets("Sheet1").range("A1").value = now worksheets("Sheet2").range("A1").value = now worksheets("Sheet3&qu...

Number of rows over 30 days after creation
Hello, I am looking for a formula that would allow me to count the number of rows that have a date in col N6:10000 and of them are over 30 days old that have don't have a date in col AA6:10000 which indicates that the row has been 'closed' I was thinking i'd need an 'imput todays date' cell (though if there was not a need for onew that would be great) and that cell is K2 I created column that gives the date of col N+30 which is col AJ and col AI returns a 1 or 0 if the col AA has a date in it or not. so i tried the formulas : =COUNTIFS(N6:N10000,"*...

WAB Questions #2
Hi, 1> Can WAB use my application to dial out numbers instead of Microsoft Phone Dialer. ie suppose there is no application running on my PC and i start WAB. I select an entry and choose "Dial..." from "Actions". After I select the phone number(whether home ph, business ph. or mobile ph.), my application starts and the number is dialed from my application(the same way as the Phone Dialer opens up and dials the number) 2> When I call IAddrBook::Address(), the common address dialog box appears. I have two options to select the entries from - Shared Contacts and ...

? Getting CWinApp* from CWnd*/HWND
Hi, I'm working on a Spy++/WinSpy type application where the user can drag and drop a window picker to select a window and get a bunch of information on it. I've got the picker working and I can already display a lot of information about the window using the CWnd* I get. However, I cannot figure out a way to get a pointer to the CWinApp that spawned the target window. I would like to display some application information (especially the command line that was passed to the program that owns the selected window). Is there some way to get the application from a CWnd* or HWND? ...

creation of an app for record and monitor educational programs and certifications
Hi, i'm going to make a db for a small edu org. i have employees with specific roles and edu issues for each role. i need: 1) an Edu Program with info for: witch role is going to train, whitch is the starting date and the Edu Duration. 2) a seminar program with info for: Edu Program, Employee and if he came to seminar and info for the test results (rank). From the rank i will have certification status for each employee 3) a certification status for each employee with info for: date of certification, duration of certification, employee with certification, edu issue i have ...

Report writer line length question
I am modifying a report and I am adding fields and trying to create the appearance of boxes using lines and the lengths do not adjust a pixel at a time. Using the mouse they move about 8 pixels at a time. This is very frustrating trying to line everything up correctly. I would appreciate any solutions to this problem. Al, Try highlighting the line (or click on the line) then press the CTRL or SHIFT Key then use the arrow keys. Hope this helps. Gerald "Al" wrote: > I am modifying a report and I am adding fields and trying to create the > appearance of boxes using lin...

XMLNode
I have a web service method that returns an XMLDocument. The signature is: public XmlDocument GetPOs() The following client code calls this method but it accepts an XMLNode instead of an XMLDocument and my first question is why does this work? XmlNode neNode; neNode = myHFCService.GetPOs(); DataSet myds = new DataSet(); byte[] buf = System.Text.ASCIIEncoding.ASCII.GetBytes(neNode.OuterXml); System.IO.MemoryStream ms = new System.IO.MemoryStream(buf); myds.ReadXml(ms); gvOrders.DataSource = myds.Tables[0];...

how to create cwnd in cappthread
I need to create a cwnd derived class in a cappthread... how do I go about doing that? the cwnd is just being used to process WM_COPYDATA messages. Thanks, Nick sorry, CAppThread is my CWinThread - derived class. So all I want is to spawn my CAppThread with a couple parameters, and have it create my CWnd class which will respond to messages sent to it. "Nick Schultz" <nick.schultz@flir.com> wrote in message news:%23Xemj3s5IHA.2060@TK2MSFTNGP02.phx.gbl... >I need to create a cwnd derived class in a cappthread... how do I go about >doing that? > > the c...