Replace windows controls with custom ones - windows

I've been trying to search for ways to change the way windows controls look.
For instance change the OpenFileDialog UI at a windows level, or completely turn the file copy/delete/move dialog into something else, like a series of disks or a bucket filling up with liquid.
Looking around i found that i could write a com app that could be used instead of the default windows ones. But i have no idea where or how to start with these, or even how i could see what i would have to implement to achieve this, nor how i would be able to tell windows to use my custom ones instead of the default ones.
Have tried looking in the microsoft documentation, and i'm 99% sure i'm either unable to search for what i need or it's undocumented.
I know there are some apps from Stardock that could do this where i could just make the graphics, but where's the fun in that?
Anybody able to point me in the right direction?
Interested only in being able to achieve this for windows 10.

You could in theory write your own implementations of IFileOpenDialog and IFileSaveDialog and overwrite the Windows registrations in HKCR\CLSID. This might not affect older applications that use the older open/save common dialogs.
There is also CLSID_ProgressDialog and some progress related interfaces you could take over but I don't know if Explorer actually uses these or its own custom version.
This could obviously break your system so you really have to know what you are doing if you go down this path.
While you are developing this you could choose to selectivity inject into a limited set of processes and hook CoCreateInstance instead.
Changes to existing dialogs (adding/moving/hiding controls and images) can be done with Resource Hacker. This was pretty easy in the 90's but it is more problematic these days because some files are protected and Windows updates are more common.

Related

vb6 icon location on windows

Where can I find the orginal vb6 ( or windows ) icon? (.ico files)
I need, error, warning, question, and information icons which come up on the messagebox.
Thanks a lot.
As the icons can differ for each OS version, you can get the icons from Windows using LoadIcon() passing one of the standard icon IDs.
See http://msdn.microsoft.com/en-us/library/ms648072.aspx for details.
If you want them as .ico files, you can extract them (on your development machine) from user32.dll using a resource editor.
(Updated with corrected info from Cody Gray)
The standard Windows message box icons have changed many times across the various versions of Windows. They're included with a couple of the system DLL files, but you shouldn't try and extract them dynamically yourself. As I mentioned in a comment to another answer, the ID numbers are undocumented for a reason: namely because it's possible for them to change in future versions of Windows or even in future Windows updates. There's absolutely no reason to go through the effort trying to extract them, either. Windows will already retrieve them for you, if you ask nicely.
The nice way of asking is to use the LoadIcon function, and specify the IDI identifier of the icon you want. Windows will return an HICON value, or a handle to an icon resource.
Since you mention that you're using VB.NET, you can also use the SystemIcons class, which has static properties to return any of the common icons. This is a .NET wrapper that saves you from having to P/Invoke the LoadIcon function from the Windows API yourself.
Better yet, if you just want to display a message box containing one of the icons, all you have to do is call the MessageBox API function. Tell Windows the MB_ICON value that you want, and you're off. As before, this has already been wrapped for you by the .NET Framework in the identically-named MessageBox class.
The benefit of both of these functions is that they'll always return the correct icons regardless of the current version of Windows. A comment made attempting to clarify the question seems to suggest that you want to use the old icons on a current version of Windows. But of course, you do not want to do this. The icons have been updated throughout the Windows shell for a good reason, and your application should take advantage of them. The new icons are more clear and fit in better with the overall system theme. Additionally, if your app still uses the old icons, it will be confusing to users and look very out of place. It's always best to follow standard platform conventions, rather than trying to do "something else", even if you think your "something else" is "better" for whatever reason than the platform default. Your users will not agree, and your application will reflect your shoddy craftsmanship.
Since people who ask this type of question inevitably disagree with me and insist that they must do it anyway, and that it is a "requirement" (whatever that means), I'll point out that the old icons are not available in the newer versions of Windows. The icons have been completely replaced throughout the system for a reason. It's also strictly forbidden by the licensing agreements to extract icons from system DLL files and redistribute them with your application. Don't do this.
Also, before deciding on which icon you should display in your message box, be sure to consult Microsoft's Windows User Experience Interaction Guidelines, which provide some very handy rules on selecting the proper icon to convey the right message and fit with the Windows tone. I provide more information on that in my answer here; very much recommended reading for any Windows application developer.
Edit: It's like pulling teeth to get any more details on this question. I'm not sure why you're so secretive about what you're trying to accomplish, but note that in the future, you'll have a lot better luck including these things in your question to start with, rather than hoping people will pull it out of you. Most people aren't nearly as persistent as I am.
Anyway, you finally mention that you're doing some type of interop between VB 6 code and .NET code. That should not be relevant in the case of the message box icons used. The VB 6 MsgBox function is 100% equivalent to the Win32 API MessageBox function and the .NET MessageBox class that I discussed earlier. All of them are going to use the current system icons, and it shouldn't require any extra work to make them look the same. Ensure that you've passed the same icon specifier to all of the functions. Here's a table for convenience:
VB 6 "MsgBox" Icon Constant | VB.NET "MessageBox" Icon Identifier
---------------------------------------------------------------------------------
vbCritical | MessageBoxIcon.Error
vbQuestion | MessageBoxIcon.Question (DEPRECATED -- do not use)
vbExclamation | MessageBoxIcon.Warning
vbInformation | MessageBoxIcon.Information
Note that the "Question" style icon has since been deprecated and you should not use this value. If you're still using it in the VB 6 code, you should change that code to use a different icon (or no icon at all). The above-linked Windows User Experience Interaction Guidelines provide more details on why this icon has been deprecated and how to choose a suitable replacement.

