CView method

I have a CView class which is instatiated as a runtime class. I have 
overridden the OnCreate( ) method but it never gets called. Here is how I 
the CView (MyView) object is created:

pDocTemplate = new CMultiDocTemplate(
IDR_MAINFRAME,
RUNTIME_CLASS(MyDoc),
RUNTIME_CLASS(ChildFrame),
RUNTIME_CLASS(MyView));


And here is my OnCreate method:


int MyView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
  AfxMessageBox("oncreate is getting called");
}

Why is OnCreate not being called?

Thanks.
Jess 


0
3/24/2006 12:50:36 PM
vc.mfc 33608 articles. 0 followers. Follow

2 Replies
756 Views

Similar Articles

[PageSpeed] 28

Have you provided the entry ON_WM_CREATE in the message map of your view
class?

-VSP
"Jessica Weiner" <jessica@gmail.com> wrote in message
news:wWRUf.59089$Jd.46506@newssvr25.news.prodigy.net...
> I have a CView class which is instatiated as a runtime class. I have
> overridden the OnCreate( ) method but it never gets called. Here is how I
> the CView (MyView) object is created:
>
> pDocTemplate = new CMultiDocTemplate(
> IDR_MAINFRAME,
> RUNTIME_CLASS(MyDoc),
> RUNTIME_CLASS(ChildFrame),
> RUNTIME_CLASS(MyView));
>
>
> And here is my OnCreate method:
>
>
> int MyView::OnCreate(LPCREATESTRUCT lpCreateStruct)
> {
>   AfxMessageBox("oncreate is getting called");
> }
>
> Why is OnCreate not being called?
>
> Thanks.
> Jess
>
>


0
abc1 (75)
3/24/2006 1:43:46 PM
As already mentioned, make sure your message map is has ON_WM_CREATE.
In addition, typically you will do the initialization in
OnInitialUpdate.

---
Ajay Kalra
ajaykalra@yahoo.com

0
ajaykalra (6841)
3/24/2006 2:30:23 PM
Reply:

Similar Artilces:

CView to CScrollView
I have an application view class that I derived from CView and now have discovered that it would be much better as CScrollView. Is there a relatively easy way to convert it or do I have to start over and do the cut-and-paste work??? Ron H. ----------------- www.Newsgroup-Binaries.com - *Completion*Retention*Speed* Access your favorite newsgroups from home or on the road ----------------- The usual technique is to create a CScrollView-derived class, copy the appropriate stuff out of it into your existing view, then remove the temporary CScrollView stuff from your project and delete the...

MailItem Find Method question
Using the Find method to find a Subject, I have a couple of questions. If the Subject is "Test", the following code finds the email. If the subject is "Re: Test", it does not. I have to remove the prefix. Why is that? If the subject is null, my code doesn't find the email. I figure someone can send an email without a subject. Any idea on correcting it? If Not IsNull(strSubject) Then Set objMail = _ objNS.GetDefaultFolder(6).Items.Find("[Subject] = """ & _ strSubject & """") Else Set obj...

Pls Help : Adding a method to the Mouse Move events of a form from
Hi, I would like to add a method to the Mouse_Move events of controls on a form from other assembly. From one assembly if i click a button that should inturn add a given method to the mouse_move events of other controls on another form. e-g: Namespace1. Form1 has a Textbox Textbox1 Namespace2. Form2 has a button button1. From Namespace2.Form2 when i click button1, i would like to add a method to the mousemove event of Textbox1 of Namespace1. I am aware that it can be done using reflection,but the posts i looked at had lot more other stuffs and i a...

ADO Find method
I would like to know if there is a way to use the ADO Find method to find one of several values for a single column. See the following example: rstOpenJobProcess.Find "[proc#] = '940' or '941'" I would like to search for proc# '940' or '941'. I want to avoid using a like statement in the criteria (such as [proc#] Like '94*') because I may use '942' for something else in the future that I would not want to search for. Is there a way to use the Find method in this way? Alternatively, is there a clever workaround? Th...

How to write into CView?
m_hwndRenderWindow = GetDlgItem(IDC_RENDERVIEW)->GetSafeHwnd(); My application looks like the above except that I'm not drawing into the IDC_RENDERVIEW from a formview. I draw directly to CView... What is the corresponding call if I do so? Thanks Jack "Jack" <jl@knight.com> wrote in message news:ulIMAjwAIHA.5868@TK2MSFTNGP05.phx.gbl... > m_hwndRenderWindow = GetDlgItem(IDC_RENDERVIEW)->GetSafeHwnd(); > > > My application looks like the above except that I'm not drawing into the > IDC_RENDERVIEW from a formview. > I draw directly t...

propertypage from CView
Hi, I want to create a propertysheet on Cview. Following the steps from msdn really doesn't show the sheet. http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore/html/_core_using_property_sheets_in_your_application.asp cause in step 3, it presumes it is based on a dialog. but mine is on CView. I put the code to create a sheet in CMyView::OnInitialUpdate CMyView::OnInitialUpdate(....) { sheet = new CPropertySheet(); page1 = new CMyPropertyPage(); page2 = new CMyPropertyPage(); sheet->AddPage(page1); sheet->AddPage(page2); sheet->Create(); } The above co...

