Creating a CDialog derived class for a Dialog??

I am trying to convert a project from Win32 to MFC.  I created a new dialog 
resource, but when I try to do the right-click add class thing from the 
dialog editor, it doesn't do anything.  I am using VS.NET 2003 Pro.  In the 
dialog that pops up to create the new class, I change it to derive from 
CDialog, it already has the ID for my dialogbox resource selected, and I 
enter a new class name, and it generates the .h and .cpp names.  I click 
Finish and NOTHING happens.

I try it again from the main menu, but this time it pops an error box saying 
"Object Required".

I am stumped.  

Thanks for any help.  I am about ready to give up.

0
TPFGuru (37)
12/11/2005 3:06:02 AM
vc.mfc 33608 articles. 0 followers. Follow

6 Replies
601 Views

Similar Articles

[PageSpeed] 8

TPFGuru wrote:
> I am trying to convert a project from Win32 to MFC.  I created a new dialog
> resource, but when I try to do the right-click add class thing from the
> dialog editor, it doesn't do anything.  I am using VS.NET 2003 Pro.  In the
> dialog that pops up to create the new class, I change it to derive from
> CDialog, it already has the ID for my dialogbox resource selected, and I
> enter a new class name, and it generates the .h and .cpp names.  I click
> Finish and NOTHING happens.
>
> I try it again from the main menu, but this time it pops an error box saying
> "Object Required".
>
> I am stumped.

Welcome to buggy and flaky 2003.

If you have a different version of the IDE, I'd go to it. I've had
horrible luck with random things like this in 2003.

0
darsant (187)
12/11/2005 5:47:00 PM
Time to restart VS or your computer.

---------
Ajay Kalra
ajaykalra@yahoo.com

0
ajaykalra (6840)
12/11/2005 6:44:03 PM
I ended up manuall creating the class, changing it to inherit from CDialog, 
and then I copied the needed stuff from the CAbout dialog class over to my 
new one.  At first it would not let me add any over-rides, messages, or 
events to the new class.  I gave up for a while, and when I went back in, the 
ability to add those things was just there.

After 6 months of trying to learn windows programming with VS.NET 2003, I am 
convinced that the last thing MS wants is for anyone to easily write windows 
applications.  I started with Win32 and DirectX.  The MS documentation is 
terrible, but I made progress with 3rd party books on the subjects.  Then 
(just a few days ago) I decided to switch my app to MFC to gain the added 
functionality with resources, and to learn it.

Something as simple as trying to change the color of a button control on a 
dialog box is proving to be quite the challenge.  I have tried 4 methods now, 
and none work.  One would think that there would be member variables in the 
CWnd class that you could change to easily change a window's or control's 
colors and fonts.  Nope.

I waded through the class definitions in the various afxxxx.h files to see 
how my CWinapp was derived, and what functions and variables I inherited.  I 
was amazed at how many times I saw classes declaring others as friend 
classes.  Apparently, the people that designed MFC could not figure out how 
design it and maintain the basic merits and purposes of object oriented 
design.

In contrast, DirectX is very well designed.  Thank god they did not use OOP 
for it.

Then, of course there are the numerous bugs in VS.NET 2003 that MS has never 
offered fixes for.  And, from what I have seen, the 2005 version is riddled 
with bugs too.  Apparently they would rather sell the XBOX at a loss and give 
away Internet Explorer than give programmers bug free easy to use and 
understand development tools.

They are trying to force the .NET format down everyone's throats now, even 
though they don't use it themselves for any non net applications.

"Ajay Kalra" wrote:

> Time to restart VS or your computer.
> 
> ---------
> Ajay Kalra
> ajaykalra@yahoo.com
> 
> 
0
TPFGuru (37)
12/11/2005 7:55:02 PM
>Something as simple as trying to change the color of a button control on a 
>dialog box is proving to be quite the challenge.

You've picked one apparently simple thing there that's actually quite
difficult to do - you have to use an owner drawn button control to
achieve it.

>And, from what I have seen, the 2005 version is riddled 
>with bugs too. 