Help needed with windows hooks

I am working on building a system that can monitor how users react to security alerts on their systems (software updates, warnings etc.). It also needs to monitor the web traffic and the processes running on the system and I am looking to the community to help me design this system. We intend to provide users with test laptops and monitor their behavior over a period of time to see how they react to security alerts thrown by various applications and the OS(windows in this case).
Following are my questions
Can I use windows hooks to solve the first problem i.e finding how users reacted to the alerts thrown by various applications. Specifically, can global hooks be used to solve this?
(How this information should be collected (XML?) and relayed back to a server(how frequently?) is another problem)
Can I do this in C# or it has to be done only in c++ or VB?
Do you know any alternate approach to solve the problem? Is there any software that has these capabilities.
I have many more questions but getting these answered would be a good first step. Really hoping for some good insights from the knowledgeable people on this community
Thank you in advance
Edit:
Example scenario is when adobe prompts you to update the flash player or the antivirus prompts you to update definitions or any application displays a notification(security related having keywords like update, warning, install etc.) needing the user to take some action. Windows system updates is another example. I want to know how the user reacted to these alerts/notifications/updates (which are typically a pop-up window). So i was wondering if i placed a global hook that can monitor the content of the windows displayed on screen and notify me(server) when certain words like update, alert, warning etc. appear in the content/title of the windows and what the user did with the message(dismissed it, Oked it etc). Unfortunately, i do not have any more specifications than this. I can use anything I want to achieve this and I am not clear on what my choices are.
Edit 2:
After having reviewed my requirements and having read about hooks, I feel like I could achieve this by a combination of hooks and the following textGrab SDK, http://www.renovation-software.com/en/text-grab-sdk/textgrab-sdk.html. I want some guidance to know if I am on the right track. I am thinking if I can install hooks then it gives me handles to all possible windows on the screen and I can use the textGRAB SDK to look for certain keywords in those windows. Although this may capture some interesting text, I am still not sure how I will know what action the user had taken on the window. Anybody having any experience with either hooks or textGRAB, please let me know if this looks like a reasonable thing to do. If the community has some other Ideas on how I could possibly monitor security related messages thrown by any application in the system, please suggest. I am looking forward to some useful advice for completing a challenging project.
First of all, you need to define, how you will "see" security alerts in code. "Security alert" is quite a vague term. Will it be some window with some caption and some message to the user or ... ?
Next, about web and processes: Windows hooks won't help you with your task. They are more low-level and not as advanced as you'd need. You can't hook network traffic (you need either network filter driver for pre-Vista or Microsoft Filtering Platform for Vista and later). See this question for some information about checking the process list with C# (there seems to be no easy way to catch process startup either).
It honestly sounds like you need a more solid direction. I commend you for trying to provide details, but It appears that you still need more information about your problem(s)..
I will attempt to answer some of your questions, but like I said - it sounds like you need to know more about your problems before we can provide you with optimal answer(s).
-Alerts is too vague a term, you will need to define this better. Are these 'alerts' applications that YOU have control over or are they third party applications? Not every application will show an 'Alert' in the same fashion, and even if they did - I think using a System Level Hook would probably be too problematic to implement your solution with. I'm not saying it's necessarily impossible, but you're talking about possibly implementing a different set of logic(to determine the data for a given application's Alert(s)) for each application that you want to monitor.
-It's impossible for any of us to determine the optimal storage mechanism for your particular needs, that is something that you will either need to provide more details about or decide on your own.
-How often you collect data is also something that you will have to either provide more details for or decide for on your own.
-C/C++ Would probably provide you with the most portable solution, although there is nothing preventing you from using c# to call Win32 API. (Not everyone has the .NET framework installed - believe it or not)
-The problem that you mentioned appears to be a somewhat specialized problem... I don't know of any existing software that will do everything that you want to do.
Another possible issue that you haven't touched on:
You haven't specified your target audience for this 'service', but I want you to know that if I found an application monitoring as many events as what you're talking about doing, I would promptly remove it and write a nasty letter to the company that wrote it.
In summary, Read this Article on hooks to get a better understanding of how they work.

