VB6: destroying redundant GDI handles held by a component - vb6

I'm maintaining an old legacy app in VB6. The app uses UI components written by an external vendor, to which we do not have source code (ActiveX controls).
Today I found out that these controls are extremely wasteful in GDI resources. Specifically, I created a form with 4 regular textboxes and then another form with 4 textboxes from this vendor's controls. The vendor's controls had %37 more GDI resourse usage, and specifically, the vendor's form had 15 fonts, while the regular one had 5 or 6 (I think it was 4 for the textboxes, 1 for the form).
Assuming there is nothing I can do to contact the vendor, and assuming I can trace fonts that are not really used by the controls - is there a way in which I can destroy these fonts?

Related

Is there a name for the Windows 9x/2k style of software UI design? As in, the grey-tone, grey square button, partitioned with black pinstripes?

Image of example software here
Is there a particular name by which this style is known in UI design circles?
Your screenshot looks more like XP/Vista.
I don't know if it had a specific name at the time, it was just how most 32-bit applications looked. All common controls and common dialogs had this look and any custom controls using GetSysColor would mimic it.
Going even further back, in 16-bit Windows version 1 and 2 were flat and in version 3 this "3D" look started to take over. The dialog box API for example gained the DS_3DLOOK flag. See this blog post for more.
These days the Windows 95 look without Visual Styles is often called "Windows Classic"/"Classic Theme".

Nativescript and more complex UI

I have to create mobile application for both IOS and Android.
I'm interested in use NativeSript problem is that, UI is quite complex and I'm not sure if this framework will manage this.
For my work with Js and Java is not a problem and I already have back-end side ready.
Best Regards
Luke
NativeScript can do anything a native Java/ObjC app can do; you have full access to the actual native OS controls from inside JavaScript. And all controls that are created are actually the native controls; so if you create 20 Java/ObjC controls or 20 controls in NS, they are still all the exact same type of controls as far as the Android (or iOS) runtimes are concerned, all the screen rendering is done the exact same way since NativeScript creates Native controls.
Now as to complex UI's, I have several apps with fairly complex UI's, however one thing I do is I frequently start with a single UI screen and then once happy with it I take pieces that I can and have those pieces dynamically load in/out when they are needed to keep the UI as simple (light memory usage) as much as possible. The UI can handle complex screens, but by showing less items (and eliminating any hidden items from memory) the UI is way more responsive in any language.

Windows Browser Control Vs CDHtmlDialog and CHtmlView

I wanted to know the difference among following control and classes.
Windows Browser Control Vs CDHtmlDialog and CHtmlView.
It is visible that these things are used to add html content in UI for
windows based application.
But when we search in internet one will often confused with these things.
It would be good if some explain the usability of these Control and Classes.
The Web Browser Control is a Windows ActiveX control that is probably used by Internet Explorer itself to display HTML contents. At the very least, Web Browser Control and Internet Explorer use the same implementation for rendering HTML.
CHtmlView is a MFC - CView -derived class hosting said ActiveX control.
CHtmlDialog is a MFC - CDialog - derived class doing the same.
They are separate classes because unfortunately MFC has a "huge gap" between dialogs, views and windows.
I haven't worked significantly with either MFC class but in my understanding they don't add any functionality by themselves. You can as well host the web browser control like a normal ActiveX and use GetControlUnknown to acquire IWebBrowser interface.
The biggest problem in my experience is that DOM is only accessible after DocumentComplete, and that event won't fire before the message loop doesn't pump. This makes some operations rather painful I ended up with a custom interface queuing modifications until DOM is available.
P.S. Windows now offers the WebView2 - ActiveX control, based on Edge, as a sufficient and powerful replacement. see https://learn.microsoft.com/en-us/microsoft-edge/webview2/

What's the control used in Kindle for Windows Phone 7

I was wondering what kind of control Amazon has used to display text in their application for Windows Phone 7 ? It must be some kind of custom ones because if I remember correctly there's not support for FlowDocument, Run etc in WP7.
<Run> is supported on WindowsPhone7 - e.g. http://social.msdn.microsoft.com/Forums/en-SG/wpf/thread/ca27556a-a33b-4d4e-82b4-a0ed8596d6a1 - you can see Run used in lots of apps - e.g. the official Twitter app.
This question - Programmatically determining max fit in textbox (WP7) - analyses the Kindle UI control a little bit - it leads me to think that Amazon are using a TextBlock control for the main page, and are doing some manual calculations to work out how many words are on the current page.
Kindle ebooks are primarily HTML (output of conversion from multiple formats), so it would be some kind of WebBrower control.
They haven't detailed this publicly.
I strongly suspect that they have their own controls to wrap a canvas which they dynamically populate with the text and then animate with their own manipulation code.

Rewrite standard controls like edit, combo, etc?

I have a custom control: it's managed code, which subclasses System.Windows.Forms.Control.
I want to add things like edit boxes, selection lists, combo boxes, radio buttons and so on to places on this control. An easy way to do this is to simply add instances of these classes to the Controls collection, so that they become child controls.
Adding them as child controls might create some subtle problems, for example:
IE 6 select controls(Combo Box) over menu
I have scrollbars on my control which appear to scroll the contents of the control (the contents are bigger than the control itself); when a child control is near the edge of the screen then I'd like to half-display (i.e. clip) that child (i.e. to have half of it located off the edge of the physical screen), but a true child control cannot be located outside the border of its parent.
Are there other potential problems?
When I use IE7 to display http://www.tizag.com/htmlT/htmlselect.php (for example), which contains combo boxes etc., and when I then use Spy++ to spy on IE7 when I'm doing that, I see only a single Window/control instance with no children (whose class name is "Internet Explorer_Server").
I'm guessing this means that in IE7, the functionality to render a combo box is built in to the IE7 control itself, and that IE7 does not use standard controls as child controls.
Questions:
Is it better to reuse standard controls as children of a custom control, or, to reimplement the functionality of standard controls within a custom control itself?
Do you have any caveats (warnings) to share, related to either scenario?
If I wanted to reimplement the functionality of standard controls within a custom control, do you know of any existing code (which implements this functionality) that I could re-use?
If such code already exists, I don't know how to search for it (my searches find, for example, owner-draw combo boxes, and extensions to standard combo boxes): perhaps few people reimplement the standard controls from scratch?
Edit
I found a semi-related question: How to render a control to look like ComboBox with Visual Styles enabled?
Yes, Internet Explorer draws the controls using the Windows theming APIs. You can do this too using the types defined in the System.Windows.Forms.VisualStyles namespace.
The IE team did this to avoid performance problems of having so many controls, each receiving window messages, on screen at once. For example, looking at this StackOverflow.com page, I see 30-40 link label controls, 10 buttons or so, 20+ labels, etc.
It should be noted the Zune software, which is .NET managed code, also uses custom controls; if you try to use Spy++ on any of the controls, you'll see they aren't real Win32 controls. You may use Reflector on the Zune software to see exactly what they're doing. If I recall right, they're using a custom managed UI framework that's included in the Zune software.
As far as rewriting these controls from scratch, I think there's a ton of work to be done. It sounds easier than it really would be.

Resources