Which VB6 controls are supported by Microsoft? - vb6

I'm looking for a replacement for the Sheridan 3D Panel (ssPanel) and I'm trying to figure out which of the Controls in the Projects>Components I can add to my project which will be supported by Microsoft. (I.e., I don't want to add a control that MS doesn't officially "support", like the MS Forms 2.0 Object Library).
Update
Microsoft does still support VB6 (or at least the files that it uses)

There is no list of supported controls: you have to look at the list of supported OCX files in the Microsoft Support Statement for VB6. You need to figure out which controls are in those OCXs. You could start a new VB6 project, tick the OCXs in Project-Components, and see which controls become available in the toolbar.
Confession I have made this answer Community Wiki, because this information was originally in a comment to another answer, but that answer is now deleted. Feel slightly guilty as I downvoted the answer (it said VB6 is unsupported which is misleading).

What part of the SSPanel behaviour do you need?
If it's the custom appearances (raised 3D edge etc.) it's not too hard to write a user control based on the intrinsic VB6 Label and Line controls. Have a look at the edge of the SSPanel in the magnified screenshot below. It's just a one pixel border. The colours are system colours: left and top are "button highlight" &H80000014& and the right and bottom are "button shadow" &H80000010&. Put four line controls in a user control and write code in the resize event to move them to the edge of the control.
alt text http://img194.imageshack.us/img194/5376/sspanelzoomin.png
If you need a label that can act as a container, you could make your user control capable of being a container (set ControlContainer True).
Vertically centred text. Offhand I don't know a good way to do that. Google is suggesting creating a user control with a PictureBox and using the TextHeight method.
EDIT There's another approach, which I'm using in some of my projects. Just continue to use the SSPanel despite it's being unsupported and with awareness of its various problems. It does seem to work fine on Vista and XP - haven't tested yet on Windows 7.

Just as a side note to expand on MarkJ's thought (I realize this question is a little old, but I recently had to deal with porting some old VB apps): There are some cases where SSPanel is used as a container with background colors, and without text. Although it may seem like stating the obvious, the Forms.Panel does work fairly well class to avoid the "Sheridan 3D Controls" dependency and make distribution easier in these simple cases.
The VB.net converter tool may generate something like:
Public WithEvents ssPanel As AxThreed.AxSSPanel
Me.ssPanel = New AxThreed.AxSSPanel
ssPanel.OcxState = CType(resources.GetObject("ssPanel.OcxState"),
System.Windows.Forms.AxHost.State)
CType(Me.ssPanel, System.ComponentModel.ISupportInitialize).EndInit()
Which is easily changed to:
Friend WithEvents ssPanel As System.Windows.Forms.Panel
me.ssPanel = New System.Windows.Forms.Panel
' No longer necessary:
' ssPanel.OcxState
' CType(Me.ssPanel, System.ComponentModel.ISupportInitialize).EndInit()

A comment from MarkJ made me re-read the Q, and from "replacement" I now understand this is likely a re-code/new version project, not a start from scratch... the original answer below is not accouting for that.
Meanwhile, MS says it's suportting a core runtime file of a language that has no roadmap or committed resources (?), so bottom-line of my answer still stands: vb6 stopped, new projects can go Python, vb.app, java, c++, C#, whatever.
Original:
None. VB6.0 reached its End-Of-Life. Go Python! or Java, or C#... never vb .net, because it's tons harder/dense than Java, not VB6.0 syntax in the slightest, and the learning curve is just a notch under C#.
P.S. It's so interesting to have negative votes because I trashed vb .net when compared to java or c#.
I wonder what these guys would think of me, being a former vb6 programmer, and not moving to any of the .net flavors.

Related

Can you change the theme of an existing powerpoint with Python-pptx?

I was wondering if there was any way I could change the theme of an existing PowerPoint using Python-pptx.
I realise that the easiest way of inserting a specific theme of a powerpoint, you just open a "template powerpoint" with the theme in it. However, I want to automize converting themes of existing PowerPoints, I'm not creating new PowerPoints from scratch.
You might say: just copy and paste slides into the PowerPoint with a specific theme. However, copy and pasting slides is extremely error-prone as well, seeing they work with slide indices which seem quite tricky. And I'm not even sure whether the pasted slides automatically assume the theme of the new document.
Therefore I was wondering if anyone knew of some kind of theme object I could call and change using Python-pptx?
Thanks in advance
The short answer is no. Implementing that would be a fairly big deal and there are no current plans to add it.
If you wanted to do that to several decks, you might explore using Visual Basic for Applications to do it in a Microsoft Windows environment. You might also explore using the win32com interface to control the PowerPoint application from Python, I think that also requires a Windows environment.

PowerPoint - how to run a macro automatically?

I'd like to run a macro that sets the zoom to 100%, something like Windows(1).View.Zoom = 100, every time ANY file is opened in PowerPoint. The files are already created, so using a template to set the zoom is not possible. How can I do this?
There isn't really a way (that I am aware of) to do this through a macro or powerpoint add-in. You might be able to do it using a custom web add-in but I don't have enough experience with that to provide an example.
After looking around there have been a few success stories. One of which is creating a custom UI element and then adding an onLoad hook to that.
Here is the thread.
Here is a link to the Custom UI Editor Tool However I had no luck in getting it to work. I believe (This is only my theory) that it is not compatible with the latest .NET framework.
If you do end up trying to do this, here is a link to the xml formatting documentation for UI elements. And a link to a little tutorial related to this.
Sorry I couldn't be of more help. This should at least get you started. If anyone else has a simpler way I would love to know as well.

How can I programmatically add xaml elements in Visual Studio 2017?

I have a C++/winrt project with a complex and dynamic xaml interface created in C++ code. Now I am moving to the latest VS 15.9.0 Preview 3, which has platform support for C++/Winrt and also allows use of the xaml designer in such a project. But I don't want to use the designer and have turned it off in Tools/Options/Xaml. The result is that none of my programmatic xaml elements appears. The project seems to expect me to enter these elements in a xaml code page, rather than using C++, e.g. Grid(), StackPanel(), view.RowDefinitions.Append(), view.SetRow() etc. The GeneratedFiles folder is now full of items that were not present in the previous project, yet can't be removed. Is it still possible to use the C++ interface for xaml, and what must be done to enable it if so? Thanks.
Ryan is correct: C++/winrt does support programmatic creation of xaml, and it works great. With the help of a couple of c++/winrt guys at MS I think I also know why my code was not doing anything. In the former version of my app I had declared MainPage as a C++ class, not a struct, and had assigned the starting Grid for the xaml by getting the current Window and setting currentWindow.Content(theGrid). But in the new template app MainPage is a struct, which might matter, and while setting window.Content that way no longer works, this does: this->Content(theGrid). Leaving aside some irrelevant issues about declarations in the BlankApp, this I think is the answer. Programmatic xaml works if you set that initial content as above.
Unfortunately, this is not the intended way to use this UI system. XAML-based UI systems are descendants of WPF, which relies on the Model-View-ViewModel (MVVM) pattern.
This pattern intends three types of classes to make up your application: Views, which are primarily written in XAML, and only deal with displaying data they are given; ViewModels, which are the wrapper and translator to give the views data, and to give the models commands; and lastly, Models, which are your backend business-logic classes.
Your instinct to not trust the designer is reasonable - it generates messy and unidiomatic XAML code. But it is an excellent way to preview the way your XAML code looks.
To get back to your specific situation, there are real problems in the library's API that will be serious roadblocks to programmatically define a UI in C++. Instead, you will want to use XAML to declare the UI. Adding and removing grid column definitions is not something that is well-supported, but using StackPanels and DockPanels is the normal way to do this.
If you have more specific questions, feel free to open a new question here, but do bear in mind that you may want to search first under the tags mvvm and wpf in addition to xaml, c++-winrt, and winrt.
If you have more questions that are rather broad and may be too broad for the main site here, feel free to join the WPF channel on chat, but bear in mind that most of us don't have experience in WinRT specifically.

Windows Visual Themes: Gallery of Parts and States?

