Jump to content

Welcome to MSFN Forum
Register now to gain access to all of our features. Once registered and logged in, you will be able to create topics, post replies to existing threads, give reputation to your fellow members, get your own private messenger, post status updates, manage your profile and so much more. This message will be removed once you have signed in.
Login to Account Create an Account



Photo

[Tool] Set default application (properly) on Windows Vista/7

- - - - -

  • Please log in to reply
2 replies to this topic

#1
Francesco

Francesco

    Advanced Member

  • Member
  • PipPipPip
  • 411 posts
  • Joined 20-March 04

Description

I made a little tool (attached to this post) that invokes the SetAppAsDefaultAll application registration API to set an application as default on Vista/7. It does exactly the same registration that is performed when you open "Program defaults" and set an application as default.

 

NOTE: it doesn't work on XP/8 because that registration API is only available on Windows Vista and Windows 7. Windows XP and Windows 8 handle application registrations differently (Win8 blocks applications from changing defaults and XP instead has several different ways of which I can't figure if there is a proper one and which one it is).

 

Syntax

SetAppAsDefaultAll.exe /Action=SetAppAsDefaultAll /ProgID="Program Id"

You can find the Program Id value you need in the HKEY_LOCAL_MACHINE\SOFTWARE\RegisteredApplications registry key.

 

Examples

 

To set the latest Windows Photo Gallery 2012 as default:

SetAppAsDefaultAll.exe /Action=SetAppAsDefaultAll /ProgID="WindowsLive.PhotoGallery.16.4"

To set Windows Media Player as default:

SetAppAsDefaultAll.exe /Action=SetAppAsDefaultAll /ProgID="Windows Media Player"

To set VLC as default:

SetAppAsDefaultAll.exe /Action=SetAppAsDefaultAll /ProgID="VLC"

Extra

The tool also supports waiting for a window to open (/Action=WaitForWindow /WindowName="Window Name" /Timeout=seconds) and closing a windowed application properly by sending WM_CLOSE to the window (/Action=CloseWindow /WindowName="Window Name").

Attached Files


Edited by Francesco, 21 July 2013 - 12:08 AM.



How to remove advertisement from MSFN

#2
Octopuss

Octopuss

    I am the walrus

  • Member
  • PipPipPipPipPipPip
  • 1,127 posts
  • Joined 31-January 07
  • OS:Windows 7 x64
  • Country: Country Flag

Donator

This might be pretty handy tool, but being that paranoid internet user I am, I wouldn't want to touch an .exe from unknown person unless source code was provided.

No offence though!



#3
Francesco

Francesco

    Advanced Member

  • Member
  • PipPipPip
  • 411 posts
  • Joined 20-March 04

This might be pretty handy tool, but being that paranoid internet user I am, I wouldn't want to touch an .exe from unknown person unless source code was provided.

No offence though!

Sure, but having the source code still doesn't guarantee the code hasn't been tampered with, you can only be sure it's clean if you read the code line by line and then compile it yourself. As you can see though VirusTotal reports it being completely clean. I didn't bother adding the sources since it's just 3 API calls for setting the default applications (strangely nobody ever bothered to release a similar tool though) but I attached them to this post.

Attached Files






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users