DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports Events Over 2 million developers have joined DZone. Join Today! Thanks for visiting DZone today,
Edit Profile Manage Email Subscriptions Moderation Admin Console How to Post to DZone Article Submission Guidelines
View Profile
Sign Out
Refcards
Trend Reports
Events
Zones
Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Using Jump List Icons in Windows Desktop Applications

Denzel D. user avatar by
Denzel D.
·
Oct. 04, 12 · Interview
Like (0)
Save
Tweet
Share
5.49K Views

Join the DZone community and get the full member experience.

Join For Free

Since the release of Windows 7, lots of .NET developers felt the need to use the new features introduced by the OS. One of these features is the possibility to have jump lists for the application icon in the system taskbar.  

Natively, using the new taskbar capabilities is only possible by using the Win32 API. But there is also a managed library for .NET developers – the Windows API Code Pack for .NET Framework, that allows the use of custom Windows  capabilities (not only limted to the taskbar) from a .NET application without using the Win32 API directly.

Although this library isn’t very complicated when it using it’s capabilities, there are some serious limitations. One of them is the possibility to assign icons to a JumpListLink (or a JumpListItem).

When creating a JumpListLink, I was thinking that referencing an icon to it will be fairly easy. I did not want to use icons included in a pre-built executable or DLL (as it is shown in most samples online), but rather use my own icons. Doesn’t seem like it is going to be really hard, right?

Well it was a bit tricky. I tried using this code to reference an icon to the JumpListLink:

JumpListLink jll = new JumpListLink ("about:blank", "JumpListLink"); 

jll.IconReference = new IconReference ("C:\\Users\\Dennis\\Documents\\Visual Studio 2008\\Projects\\IconLib\\32.ico"); 

But this wasn’t the right thing to do, since I was getting an exception that stated - Reference path is invalid. After checking the path to make sure that the icon is there I set a breakpoint, so I can track the actual path that was used. It was used correctly, but the icon cannot be loaded anyway.

After a few days of searching, I finally found a solution. What is needed, is a Native Resource Template, that can be easily created in Visual Studio from the File > New > File… menu.

Once the file opens, right click on the designer area and select the Add Resource… option. From the dialog that opens, select the Icon option.  

When you click Import…, you can select as many icons as you want that will be added to the resource file. Once added, save the resource file as a 32-bit Resource File (*.res). Now, all you have to do is reference the newly created resource file in your project.

By default, in every new Windows Forms C# application, the application resources are managed through an embedded manifest. I referenced the resource file instead. To do this, open the project properties (the Properties item in the Solution Explorer) and select the Application tab. Find the Resources box and select the Resource File option instead of the default Icon and Manifest. Browse and select the resource file you created.  

Once you build the project, you can reference the icons from the resource file:

JumpListLink jll = new JumpListLink ("about:blank", "JumpListLink"); 

jll.IconReference = new IconReference (Assembly.GetEntryAssembly().Location, 0);
Icon application Desktop (word processor)

Opinions expressed by DZone contributors are their own.

Popular on DZone

  • Handling Automatic ID Generation in PostgreSQL With Node.js and Sequelize
  • Handling Virtual Threads
  • Efficiently Computing Permissions at Scale: Our Engineering Approach
  • 3 Examples of Address Autofill Forms to Collect Shipping and Payment Addresses

Comments

Partner Resources

X

ABOUT US

  • About DZone
  • Send feedback
  • Careers
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 600 Park Offices Drive
  • Suite 300
  • Durham, NC 27709
  • support@dzone.com
  • +1 (919) 678-0300

Let's be friends: