Where have the wizards gone, ActiveX Controls
-
Hello, (I thought I should post this in the Visual Studio IDE forum but it says not to post any programming questions there) I am trying to move from VS 6 to VS 7 (aka .NET, aka 2003). The class wizard seems to be gone and instead replaced by options to add methods/variables/properties etc. How does one remove/delete methods/variables/properties without manually editing the code now that the wizard is gone. Secondly and more importantly, in VS 6 you could create a new project and select from the wizard the project's type to be MFC ActiveX Control. The wizard then allowed you to set the number of ActiveX controls the project should have. The problem with this was that once you set the number of controls, you could not later add more controls to that project (or is there?). The only way to do this as far as I know is to RESTART a new MFC ActiveX control project setting the control number higher and importing all the previous files again. In Visual Studio .NET when I create a new project of type MFC ActiveX Control, I no longer have the option to enter the number of controls the project should contain. As a result that project can only have one control. This raises the questions on whether this means there is now a method to add more controls to the project at a later stage instead of specifying such a number from the very begining and being stuck with it. Is this the case? How can I set the number of controls an ActiveX Control project has in Visual Studio .NET? Where have all the wizards gone? :wtf: Thanks, Aristotel
-
Hello, (I thought I should post this in the Visual Studio IDE forum but it says not to post any programming questions there) I am trying to move from VS 6 to VS 7 (aka .NET, aka 2003). The class wizard seems to be gone and instead replaced by options to add methods/variables/properties etc. How does one remove/delete methods/variables/properties without manually editing the code now that the wizard is gone. Secondly and more importantly, in VS 6 you could create a new project and select from the wizard the project's type to be MFC ActiveX Control. The wizard then allowed you to set the number of ActiveX controls the project should have. The problem with this was that once you set the number of controls, you could not later add more controls to that project (or is there?). The only way to do this as far as I know is to RESTART a new MFC ActiveX control project setting the control number higher and importing all the previous files again. In Visual Studio .NET when I create a new project of type MFC ActiveX Control, I no longer have the option to enter the number of controls the project should contain. As a result that project can only have one control. This raises the questions on whether this means there is now a method to add more controls to the project at a later stage instead of specifying such a number from the very begining and being stuck with it. Is this the case? How can I set the number of controls an ActiveX Control project has in Visual Studio .NET? Where have all the wizards gone? :wtf: Thanks, Aristotel
greekgoddj wrote: The class wizard seems to be gone and instead replaced by options to add methods/variables/properties etc. How does one remove/delete methods/variables/properties without manually editing the code now that the wizard is gone. The Class Wizard is gone. You can add new member methods/variables/properties by using the menu, but you must delete them manually. There's no auto-deleting option built-in. The new way to override virtual methods (such as adding Win32 message handlers) is to click on a class name in Class View, then use the Properties box on the right. I think this was a good introduction, because the code Class Wizard used to generate looked ugly as hell. You can further enhance your productivity by installing a third-party tool such as Visual Assist. greekgoddj wrote: -- Is this the case? How can I set the number of controls an ActiveX Control project has in Visual Studio .NET? Your approach is wrong. To create a multi-control ActiveX component, create an ATL Project (wizard) first. Call it 'My Controls', for example. Then go to Class View, choose 'Add Class' and select 'ATL Control' as type. This adds a new ATL ActiveX control into the project. Another method is to create an MFC ActiveX Control, then add ATL support and add ATL Controls like above. The MFC Class Library has been merged with ATL, creating the ATL/MFC Library which currently exists in VS 2003. This is visible through the documentation, and the introduction of classes like CStringT. It is _strongly_ encouraged to use pure ATL in creating ActiveX Controls. That is what ATL was built for: ActiveX Template Library. greekgoddj wrote: Where have all the wizards gone? You know how wizards are: short-tempered and quick to anger. It seems they've decided to take a leave. Microsoft became with a whole new approach to the wizard theme, replacing them with scripted dialogs that only generate pure code and cease to exist after they've been ran. This removes things like Class Wizard database files (which were always corrupt) and the ugly-looking defines and insertion point markings with triple-backslashes. I think it was a good thing. The code's clear, good-looking and easy to follow. It does introduce some more manual work, but using the mouse and Delete, I think it's pretty easy to remove unneeded variables/methods. Then about the versioning. Visual Studio version 6 was version 6. Version 7 is .Net 2002 and 7.1 is .Net 2003. V
-
greekgoddj wrote: The class wizard seems to be gone and instead replaced by options to add methods/variables/properties etc. How does one remove/delete methods/variables/properties without manually editing the code now that the wizard is gone. The Class Wizard is gone. You can add new member methods/variables/properties by using the menu, but you must delete them manually. There's no auto-deleting option built-in. The new way to override virtual methods (such as adding Win32 message handlers) is to click on a class name in Class View, then use the Properties box on the right. I think this was a good introduction, because the code Class Wizard used to generate looked ugly as hell. You can further enhance your productivity by installing a third-party tool such as Visual Assist. greekgoddj wrote: -- Is this the case? How can I set the number of controls an ActiveX Control project has in Visual Studio .NET? Your approach is wrong. To create a multi-control ActiveX component, create an ATL Project (wizard) first. Call it 'My Controls', for example. Then go to Class View, choose 'Add Class' and select 'ATL Control' as type. This adds a new ATL ActiveX control into the project. Another method is to create an MFC ActiveX Control, then add ATL support and add ATL Controls like above. The MFC Class Library has been merged with ATL, creating the ATL/MFC Library which currently exists in VS 2003. This is visible through the documentation, and the introduction of classes like CStringT. It is _strongly_ encouraged to use pure ATL in creating ActiveX Controls. That is what ATL was built for: ActiveX Template Library. greekgoddj wrote: Where have all the wizards gone? You know how wizards are: short-tempered and quick to anger. It seems they've decided to take a leave. Microsoft became with a whole new approach to the wizard theme, replacing them with scripted dialogs that only generate pure code and cease to exist after they've been ran. This removes things like Class Wizard database files (which were always corrupt) and the ugly-looking defines and insertion point markings with triple-backslashes. I think it was a good thing. The code's clear, good-looking and easy to follow. It does introduce some more manual work, but using the mouse and Delete, I think it's pretty easy to remove unneeded variables/methods. Then about the versioning. Visual Studio version 6 was version 6. Version 7 is .Net 2002 and 7.1 is .Net 2003. V
Thanks! I have gone ahead and started moving my MFC based ActiveX Control projects to ATL ActiveX projects with ATL controls supporting MFC. So far so good, however i do have the following problem with using ATL. In the MFC only version I was calling [code] Invalidate() [/code] everytime there were changes made to values that required for the display to be redrawn. Calling the same function in the ATL version of the ActiveX Control, gives me an assertion message. The part of the code the causes this message is [code] BOOL Invalidate(BOOL bErase = TRUE) throw() { ATLASSERT(::IsWindow(m_hWnd)); return ::InvalidateRect(m_hWnd, NULL, bErase); } [/code] I have not worked with ATL before. Has anybody come accross this before, and how does one tell the ActiveX control that it needs to update the display/graphics? Thanks in advance! Aristotel :cool:
-
Thanks! I have gone ahead and started moving my MFC based ActiveX Control projects to ATL ActiveX projects with ATL controls supporting MFC. So far so good, however i do have the following problem with using ATL. In the MFC only version I was calling [code] Invalidate() [/code] everytime there were changes made to values that required for the display to be redrawn. Calling the same function in the ATL version of the ActiveX Control, gives me an assertion message. The part of the code the causes this message is [code] BOOL Invalidate(BOOL bErase = TRUE) throw() { ATLASSERT(::IsWindow(m_hWnd)); return ::InvalidateRect(m_hWnd, NULL, bErase); } [/code] I have not worked with ATL before. Has anybody come accross this before, and how does one tell the ActiveX control that it needs to update the display/graphics? Thanks in advance! Aristotel :cool:
Great, afte loosing 2 hours or so on this matter, AFTER posting this thread, I found the answer. Well for those who need it in the future the answer is: [code] FireViewChange() [/code] Ciao ;P
-
Thanks! I have gone ahead and started moving my MFC based ActiveX Control projects to ATL ActiveX projects with ATL controls supporting MFC. So far so good, however i do have the following problem with using ATL. In the MFC only version I was calling [code] Invalidate() [/code] everytime there were changes made to values that required for the display to be redrawn. Calling the same function in the ATL version of the ActiveX Control, gives me an assertion message. The part of the code the causes this message is [code] BOOL Invalidate(BOOL bErase = TRUE) throw() { ATLASSERT(::IsWindow(m_hWnd)); return ::InvalidateRect(m_hWnd, NULL, bErase); } [/code] I have not worked with ATL before. Has anybody come accross this before, and how does one tell the ActiveX control that it needs to update the display/graphics? Thanks in advance! Aristotel :cool:
If it causes an assertion, the reason is clear. Apparently you're calling Invalidate for the CWindow-class. If this class's m_hWnd member is not a valid window, it will cause an assertion. The most common reason for this is that your CWindow class is not properly constructed, initialized and created. Perhaps you're calling Invalidate too early ? To avoid this, add a conditional sentence in front of your Invalidate call that will check if the window in question is valid. This way, Invalidate will only be called on valid windows and the assertion will never fire. Otherwise, ATL has nothing in special compared to MFC or Win32. The CWindow::Invalidate will call InvalidateRect Win32 function to do it's task. -Antti Keskinen ---------------------------------------------- "If we wrote a report stating we saw a jet fighter with a howitzer, who's going to believe us ?" -- R.A.F. pilot quote on seeing a Me 262 armed with a 50mm Mauser cannon.