Does anyone know how to set file association programmatically without having to reboot the computer to get the association to the file extension working? If you set the registry values you then need to reboot the computer.
Back in the good old days when computers were still fun, all one needed to do was use the DOS assoc function. Today one can still use the assoc function but the file associated to the file type is no longer just the name of the file one wants to use. One needs to associate the OLE object for the file.
Having had six people in the last two days open infected zip file email attachments by double clicking them in Outlook, I want to create a one line Macro Scheduler message executable and associate that executable file to the .ZIP extension. I would like to do this programmatically so I don't have to visit 180 computers.
Anybody have any ideas?
How about an idea for what that one line in the Macro Scheduler message should say?
Set File Association?
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Set File Association?
I didn't think a reboot was required. Should just have to set the correct HKEY_CLASSES_ROOT keys :-/ 

Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
Re: Set File Association?
Thanks for the response.
Looked it up again and though a "reboot" is not required, you do have to log out and back in to make the change so just about as bad.
Unless there is someone who has nothing better to do and really wants to figure this out, ignore this for now. I spoke yesterday with a gentleman from the spam filtering service we've had for the last xx years. He said they can filter these out but that I had chosen not to allow that when we first set this up. I don't recall so can't say I didn't. They currently filter executables and certain scripts (not Macro Scheduler). But by my choice they don't scan and filter ZIP files. That will change this week so hopefully the problem goes away.
Looked it up again and though a "reboot" is not required, you do have to log out and back in to make the change so just about as bad.
Unless there is someone who has nothing better to do and really wants to figure this out, ignore this for now. I spoke yesterday with a gentleman from the spam filtering service we've had for the last xx years. He said they can filter these out but that I had chosen not to allow that when we first set this up. I don't recall so can't say I didn't. They currently filter executables and certain scripts (not Macro Scheduler). But by my choice they don't scan and filter ZIP files. That will change this week so hopefully the problem goes away.
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Re: Set File Association?
Try this:
Cribbed from:
http://stackoverflow.com/questions/1052 ... ng-c-sharp
Code: Select all
Let>HWND_BROADCAST=65535
Let>WM_SETTINGHANGE=26
Let>INI_INTL=1
LibFunc>user32,SendMessageA,result,HWND_BROADCAST,WM_SETTINGCHANGE,0,INI_INTL
http://stackoverflow.com/questions/1052 ... ng-c-sharp
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?