If you have bugs that you can reproduce, please post them here and if
others confirm them, please submit a bug report at:

http://lab.msdn.microsoft.com/productfeedback

Dave
0
davidl7375 (2061)
12/11/2005 11:48:31 PM
Yeap.  Since MFC does not make things easier, I am going back to Win32.  I 
like the structure better, since you can have one function process all 
messages for a dialog box, instead of creating a class and/or creating 
separate functions for each message type and control ID.

"David Lowndes" wrote:

> >Something as simple as trying to change the color of a button control on a 
> >dialog box is proving to be quite the challenge.
> 
> You've picked one apparently simple thing there that's actually quite
> difficult to do - you have to use an owner drawn button control to
> achieve it.
> 
> >And, from what I have seen, the 2005 version is riddled 
> >with bugs too. 
> 
> If you have bugs that you can reproduce, please post them here and if
> others confirm them, please submit a bug report at:
> 
> http://lab.msdn.microsoft.com/productfeedback
> 
> Dave
> 
0
TPFGuru (37)
12/12/2005 3:46:02 AM
OK, so I was in a bad frustrated mood.  I am not giving up on MFC...


"TPFGuru" wrote:

> I ended up manuall creating the class, changing it to inherit from CDialog, 
> and then I copied the needed stuff from the CAbout dialog class over to my 
> new one.  At first it would not let me add any over-rides, messages, or 
> events to the new class.  I gave up for a while, and when I went back in, the 
> ability to add those things was just there.
> 
> After 6 months of trying to learn windows programming with VS.NET 2003, I am 
> convinced that the last thing MS wants is for anyone to easily write windows 
> applications.  I started with Win32 and DirectX.  The MS documentation is 
> terrible, but I made progress with 3rd party books on the subjects.  Then 
> (just a few days ago) I decided to switch my app to MFC to gain the added 
> functionality with resources, and to learn it.
> 
> Something as simple as trying to change the color of a button control on a 
> dialog box is proving to be quite the challenge.  I have tried 4 methods now, 
> and none work.  One would think that there would be member variables in the 
> CWnd class that you could change to easily change a window's or control's 
> colors and fonts.  Nope.
> 
> I waded through the class definitions in the various afxxxx.h files to see 
> how my CWinapp was derived, and what functions and variables I inherited.  I 
> was amazed at how many times I saw classes declaring others as friend 
> classes.  Apparently, the people that designed MFC could not figure out how 
> design it and maintain the basic merits and purposes of object oriented 
> design.
> 
> In contrast, DirectX is very well designed.  Thank god they did not use OOP 
> for it.
> 
> Then, of course there are the numerous bugs in VS.NET 2003 that MS has never 
> offered fixes for.  And, from what I have seen, the 2005 version is riddled 
> with bugs too.  Apparently they would rather sell the XBOX at a loss and give 
> away Internet Explorer than give programmers bug free easy to use and 
> understand development tools.
> 
> They are trying to force the .NET format down everyone's throats now, even 
> though they don't use it themselves for any non net applications.
> 
> "Ajay Kalra" wrote:
> 
> > Time to restart VS or your computer.
> > 
> > ---------
> > Ajay Kalra
> > ajaykalra@yahoo.com
> > 
> > 
0
TPFGuru (37)
12/13/2005 1:56:01 AM
Reply:

Similar Artilces:

create a roster
How can you create a weekly roster in which functions can be assigned to more than 10 people. The roster should be updatable, so that when holidays and days off are marked on the weekly roster they will be taken account of it future rosters. ...

verify that a dialog box exists
I want to verify that a dialog box exists before I send it some message. I have a pointer to its object. Can someone remind me please? Thanks George > I want to verify that a dialog box exists before I send it some message. I > have a pointer to its object. > Can someone remind me please? > if(pDlg && pDlg->m_hWnd) { .... } --- Ajay > I want to verify that a dialog box exists before I send it some message. I > have a pointer to its object. > Can someone remind me please? > You can use ASSERT_VALID as well. It works in Debug only but its of great...