Derived Class from CView : LNK2001
Dear all I'm trying to derive a class from CView. So I used the (VC++6) "MFC AppWizard (exe)" and selected a CView SDI Application. It works (no surprise). No I replaced all occurences of CView by CEditHLView -- snip CEditHLView.h -- #ifndef CEDIT_HL_VIEW_H #define CEDIT_HL_VIEW_H #include "stdafx.h" #include "afxwin.h" class CEditHLView : public CView { DECLARE_DYNCREATE(CEditHLView) public: CEditHLView() : CView() {}; ~CEditHLView() {}; }; #endif /* #define CEDIT_HL_VIEW_H */ -- snap -- If I now try to compile, I get the following error: thi...

How can I mass modify shipping methods on customer addresses?
Looking for alternatives on changing the shipping method on customer addresses. For all of our U.S. customers, I want to make the shipping method uniform, but don't want to change the customer class and roll down. -- Pete P. Run A script in SQL to update the Shipping Method with the parameter/s referring to your US Customer only "Pete Pillitteri" wrote: > Looking for alternatives on changing the shipping method on customer > addresses. For all of our U.S. customers, I want to make the shipping method > uniform, but don't want to change the customer class...

Problems bringing a CView to the foreground
Hi de hi, I'm working on an MDI app where we popup a dialog, then another dialog, input some info into the dialog, then we want to display a CView based graph on top of this. We need to zoom in/out etc, then eventually close the graph, and be back in the last dialog. I've scoured this newsgroup for ways to do this, and found several; unfortunately none of them work. I've tried the 3 following ways (all at the end of the OnDraw of the CView) GetParentFrame()->ActivateFrame(); ((CMDIFrameWnd*)GetParentFrame())->MDIActivate(this); SetWindowPos( &CWnd::wndTop, 0, 0, 0,...

Landed Cost Calculation Method #2
Add a new calculation method to allocate the landed costs over all items based on received/invoiced quantity. Currently I am only seeing the ability to do this based on flat amounts entire document, flat amounts for each line item or a percentage. Where in reality if you have a product that is based on weight, it would be best to allocate based on weight (however that is not not in the system). So our next preference would be based on each line items cases as a percentage of the total cases being received. ---------------- This post is a suggestion for Microsoft, and Microsoft respo...

MDI CView and some kind of bar at bottom of CView
Hi, I have created a MDI project with CView's using VS2008Pro. I want to have some sort of bar at the bottom of every CView where i can put controls on, like buttons. I dont know how this bar is called and how to create one for every CView. I have a picture of it here to explain what i want. http://www.4shared.com/dir/32975742/b4bac91c/CView_Bar.html Could someone please tell me what kind of bar this would be and how to create it for CViews? Thanks. I don't see any bar at the bottom of your linked picture. CView's do not have bars: CView's only fill what i...

How to Retrieve Random Records through webservice method
Hi All, I'm writing an application that retrieve records from CRM 3.0 automatically using the web service. My question is, is there any way we can retrieve records randomly by using any webservice method? Like we can use RAND() or NEWID() to achieve this in SQL. Please help me if you have any idea about it. My sample method code is given below: CrmService service = new CrmService(); RetrieveMultipleRequest request2 = new RetrieveMultipleRequest(); // Create the ConditionExpression object. ConditionExpression condition = new ConditionExpression...

Method to identify printer for docmd.printout
I would like to send a report automatically via e-mail. I can do this if Iselect one of the available formats (XLS, etc) but I would like to direct itto a pseudo-printer to create a PDF file. I have found no way to have Accessidentify a printer (other than the default printer). If a module exists toidentify a specific printer as default that would be nice - I could switchto, printout, switch back. Or if there is a way to have the printout go to aPDF format that would be a very good solution.I'd like to avoid the need for the user to manually shift default printers,do the print to it, then...

Please post this thread a correct full method, method about
Nast Runsome Customer Service Microsoft Corporation Subject: Please post this thread a correct full method, method about text-hovering in Microsoft Office Excel 2003. Dear, Customer Service: Please post this thread a correct full method, method about text-hovering in Microsoft Office Excel 2003. Drawing of .xls sheet in the Excel: ---------------------------------- A | B | C | D | E | F | G | I | J | K | L | M | N | | This is | | These are drawing of the .xls sheet in the Excel and and Above C column's all texts (C All Texts): This is example of the text-hovering hiding unhovering te...

Structure concerning CView, CPropSheet, CPropPage
I am maintaining an older applicaiton (VC++6) that has the following structure: MFC SDI The view creates 3 property page derived objects and 1 property sheet derived object. The view pointer is passed in as the parent (seems reasonable enough). The property sheet calls AddPage for the 3 property pages. My questions are: How does the property sheet fit into this structure? Does all the windows messaging work OK like this? If the view is the parent, what does AddPage do for the sheet? Last week I had posted a question concerning hierarchy and obtaining pointers etc. (thanks for the help). At...

