Programming

You are currently browsing the articles from MS Windows Articles, Reviews and Videos matching the category Programming.

PC Tablets Invading the Desktop Demands

The trend in the market today as far as buying computers is going miniature. We have seen the introduction of new miniature desktops to which the demand for them is getting higher. But should this be a cause for alarm for most desktop manufacturers? Apparently there is a difference but what are the chances that the traditional desktop user would turn towards these compact computers for a change?

The answer lies on where a computer would be used and who will actually use it. For example, in the modern offices of today, it is highly unlikely you will see the traditional employee working with tablet PCs. Also, for the hardworking programmers and developers, the use of desktops is still the way to go considering that they need visualization and better control when creating programs.

The same holds true for graphics designers who are sure to prefer desktops when creating images. In all, it all boils down to use and power of the PC. Tablets can be used for navigation or perhaps entertainment. They are not designed for professional undertaking and that is something we all know. While we cannot discount tablet PCs from advancing through the years, who knows how modern computing will be by that time?

Hence, PC tablets should not even be considered by the modern IT personnel for professional use. The best that they can offer is migration of finished documents or presentation files for easy handling. But when it comes to actual work, desktops are still the bet for working wiser.

Written by PC Freak on August 21st, 2008 with no comments.
Read more articles on 1340 and 1354 and 1426 and 1429 and 1673 and 169 and 2065 and 2157 and 401 and 544 and Contributors and Desktop and Programming and Technology and computers.

Tweak DWM from your programs, Part 1

Flip 3DWith Windows Vista, Microsoft introduced a whole new window manager which provides a better experience to the user and an independent graphics surface to us developers by taking advantage of graphics acceleration hardware (your graphics card or integrated GPU).

In a three-part blog post, I will show you how to use a wrapper around the Desktop Window Manager Application Programming Interface in order to control its state, change colorization, or change the rendering policy of windows from your Windows Forms and .NET 3 Presentation Foundation programs.

Getting Started

Windows Forms and Windows Presentation Foundation will be referred to in these posts as WF and WPF respectively.

The code you will need can be downloaded from here and is written in C# (as are the code samples in this post). That being said, you can use it in projects of any other .NET language — you can include the compiled libraries as references. Otherwise (if you code in C#), you also have the option to include the files in your project and not distribute a separate library. The solution is for use in Visual Studio 2005 but is also compatible with version 2008.

The whole framework is located under the namespace_GlassLib namespace and is the source to three main types of projects:

DWM test appIn this first part, we will explore the architecture of the wrapper, its core functionality and application in Windows Forms programs.

Microsoft provides an API for DWM in the equivocal DwmApi library. Encapsulating it for easier use in .NET programs is the wrapper’s main purpose.

Since all necessary classes are located under the namespace_GlassLib namespace, in order to avoid writing it every time, I would suggest that you insert it in your C# or VB code file’s “imports” or, if you are working exclusively with VB, in your project’s “Imported Namespaces” list in order to avoid doing the first as well.

The most important class is classDwm and can be used to control virtually any aspect of DWM as long as the public API allows it. The various features are available via the following properties of classDwm:

  propertyBlur Enables/disables the black background transition when a window (not necessarily your window) is maximized, sets custom blur region
  propertyColorization Gets/sets the Aero Glass colorization
  propertyComposition Enable/disable DWM, check if running and if the system is DWM-capable
  propertyEvents Used to set up notifications for colorization, composition, non-client rendering or window-maximized changes
  propertyFlip3D Start/Stop Windows Flip3D or Flip
  propertyGlass Enable/disable Glass on a given form (via its instance, e.g. this) or window (via its handle/hWnd, an classIntPtr)
  propertyNonClientArea For advanced users only, gets or sets how DWM is handing the painting of a given form or window (see propertyGlass above)

Using the Wrapper

Note that DWM is only available on Windows Vista, so I would suggest that you select how to handle the wrapper’s behavior on earlier operating systems. Otherwise, exceptions will be raised which you will have to catch.

