Using Message Boxes in Windows 7 style - windows

After reading the MSDN article about proper user interface here:
http://msdn.microsoft.com/en-us/library/aa974176.aspx
I want to modify the message boxes I use in my applications to reflect those guidelines (for example, have the Main Instructions in a larger font, better named Buttons, etc...).
My question is, is there an API that allows you to easily build those kind of message boxes (a la user32\MessageBox()), or do you actually have to build your own message boxes which follow the guidelines?

Mostly you just get that (try it and see!) when you use MessageBox or whatever wrapper applies in the language you're using (you didn't say.) There is also Task Based Dialog which goes well beyond the yes/no/cancel world of message box. There is a Win32 API for that if you're in C++, and the Windows API Code Pack has a wrapper if you're in C# or VB.NET.

Related

Possible to include an image in the meta data in code? VS 2013

I would like to be able to include a screenshot of a control inside my code, this way making control identification easier for new members on my team, is such a thing possible?
Maybe even the ability to just have the image on a network share with the path in a comment, and then have a plugin that when hovering over the link brings up the image?
EDIT (More detail):
I'm creating a test project, the application under test has over 1000 controls, some of them are similar in name and purpose, this can make it difficult at times for developers to reuse the API I am creating because the control name is simply not enough for quick identification of the control in use.
I use the word API very loosely too, none of this stuff will be consumed in web services, and it will always be white box with developers including a project reference and have direct access to the source code.
For every form in my application (The test one), I have a controls.cs file where all the controls for that form in the application under test are listed - This is where I want the hover to screenshot ability in the control definitions.
Another sure factor is that all developers will be using VS2013 (For now the base version), later this could be update 1 or 2.
As the initial author and senior developer on this project, these hover / image references (in the code) will be as useful to me personally as any 3rd party developers, or any later developers to join the initiative.
Thanks again, and I added a bounty!
I believe you can use Whole Tomato's free SourceLinks Visual Studio extension to do what you want - or at least get pretty close to it.
Built-in Functionality:
Out of the box, the extension allows you to specify comment patterns you want users to be able to take an action on. Once the patterns are specified, SourceLinks will highlight any occurrences of those patterns in the text editor. You will be able to double click the highlighted items and perform a pre-configured action (such as opening a link in an internal/external browser, or launching an executable).
You can see an example in the SourceLinks configuration dialog shown below:
(source: wholetomato.com)
So you could use this feature pretty painlessly to define a keyword such as Control Image and then put comments like the following in your code:
// Control Image: my_smart_list.jpg
SourceLinks would allow you double click this text, and you could have that configured to launch the image (using a file:// or http:// url depending on how and where your images are stored) either inside Visual Studio in it's internal browser, or in an external browser.
Custom Tooltips!
Now, if you want to put in some more effort into this and actually write some code, then SourceLinks allows you to create API Extensions to display custom tooltips when the user hovers over the marked text in the editor. The default installation of SourceLinks comes with sample API extensions that you can copy to create your own. See the article linked at the very top of the answer for more details on these samples.
This post in the SourceLinks forum informs us that SourceLinks expects the custom API Extension to return the tooltip value as FlowDocument XAML text. This is awesome news for us, because a FlowDocument can contain many types of elements, including formatted text, hyperlinks, and images.
Imanges in a Flow document can be specified both inline as well as externally.
Hope this helps!
I would use doxygen -- create the images somewhere in the source tree and use doxygen comments. You can embed the \image command in source comments (see docs) and doxygen will generate all the HTML documentation from there. I think doxygen is a great tool for documenting a codebase as you can generate the documentation directly from comments in the source and distribute or host the HTML separately.

What is the easiest way to customize PDF document with a serial number

I have several PDF documents. Users of my Windows application want to print these PDF files. An additional requirement is to add auto incremented serial number to each printed PDF. The serial number is used for accounting purposes, not for security reasons as someone asked here.
What is the easiest way to implement above functionally?
I know that I can buy commercial license of iText and edit PDF files. However I would like to know if there is a simpler solution. E.g. Add a form field to PDF document, distribute it to my users, and then use some Acrobat Reader command line option to fill in the form field with serial number generated by my application.
PDFTK (The PDF Toolkit) is a command-line app that allows you to edit PDFs with ease. For example, you could use the update_info command to change the meta-data, or apply a background (which isn't all that easy, as it requires another PDF to get the background from)...
Another option is to use the FREE Quick PDF Library Lite.
QP.LoadFromFile(Filename);
QP.SetOrigin(1); // set origin coordinate system to top right corner
QP.DrawText(10,10, mySerialNumber);
QP.SaveToFile(newFilename);
You can find more information at http://www.quickpdflibrary.com/free/lite.php
"Quick PDF Library Lite is available as an ActiveX component and works with C, C++, C#, Delphi, PHP, Visual Basic, VB.NET, ASP, PowerBASIC, Pascal or any other language that supports ActiveX."
Disclaimer : I do consulting work for the QuickPDF products.

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

How to retrieve a localized text/caption for standard push button?

I want to add "Yes" and "No" buttons to my window. It's a bit similar to standard MessageBox, so I would like to use localized strings in these buttons. I.e. "Yes" and "No" should be written in OS's current language.
How can I do this?
No easy answer. You can try getting a translation glossary from Microsoft, or use thier online translation tool (more on both here).
Other "hacks" involve reading the string resources of user32.dll - but this will only work for localized version of the OS (i.e., not if you're using MUI, which sits on top an EN-US version).
I like the online translation or glossary approach as it proofs the app from any future API changes.

Which VB6 controls are supported by Microsoft?

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.

Resources