Toolbar in CView
Hi, I have an SDI application with multiple CView and CHtmlView's devided by CSplitterWnd. I want to add toolbars to some of the panes (Not to CMainFrame). How can I accomplish this? /regards Tobias Tobias Svensson wrote: > Hi, > I have an SDI application with multiple CView and CHtmlView's devided by > CSplitterWnd. I want to add toolbars to some of the panes (Not to > CMainFrame). How can I accomplish this? > > /regards Tobias One way is to fill the splitter pane with a CFormView. Then put a toolbar on the CFormView using the method shown in the DLGCBR32 MF...

Put Shipping Method on Main Screen for SOP and POP
I have seen over and over where users forget to expand on the document in SOP to enter shipping method, and taxes are not calculated correctly, or they forget to expand on the Vendor in POP to enter the shipping method and the Ship To Address doesn't print correctly. Since Shipping Method affects so many other calculations, and since it isn't necessarily consistent by customer or vendor for a lot of distributors, this field should be on the main screens where it is easily visible. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestio...

Passing from a CDialog logic to a CView one
Hi, I am developping with MFC under Pocket PC and for some technical reasons I would like to convert an SDI application using a view and some dialogs into one using only views. Let's consider the following scenario : I have my SDI application that display a welcome view(CFormView). Inside this welcome view I have a button to accept or not Terms and conditions. If user accept conditions I would like to switch to the main view, if not, I would like to display a goodbye view. The problem is here : void CWelcomeView::OnYesCommand() { if ( ... == TRUE){ CViewMgr::GetInstance()->S...

CRM SDK
Hi, Is it possible to use the CRMQuote.Update method to update a field of a quote WHERE the quote is already activated? An activated quote has its fields in read-only mode, but I want to be able to update a custom field of an "activated" quote. Please let me know if this is possible, e.g., can I convert the quote to "update-mode", make the change, then put it back in read-only mode? thanks. ...

create proxy client class or web service method without using wsdl
Hi, Is it possible to create a proxy client class or a web service method by VS.NET without using wsdl? My stupid client is using a xml schema (.xsd) to describe all their web service methods (and my webmethods) by Java (Apache toolkit) instead of using WSDL. What should I do? Thanks a lot! Raymond Raymond, Yes, you can create a proxy by hand, but it may take a little bit of work, depending on how complex their message types are. It would be fairly simple for RPC formatted messages with primitive parameter types, but may require some work for document-literal messages. The best way to ge...

Trying to do progress bar
I have a Form with a progress bar and a thread that should update the progress every quarter of a second. The operation being monitored for progress on is a file loading job. So I start off the monitor like this: long currprogress = 0; FileInfo info = new FileInfo(currFile); long maxprogress = info.Length / 100; bool IsMonitoring = true; Thread monitor = new Thread(new ThreadStart(RunMonitor)); monitor.Start(); (the scope of these variables is class level though, just made them local scope for easier reading) Then my RunMonitor method looks like: private void RunMonit...

sliding CView
My application would require to change to a totally different view when going to the next step. Like in step 1, I will display a dialog, in step 2, i will display some images, in step3, i need to display some texts. Users can also switch back from step3 to step2 or step1. My initial idea is to create a propertysheet, but the size can't be changed after first layout. that would be very bad if users enlarge the main window. Now I am thinking of creating multiple views, with each of them loaded some controls to switch between different views. sounds silly. Anybody saw such kind of applictions...

SDI with CView
I have an SDI app with multiple CViews. The CViews have multiple edit and combo box controls on them. What is the best way to save the data for that view that has been entered ie what message do I need to handle so that when they come back to the view I can restore it's state. There are two cases I'm concerned about: 1. My view is being destroyed. 2. The user has selected save or exit from the top menu. I have tried handling the kill focus message for each individual control but that has some issues. Like if they have edited and not exited an edit box before doing a save. Never...

Images and word objects/methods
I need to write a VBA script (Macro's can't do it) to send an image file to the back of text in a word document, lock the anchor and allow the text to overlap. Alternatively/also does anyone know where I can find an object method library as I may have a few more questions and couldn't find anything when I googled . All help appreciated. VBA is the language used for macros in Word With ActiveDocument.Shapes(1) .LockAnchor = True .WrapFormat.Type = wdWrapBehind End With See the Help file in the Visual Basic Editor and from the View menu in the Editor, sel...

Hidden CView
Hi Everyone, I am creating a hidden CHtmlView, just so I can print it's content. It works perfectly, but I am bit uncomfortable with it. I have a feeling that it's going to bite me later. void LSActivityDoc::OnFilePrint() { //LSActivityPrintView inherits from CHtmlView CRuntimeClass *pViewClass = RUNTIME_CLASS(LSActivityPrintView); LSActivityPrintView * pView = (LSActivityPrintView *)pViewClass->CreateObject(); CRect rect(0,0,0,0); if (!pView->Create(NULL, NULL, WS_CHILD | WS_BORDER, rect, ::AfxGetMainWnd(), (AFX_IDW_PANE_FIRST), NULL)) { TRACE0(...