How create custom user interface for Windows?

There are many applications for Windows these days that don't use native windows controls, don't have standard window frames and generally look different. What are some recommended techniques for creating such interfaces?
There are good reasons not to. Like that you will most likely not do a better job than Windows does. (Maybe it will look better (in your opinion), but will it behave?). Or that it's not what most users expect. Or that it will look like s**** on Windows 2011.
That said, it's not hard. You simply handle the WM_NC* events like WM_NCPAINT or WM_NCHITTEST. NC stands for Non Client (window area). And of course, there is a trick on Vista/Win7 (you have to announce it to the DWM).
From an implementation aspect, you could employ WPF (Windows Presentation Foundation) assuming you code for .NET :) It has pretty bunch of skinnable controls, that may look like native and may not.
From a design aspect, if your interface isn't going to follow documented standards (like the Windows UI guidelines), it has to be intuitive. I think the new generation of Windows applications will go through a growing phase in a manner similar to the early days of the Web. After a time, some standards or common themes will evolve.
Can you give us some sample applications? Some apps that don't use native windows controls use cross-platform GUI libraries, like Qt for C++ or Tkinker. These maintain the same look across different platforms.
I wouldn't really recommend making your user interface different deliberately. You don't stand to gain much. Your controls are almost always going to be buggier than native controls, and you are requiring the user to learn something new. Now, if you're controls add a large enough value to be worth the users' time it can be okay. But making them get used to different looking buttons is rarely worth it.
I`m not sure if this answer your question.
You can use third party skinning controls like from Infragistics, or SkinSoft for example.
But like Bubba said I`d recommend going for WPF.
Model-View-Controller! It's as valuable here as in web apps or anywhere else. Be sure to keep the part of your program that generates the custom UI separate from the part of your program that flashes the BIOS.
I know this question is 10 years old but none of the answers mention using an option in visual studio, dont know if it existed at the time.
Theres an option to remove the border of the window in visual studio (called borderStyle). Thats the easiest way to do it, using C#. After removing the border, all you have to do is create a new interface. If you're looking to do it in C++, i think you need to use DWM. I will let an example i found here.
https://github.com/melak47/BorderlessWindow
Another example (maybe without DWM? didnt test):
https://social.msdn.microsoft.com/Forums/vstudio/en-US/b98c4c06-9581-44d3-8e5a-4adb2316e653/win32-about-styles-how-can-i-do-a-borderless-window?forum=vclanguage
There is a lot of people disencouraging to do it in this thread but there's no reason to not do it, if you know what you're doing your application can look great.