The first option is to limit the exceptions the wrapper will raise by setting propertyDwm.ThrowExceptionTypes to one of the available optionsDwmExceptionTypes

  propertyNone
  propertyUnsupportedFeatures
  propertyDesktopWindowManager

Raising no exception will most likely suit your needs best so adjust this property before you make any other changes to DWM, preferably at program startup or in the form’s constructor.

Dwm.ThrowExceptionTypes = DwmExceptionTypes.None;

Now you can make any changes you want to your form’s state in the DWM, for example enable Glass–it is as easy as writing

Dwm.Glass[this] = new DwmMargins(100, 4, 8, 20);

where this is the instance of the form (you can replace this with any other form instance you would like) and the margins are defined as left-right-top-bottom. You can use propertyDwmMargins.EntireWindow instead to extend glass in the whole window client area, like Mobility Center does in Windows Vista.

Restoring the default borders is done by calling the methodRestore method.

Dwm.Glass[this].Restore();

DWM colorizationsReceiving notifications on the global DWM state or on your forms’ is important in order to know how you should handle painting backgrounds or the non-client area. You can choose to get notified when the Aero Glass colorization is changed or DWM starts up or shuts down. In GlassLib this is straightforward: each form that you wish to be notification-aware, GlassLib will include in its list and you have to attach your handlers to the colorization, composition, non-client rendering or window-maximized changes.

Dwm.Events[this].AddHandlers(); // Notifying GlassLib…

// Add our handlers

Dwm.Events[this].CompositionChanged += new DwmEventHandler(OnCompositionChanged);
Dwm.Events[this].ColorizationChanged += new DwmEventHandler(OnColorizationChanged);

private void OnCompositionChanged(object sender, DwmEventArgs e)
{
// Update the UI on composition change (extend glass if DWM is enabled, otherwise restore)
if (Dwm.Glass[this].Enabled)
Dwm.Glass[this].Margins = new DwmMargins(100, 4, 8, 20);
else
Dwm.Glass[this].Restore();
}

private void OnColorizationChanged(object sender, DwmEventArgs e)
{
MessageBox.Show(e.Colorization.ToString());
}

Flip 3DAlthough the public DWM API does not make it easy for one to change the colorization programmatically, DwmWrapper exposes this functionality through the propertyDwm.Colorization property. Controlling the Desktop Window Manager is also as easy as setting propertyDwm.Composition.Enabled to the desired value, either true or false. Other useful “one-liners” include invoking Windows Flip and Flip 3D: methodDwm.Flip3D.EnterAltTab(); and methodDwm.Flip3D.Enter();, respectively.

You can tinker with the full GlassLib source code and the included test projects to see how all of the aforementioned features work in a real environment. In the next part I am going to cover the more advanced functionality of the wrapper, the Windows Forms test app and how it manages DWM thumbnails.

If you have any comments, questions, wishes or just an opinion, feel free to post it here.

You are free to use GlassLib in your freeware programs, but please at least acknowledge it in your release notes/about dialog/website. In case your program is commercial/shareware, I would appreciate it if you could contact me beforehand. Thanks.

Written by Stanimir Stoyanov on July 21st, 2008 with no comments.
Read more articles on 1340 and 1354 and 1426 and 1429 and 1673 and 169 and 2065 and 2157 and 401 and 544 and Contributors and Programming and Windows Vista.

How A Desktop Changes Standard Workloads

If we look at standard operational procedures, we would see most jobs and workloads relying so much on manual labor. But that was yesterday’s news. These days, we have seen the power of technology as some tasks have shown the latest injection of computers and systems to make jobs accurate and faster.

This is not to say that man cannot do routine work on his own. But the real competitive leverage these days is being fast and efficient. Apparently this has become the benchmark for companies to be at par with modern companies and also a means of getting them a step ahead. In the corporate world, you cannot afford to nap and if you do, chances are you will find yourself tailing other companies that are the frontrunners for success.