Microsoft Windows lets programmers draw GUI elements using the look and feel of the current theme using functions like DrawThemeBackground and DrawThemeText. The elements are specified by Class, Part, and State, as described at the Parts and States page at MSDN.
Unfortunately, the page is not very informative (at all!). So the question is: is there somewhere a reference of all these parts and states, preferably with images of the elements (in the default Windows Vista/7 theme)?
I have created a small Windows application, programmed with the table at Parts and States. This application lets the programmer browse and explore all parts and states, using the current OS theme.
(High-Res)
It can be downloaded at
https://privat.rejbrand.se/UxExplore.exe
The (Delphi, Win32 API) source, which is too long to be posted here (due to hundreds of constants) is found at
https://privat.rejbrand.se/UxExplore.zip
https://privat.rejbrand.se/UxExploreMain.html
https://privat.rejbrand.se/UxExploreConsts.html
You're looking for this.
Mike Lische, who wrote the first Theme support for Delphi (which was later absorbed by Borland) has a very good Theme Explorer demo application:
It's not been updated to support new Windows 7 common controls, but its parts/states explorer is very pretty.
And if i may say, Andreas, a design you might want to copy for yours :)
Much more comprehensive theme explorer: mCtrl Theme Explorer

Browsing Classes, Objects, etc

Question ONE:
I'm still pretty new to .net, but have used Visual Studio for a few recent projects. I'm now working a new project and I was wondering if visual studio had anything built in that would allow you to browse all of the details about a control, etc..
Is MSDN the best place to go for this?
For instance if I wanted to see of all the methods, properties, etc.. Is there anything inside VS?
Question TWO:
Can anyone recommend, books, resources, that deal specificially with Visual Studio? What each window does, etc.. I have used it enough to complete a few projects, but I haven't seen much in the way of exactly what everything does and why.
Thanks for any suggestions.
Use reflector (it's free!) to get in-depth information about classes etc. Visual studio also has a built-in Object Browser.
P.S. Reflector allows you to reverse engineer assemblies as well, allowing you to view the actual code of a class / method.
P.P.S. Google is still a developer's best friend. Need information on a control, search for it on the web. (Which will lead you to MSDN a lot of the times, but will also get you examples and loads of blog entries).
Question ONE:
You can use the Object Browser (menu View\Object Browser) to see a hierarchical list of all known assemblies, classes, interfaces, enums, etc...
This only gives the signature of each item and not the code.
If you want to see the code, use .Net reflector.
You can also use the Object Browser in Visual Studio. There is usually an icon for it at the top (by the Toolbox, Solution Explorer, etc. icons) or you can navigate to it (View -> Object Browser). When it opens, you will see all of the libraries currently referenced (system and third party) on the left hand side. It's hierarchical, so you can start drilling down. There is a search box at the top, if you want to look for a particular class, method or library. That looks at all the system libraries, not just the ones referenced in your current project.
For more help with the object browser, look here.
Q1:
In Visual Studio:
Above the editor there are 2 dropdown lists:
Left: Shows Classes
Right: Shows Class Members
or Click View > Class View: to see all the classes in the whole solution
I had a similar rub when I started using VS after I had done a lot of Java coding. I was used to the Java API documentation to research properties and such.
I found the VS equivalent IMO, here:
http://msdn.microsoft.com/en-us/library/ms229335.aspx
You can browse every class method, property, constructor, etc. right there. Their examples are decent.
In response to question 1, what I usually do is highlight the bit of framework code I'm interested in and hit F1 to bring up the documentation. For example:
Button myButton = new Button();
If you highlight the first Button and hit F1, you'll get an overview on Buttons in Windows Forms. If you highlight Button() and hit F1 you'll get the documentation on the Button class constructor.
In response to question 2, I'm not sure a book is the answer. I think reading a book on all the components of Visual Studio might be overkill. I'd say to keep on hacking away at your projects and page-fault information in via MSDN, Google, and StackOverflow as you need it. As with any IDE and framework, the more you use it the better you'll get at navigating and learning the ins and outs.

Resources