importing or creating reference footnotes
I am trying to import a word document into publisher and it has reference footnotes within the document. The reference footnotes are not coming into the publisher document with the reference footnotes. Correct, they will not up to Publisher 2003. In Publisher 2003 depending on which version of Word you are using if they will or not. -- "If you don't know where you are going, any road will take you there!" ...

using CList as a base class in an extension DLL
Hi all. I must be doing something wrong but cannot figure it out. I have a data class and a list class, in an extension DLL, declared like this: >#define DllExport __declspec (dllexport) >class DllExport CRate : public CObject { >public: > DECLARE_SERIAL (CRate) > CRate () { m_Rate = 0; } > CRate (const CRate &in) { *this = in; } > > const CRate& operator= (const CRate& in) > { m_Rate = in.m_Rate; m_Date = in.m_Date; return *this; } > > bool operator== (const CRate& in); > bool operator!= (const CRate& i...

Mailbox not created when AD account created
A couple of days ago I noticed that I created a user account but the 'Email Addresses' tab of the user properies did not list any email addresses. Subsequent new user accounts have all experienced the same. I researched the knowledge and tried the recommended solutions to either manaully start the recipient update service or rebuild te recipient update service. Neither recommendation has resulted in a mailbox being created for this particular user or any additional user that I have created since this error first showed up. I performed a Windows update last Thursday and so I bel...

Task Create - Status
I'm trying to make a simple task, when a user owner is assigned a task in CRM, it receives an email letting it know it has one. I have the following below, but it is not generating one when i assign one manually in the CRM. What to do? I've tried both the following: When task is created E-Mail to:[owner];Subject test As well as: When task is created if Task activity status = Open then E-Mail to:[owner];Subject test I've checked the mailserver many times over, and I can send emails manually from the CRM so you can rule that out Tested out ok on our end. Some ideas:...

Scrollable Dialog with the toolbar
Hi Folks , Someone please tell me how to create a scrollable dialog with a Toolbar. I have a CFormview and inside that I have placed a CTabctrl . I need the toolbar for the tabs and each tab should be scrollable I could create something similar but the scrollbr scrolls the toolbar too !! I want it to be fixed and the remainning part of the dialog should be allowed to scroll. Regards, JLD <ggurubasavaraja@gmail.com> wrote in message news:1191585195.063726.41740@k79g2000hse.googlegroups.com... > Hi Folks , > > Someone please tell me how to create a scrollable dialog with ...

Help Creating XmlNode / XmlAttribute Elegantly
I am creating a configuration class to read / write a standard configuration file. <?xml version="1.0" encoding="utf-8"?> <configuration> <appSettings> <add key="ConnectionString" value="server=(local);" /> </appSettings> </configuration> I am using a XmlDocument for my base implementation. I am looking to see if there is a better way to add a new node / attribute than using XmlDocument.InnerXml. I would consider this to be a hack but couldn't really see another way of doing this without definin...

Create external database
Hi all. I need to create an external database (file). On a site I found this code: ------------------------------------------------------ Function CreateLinkedExternalTable(strTargetDB As String, strProviderString As String, strSourceTbl As String, strLinkTblName As String) As String 'strTargetDB = Source Database Name 'strProviderString = Not used, currently hard coded 'strSourceTbl = Source Table name in the database we are linking too. 'strLinkTblName = Table name we would like to see in the Access Database. Dim catDB As ADOX.Catalog Dim tblLink As...

How to create pie chart with %
I have got a problem that I don't if excel could help me to calculate the % within a column and draw a pie chart. My case is I have a column containing a series of numbers. e.g. 1,4,8,1,3,9,11,2,4,5,6,.........etc I want to draw a pie chart that showing 1-3 , 4-6, 7-9, >9 with the corresponding % inside that column. Can anyone tell me how can I make it ? Ray - You need to calculate the frequencies in your data. Let's assume your data is in A1:A12. In B1:B3 enter these numbers, the upper limits on the groupings: 3 6 9 You can enter ">9" into B4 witho...