While the presence of a computer desktop may seem like a threat to most workers today, it should not. Computers are innovations and they are in now way present to take the place of hands-on labor. This is the wrong perception that most people put in their minds today. Rather than cooperate and enjoy the fruits of making their work easier, they make it harder by treating these fruits as banes to their livelihood.

This is crab mentality that many just cannot figure out. Rather than make life easier, they take at the influx of computers and gadgets as a step towards a different direction. So rather than enjoy and even look forward to gaining additional knowledge from these technology developments, they are showing that they have resistance and may even lose the opportunity to advance in knowledge and experience. In job requirements these days, you will notice that computer literacy is a must. Perhaps people should look at this chance as working to their advantage.

Written by PC Freak on July 21st, 2008 with no comments.
Read more articles on 1340 and 1354 and 1426 and 1429 and 1673 and 169 and 2065 and 2157 and 401 and 544 and Business and Contributors and Desktops and Networking and Programming and computers.

The Fruits of Computers to Daily Activities

Computers have undoubtedly made life easier for people today. One thing you will notice is that they have simplified and made things faster especially for business establishments who want a faster way of processing transactions and keeping track of reports when needed.

In the olden days, reports normally took weeks to months to prepare. Computers were there but the manual input using software such as Microsoft Excel only helped a tad bit. But today, thanks to modern programming, inputs and proper collection of data stored in databases have made life entirely easier. With one click, you can get your daily sales reports or even browse through transaction records without having to worry about inconsistency.

As far as hardware requirements are concerned, you will be surprised the even the Pentium I can be a good workstation to use. Normally, software programs are based on data transfer and the modules that they use do not require quite high specs.

But the reality today is that you can no longer buy these ancient Pentium I computers as we often see today the dawn of dual processors. As an alternative, you can always look at the AMD or Celeron processors which are a lot cheaper than the traditional dual core Pentium processors in the market. While many are apprehensive regarding their durability, all other components such as the memory modules and video cards will most certainly be minor since they can operate on either processor chosen by the end-use.

Written by PC Freak on July 11th, 2008 with no comments.
Read more articles on 1340 and 1354 and 1426 and 1429 and 1673 and 169 and 2065 and 2157 and 401 and 544 and AMD and Contributors and Desktops and Programming and Software.

Tod Means Fox

This is another programming and fantastic site that I have found while browsing the web.
Tod is a small bit better than me in writing tutorials /:).
I found his tutorials on Tod means Fox a hosted wordpress Blog.
Tod talks in his blog about Programming, SQL Server.. But especially VFP (Visual Fox Pro)
Get a look at it it's cool!
Omar Abid Blog

Written by Omar Abid on March 24th, 2008 with no comments.
Read more articles on Contributors and Programming.

The Dot Net Source

This is another blog from me. I have 5 now!
But this one will be different. I'll post here only tutorials of the Dot Net FrameWork: No news or other posts.
Check it out
Omar Abid Blog

Written by Omar Abid on March 24th, 2008 with no comments.
Read more articles on Contributors and Programming.

make money online programming

You are a programmer but you don't have a job! Come on you'll never need to have it, you'll do jobs and earn much money.
Here's the site : www.rentacoder.com
You'll find here a large long list of small application and tasks to do. (thousands and thousands)
Choose the task that you want to do. Sometimes tasks don't take 3 days of work and I get payed 200$ on them.
So you'll do some tasks the first day month and spend the rest in home or in the club.
Nice, no ?
Omar Abid Blog

Written by Omar Abid on March 23rd, 2008 with no comments.
Read more articles on Contributors and Programming.

Shell Namespace Extension: Enabling Deep Search

Overview

From my past posts about implementing your own Shell Namespace, there have been some great questions posted by readers.  Many of these stem from the fact that the Namespace example is fairly simple in that it does not implement all of the behavior that is possible in Explorer.  This was done to focus on the core steps in getting a working Namespace implemented.  Yet, there are a few extra steps you can take that don’t require too much more coding on your part to add more useful features.  One question in particular that comes up quite often is how to enable deep searching in your Namespace.