Choosing Windows File Open and File Save Dialogs - What is the Best Practice?

For some time I've noticed how much the File Open and File save dialogs vary between Windows itself and Applications. In Delphi for example (which I use) you can use the built-in dialogs (which have a folder tree) and direct calls to the Windows API which produce variants of the Windows version, with or without large buttons for 'Desktop', 'My Computer' etc (At least on XP).
As an application developer I'm interested in providing the User with a clean, simple way of loading and saving files. Typically, this requires that I propose a preferred folder where my Application data files are stored but that I allow the User to access other folders - often the desktop and other local drives, and sometimes the network - without difficulty if required.
With the introduction of Vista, we seem to be favouring a 'bits missing' folder navigation tree for Windows dialogs and now, Windows 7 has another 'line-less tree' for navigation. I suspect that if one conforms to Microsofts assumptions and stores everything in ~/documents it's not a big problem. However, if one has to start at the root of a drives tree and there are many directories then it's a right pain - there is no horizontal scrolling so directory names get truncated.
My question is - what do other Application developers use? I wonder whether I should be following this Windows lead or simply sticking to a simple cut-down version of File dialogs over which I full control but risk falling into the past....?
Thanks
Brian
Always use the OS defaults - it'll be what your users are used to, and what they expect. Whatever you do, don't astonish the user. Whatever you do, please don't write your own file-open/file-save dialog.
FWIW, I'm not a great fan of Vista's file-open dialog (why do I have to work so hard to navigate my folders?), but I'd rather that than have to get to grips with something new. The less things your users have to learn, the easier your product is to use.
Since I am currently only coding for customers with Windows XP (in a corporate environment that isn't upgrading just yet) I use the standard dialog boxes.
When we do upgrade, I will most likely continue to use the standard old fashioned dialog boxes, until our customers are ready for a change.
In all honesty, I involve at least a few users in the development process, and I won't start new features unless I can bring one in to sit in front of my development PC to see how it works, and they sign off on it.
For those apps that we write for our web site, we tend to be conservative as well... Focus on clean, understandable design, and introduce fancy new features only when there is a compelling reason, and even then, we tend to involve focus groups.
So all that was a long way of saying "Ask your customers". Give them what they want.

app GUI similar to Control Panel in Vista

I was playing a bit with Windows Vista (still using XP) and I liked how the standard Control Panel worked. Do you think this design is good also for normal applications?
I like the idea of showing main topics with large fonts + icons. Details within each main topic are displayed using a small font and are immediatelly accessible without the need to browse the menu. Probably everybody knows Vista, but anyway, here is the Control Panel layout.
Compared to a classic layout of icons for main topics and menu for minor topics, the Control Panel GUI seems to be good at first sight.
I haven't seen any app using this kind of GUI, so I don't know if I should rather use the common approach with icons and menu for a common application? Maybe this Control Panel GUI is suitable only for setting some options, other than working with any data?
I think it's suitable for certain types of applications. As usual with usability related questions, "it depends". I would guess one class of application this is good for is one that you don't use very often, and/or might be used by different people at different times. It is similar in concept to a wizard in that it presents you a list of choices, and selecting a choice takes you to a new page.
Whether this sort of thing is suitable for your application, it's hard to say. The best way to answer that question is to mock up your application and do some hallway usability testing. I would guess, though, if you're thinking of using this for an application people will use a lot, this sort of interface will be annoying. If you're dealing with perpetual beginners or casual users it might be a fine way for someone to start using your program.
I'm on the fence on this. The old Windows XP layout got cluttered quickly with programs adding their own control panel applets, while the new Windows Vista layout can be annoying to process visually at first. The search feature really helps (though not nearly as slick as Mac OS X's search) but I'm not a fan of visually laying out something that's better seen in a list into two distinct columns containing the same type of data. In list/details form it's intuitive for a user to sort the items through different attributes. I find this new presentation in the IIS 7 management applet to be particularly troublesome.

Resources