Email address not created when a new user is created
All, This issue recently happened in my company. Upon creating a new user, the policy was set to create the smtp and X400 address automaticaly. Now when we create a user the smtp and x400 addresses are not created, and when attempting to setup the new user in outlook, the address cant be found. We are using exchange 2003 SP1 on Win2k3 servers. On Wed, 13 Jul 2005 06:49:07 -0700, "Bryan" <Bryan@discussions.microsoft.com> wrote: >All, >This issue recently happened in my company. Upon creating a new user, the >policy was set to create the smtp and X400 addres...

when form created
I have a form which was created by someone else (not a form template) which is like a questionnaire with empty boxes to be completed. When the boxes are typed in all the margins move to accommodate the words being typed. Is there a way to fix/lock the original form and then just fill in the blank boxes? I suspect this is set up as a table with auto resizing enabled. Displaying table gridlines (Table | Show Gridlines) will help you see what you're dealing with. Then select the table, go to the Table tab of Table Properties, click Options, and clear the check box for "A...

Exchange 2010 MRM, no log files being created
I'm hoping someone can help me with this issue....it has been driving me crazy for days. I have enabled MRM logging on our exchange server, and I can see that some of the policies are working when I run start-managedfolderassistant. We have a retention policy tag on the deleteditems folder, and this does work. The problem is I am not getting any files in the MRM log directory. C:\Program Files\Microsoft\Exchange Server\V14\Logging\Managed Folder Assistant Events 9021 and 9022 are logged in the Application log, but where are the files? Below is the output of my mai...

"Class not registered" startup error
Beginning a week or so ago, when I start Excel 2000, I get Class not registered. Looking for object with CLSID:{AC9F2F90-E877-11CE-9F68-00AA00574A4F} This occurs whether opening an existing file, a template, or "nothing". Two questions; what did I do to cause it, and how do I fix it. Aside, I got a significant spyware infection in the same timeframe, and killing it messed up lots of things ... this problem may have occurred along with that. TIA, George ...

Question: Dynamic DLL loading / Class export
Hi. I have a class that is exported by a DLL. I have a header shared between the DLL and the app. I want to dynamically load the DLL, then call members of the class I have a function createobject that creates an object and sets the parameter to a pointer to that objec //dll.h// class objec void method() } extern "C" __declspec(dllexport) void CreateObject(Object **o) // //code.cpp//// typedef void (*MYPROC)(Object**) HINSTANCE hLib = LoadLibrary("DLLNAME.DLL") MYPROC LoadProc = (MYPROC)GetProcAddress(hLib,"CreateObject") Object* object LoadProc(&o...

Creating a Brochure
How do you create a 3-column brochure from scratch for Publisher 2002? I can only find the directions for the 2003 version. Quick help would be appreciated, project is due Monday. Create a three-panel or four-panel folded publication http://office.microsoft.com/en-us/assistance/HP011646681033.aspx Scroll down to the section that says "Build a three-panel or four-panel publications from scratch." -- Mary Sauer MSFT MVP http://office.microsoft.com/ http://msauer.mvps.org/ news://msnews.microsoft.com "Derek" <Derek@discussions.microsoft.com> wrote in message news...

How to create Access macro shortcut
I'm still using Access 97 and saw something the other day that I would like to use that was in Access 2000. In an Access 2000 database, there was a .mam file in a directory that launched the Access 2000 program and ran a macro. How do you set this up? Can it be done in Access 97? If so, how? Hi. > How do you set this up? Select the macro in the Database Window and right click with your mouse, then select "Create Shortcut..." in the pop-up menu. Follow the prompts for where to place the shortcut and what to name it. The default is: <PathToDeskTopDir>\Shortcut ...