You will notice from the existing Namespace example that if you enter a search term in the search box in Explorer, the search only filters items that are currently in the view.  It does not search into the folders.  In the below images, we try to search for “Two” in the search box which only results in 1 item.  Thus, the sub folders were not included.

Filter Search

Filter Results - shallow

What does a Namespace implementer have to do in order to include sub folders in their namespace search results?  This is actually fairly simple.

Implementing IShellFolderViewCB and IFolderViewSettings

In our previous code, we did not implement an IShellFolderViewCB for our Namespace.  This allows your Namespace to be notified of events associated with the view.  An implementation of IShellFolderViewCB can be specified in your call to SHCreateShellFolderView.  This is optional and previously we were just passing NULL for this.   We need to create a class that implements IShellFolderViewCB as well as IFolderViewSettings.  For our IFolderViewSettings implementation, we only need to provide a handler for the GetFolderFlags method.  It is through this method that we notify the Shell that we want to perform deep searches within our Namespace.

IFACEMETHODIMP CFolderViewCB::GetFolderFlags(__out FOLDERFLAGS *pfolderMask, __out FOLDERFLAGS *pfolderFlags)

{

    if (pfolderMask)

    {

        *pfolderMask = FWF_USESEARCHFOLDER;

    }

    if (pfolderFlags)

    {

        *pfolderFlags = FWF_USESEARCHFOLDER;

    }

   

    return S_OK;

As you can see from the above implementation of GetFolderFlags, we only care to notify the Shell of the FWF_USESEARCHFOLDER flag.  This tells the Shell that our Namespace should use the Search Folder for performing stacking and searching.  You could also specify other flags to modify the appearance and behavior of your namespace.

The modified code for this sample is linked below.  You will notice that the implementation of IShellFolderViewCB and IFolderViewSettings is rather sparse – most methods just return E_NOTIMPL as we are not using them here.   You can implement these yourself if you see the need to extend your code.
Now that we have notified the Shell to use the Search Folder, we can perform deep searches within our Namespace.  When we perform the same search we did previously, we now get the following results:

deep search

This Namespace simply generates 10 virtual items to a default depth of 5.  The Search enumerates the contents of the Namespace to that depth.  It should also be called out that we had to implement our namespace's ParseDisplayName method in order for our namespace to function in the Search folder.

*Please note that the method described here only works with the default shell view (Defview).  It is not supported for custom IShellView implementations.

Building the FolderView SDK Sample

  1. To build the FolderViewImpl sample, be sure to download and install the Windows SDK.
  2. Download the modified FolderView SDK sample
  3. Launch FolderViewImpl.sln in Visual Studio (The solution file is for Visual Studio 2008)
  4. Open the properties for the project
  5. Add a path to the SDK includes to the C/C++ - General page
  6. Add a path to the SDK libs to the Linker – General page
  7. Build

Installing the FolderView SDK Sample

  1. Once you have built the sample, copy the FolderViewImpl.dll and FolderViewImpl.propdesc to the same directory
  2. From an elevated cmd window, regsvr32 FolderViewImpl.dll
  3. Restart explorer
  4. Open explorer to Computer
  5. There should be a list item named “FolderView SDK Sample”

Written by chrdavis on March 3rd, 2008 with comments disabled.
Read more articles on API and Coding and Programming and Search and Search and Organize and Windows Vista and extension and namespace and shell and vista.

Shell Namespace Extension: Enabling Deep Search

Overview

From my past posts about implementing your own Shell Namespace, there have been some great questions posted by readers.  Many of these stem from the fact that the Namespace example is fairly simple in that it does not implement all of the behavior that is possible in Explorer.  This was done to focus on the core steps in getting a working Namespace implemented.  Yet, there are a few extra steps you can take that don’t require too much more coding on your part to add more useful features.  One question in particular that comes up quite often is how to enable deep searching in your Namespace.

You will notice from the existing Namespace example that if you enter a search term in the search box in Explorer, the search only filters items that are currently in the view.  It does not search into the folders.  In the below images, we try to search for “Two” in the search box which only results in 1 item.  Thus, the sub folders were not included.

Filter Search

Filter Results - shallow

What does a Namespace implementer have to do in order to include sub folders in their namespace search results?  This is actually fairly simple.

Implementing IShellFolderViewCB and IFolderViewSettings

In our previous code, we did not implement an IShellFolderViewCB for our Namespace.  This allows your Namespace to be notified of events associated with the view.  An implementation of IShellFolderViewCB can be specified in your call to SHCreateShellFolderView.  This is optional and previously we were just passing NULL for this.   We need to create a class that implements IShellFolderViewCB as well as IFolderViewSettings.  For our IFolderViewSettings implementation, we only need to provide a handler for the GetFolderFlags method.  It is through this method that we notify the Shell that we want to perform deep searches within our Namespace.

IFACEMETHODIMP CFolderViewCB::GetFolderFlags(__out FOLDERFLAGS *pfolderMask, __out FOLDERFLAGS *pfolderFlags)

{

    if (pfolderMask)

    {

        *pfolderMask = FWF_USESEARCHFOLDER;

    }

    if (pfolderFlags)

    {

        *pfolderFlags = FWF_USESEARCHFOLDER;

    }

   

    return S_OK;

As you can see from the above implementation of GetFolderFlags, we only care to notify the Shell of the FWF_USESEARCHFOLDER flag.  This tells the Shell that our Namespace should use the Search Folder for performing stacking and searching.  You could also specify other flags to modify the appearance and behavior of your namespace.

The modified code for this sample is linked below.  You will notice that the implementation of IShellFolderViewCB and IFolderViewSettings is rather sparse – most methods just return E_NOTIMPL as we are not using them here.   You can implement these yourself if you see the need to extend your code.
Now that we have notified the Shell to use the Search Folder, we can perform deep searches within our Namespace.  When we perform the same search we did previously, we now get the following results:

deep search

This Namespace simply generates 10 virtual items to a default depth of 5.  The Search enumerates the contents of the Namespace to that depth.  It should also be called out that we had to implement our namespace's ParseDisplayName method in order for our namespace to function in the Search folder.

*Please note that the method described here only works with the default shell view (Defview).  It is not supported for custom IShellView implementations.

Building the FolderView SDK Sample

  1. To build the FolderViewImpl sample, be sure to download and install the Windows SDK.
  2. Download the modified FolderView SDK sample
  3. Launch FolderViewImpl.sln in Visual Studio (The solution file is for Visual Studio 2008)
  4. Open the properties for the project
  5. Add a path to the SDK includes to the C/C++ - General page
  6. Add a path to the SDK libs to the Linker – General page
  7. Build

Installing the FolderView SDK Sample

  1. Once you have built the sample, copy the FolderViewImpl.dll and FolderViewImpl.propdesc to the same directory
  2. From an elevated cmd window, regsvr32 FolderViewImpl.dll
  3. Restart explorer
  4. Open explorer to Computer
  5. There should be a list item named “FolderView SDK Sample”

Written by chrdavis on March 3rd, 2008 with comments disabled.
Read more articles on API and Coding and Programming and Search and Search and Organize and Windows Vista and extension and namespace and shell and vista.

Windows Sidebar Styler, v2.0.6

I have recently worked on Windows Sidebar Styler and version 2.0.6 is now available.

Among the improvements is instant application of styles as well as the resizable Windows Sidebar feature. The latter is especially useful when Windows Sidebar is docked on the left. Added are more localizations and Alky for Applications is supported for use in Windows XP or Server 2003.

The new version can be downloaded here.

If you are interested in localizing Windows Sidebar Styler in your native language, or just want to suggest a feature for the next version, please do not hesitate to contact me.

Written by Stanimir Stoyanov on August 16th, 2007 with comments disabled.
Read more articles on Programming and Windows Vista.

« Older articles

No newer articles