Users mailboxes not created when user created
I have a problem that recently just started happening on my exchange 2003 server. When i create a new user account and create the mailbox for exchange, once im done, the mailbox isnt created, adn if you go into the properties of the user account adn go to the exchange email address tab, there isnt an smtp or an x.400 address listed. I am having to manually create and add these, adn then go delete the exchange mailbox and recreate it. This is really annoying and would love to know if anyone has any ideas of how to fix it. Thanks Jason In news:9F836A43-98BF-435A-AA43-AFF10124BE3F@micro...

Creating an ad book
How do I divide a page into equal sections (halves, qarters, eights)? I need to scan and type ads and coupons into this booklet. New at this. After managing to set up OE-QuoteFix on his new PC, Ed reads a message from FRSH <anonymous@discussions.microsoft.com>... > How do I divide a page into equal sections (halves, qarters, eights)? Arrange > Layout Guides > Grid Guides -- Ed Bennett - MVP Microsoft Publisher http://www.mvps.org/the_nerd/ Before reading this message, view the disclaimer: http://mvps.org/the_nerd/disclaim.htm ...

CRM should let me create custom fields in batch
Hi, With MS CRM v3.0, when we have a group of fields to create, it would be faster to be able to enter the list and then submit the list for processing. Thank you. Felix. ---------------- This post is a suggestion for Microsoft, and Microsoft responds to the suggestions with the most votes. To vote for this suggestion, click the "I Agree" button in the message pane. If you do not see the button, follow this link to open the suggestion in the Microsoft Web-based Newsreader and then click "I Agree" in the message pane. http://www.microsoft.com/Businesssolutions/C...

How to view HTML page in a dialog
I have and HTML and need to navigate them using VC++ , is this possible? Yes, it is. If you need to show a static htlm page you could use a CDHtmlDialog. You must add this static page as resource to your app. http://www.codeproject.com/useritems/luo31.asp http://www.codeproject.com/dotnet/dhtmldialog.asp or you can host a webbroser control in your app http://msdn.microsoft.com/library/default.asp?url=/workshop/browser/webbrowser/tutorials/wbtutorial.asp -- Un saludo Rodrigo Corral Gonz´┐Żlez [MVP] FAQ de microsoft.public.es.vc++ http://rcorral.mvps.org ...

Access unable to create an MDE
I am getting this message when I try to make an MDE: "Access unable to create an MDE database" No error mesages or any other info is displayed. I haven't had this trouble before. Then I added a form, a couple reports, an create table query, modified a toolbar and added a module. Now I am getting this message. This database is a front end of a project with several linked table to a back end. Any suggestions? Thanks Jeff G Try compiling your application (under the Debug menu when you're in the VB Editor). Often an application will have some error that doesn't m...

Class action?
Version: 2008 Operating System: Mac OS X 10.5 (Leopard) Processor: Intel I've been extremely discouraged and frustrated by the office 2008 "suite". Beyond missing features from the PC version, Word is unusable (it crashes constantly), same with clip art and most of the other applications. I'm not even using spaces to attempt and keep office running smoothly. Considering how long this has been out and that we're on 1 major and 7 minor updates, has anyone considered legal action for the abhorrent quality? "Legal Action"? On what basis? Certainly none of the poin...

create a database from which bibliography an be created
How do I create a database from which a bibliography can be added to the end of a Word document? I used the program RefManager, but that is too expensive for me to update. Does Word 2003 have such a program? Thanks Not natively. Have you checked your academic institution? They might have campus licenses which students can use at home. You could give Zotero a spin (www.zotero.org). Personally, I don't like it, but that's just me. Word 2007 comes with referencing capabilities, but they are limited in functionality. Anything special you want, you would have to add i...

Error creating activities from Cases
Hi I have an out of the box SBS 2003 CRM Setup I have installed Rollup1 and the new help files Under about MS CRM it has CRM 3.0 (3.0.5300.0) When we try and create activies from within a case, we get the following to errors in the event log We can create the activities just fromthe main web client menu ok The same thing happens in the outlook client (OL 2003, Exchange 2003) I found some links to verabose stuff, but they all applied to the have MS CRM setup on multiple server. We have tried it with and without Outlook open Anyhelp appreciated Event Type: Error Event Source: MSC...