Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Autorun:  How to Programmatically Enable/Disable


6 replies to this topic

colby

colby
  • Full Members
  • 37 posts

Posted 18 October 2002 - 20:47

I've seen several postings here and on the InstallShield discussions forum but have not seen the solution posted.

Can someone please post an InstallScript example of programmatically disabling AutoRun?

There's an  MSDN article on Enabling and Disabling AutoRun but it's written in C.

Leigh Ravenhall

Leigh Ravenhall
  • Members
  • 269 posts

Posted 21 October 2002 - 00:34

Isn't the Autorun setting based on the value of HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\Cdrom\AutoRun?
Leigh Ravenhall
Expert Information Services

colby

colby
  • Full Members
  • 37 posts

Posted 21 October 2002 - 15:47

Yes, but changing it requires a reboot before the setting takes effect.  The MSDN article describes how to programmatically change the setting for the current session, but I don't know which API to declare.  Also, the example in the article is written in C and I don't know C.

colby

colby
  • Full Members
  • 37 posts

Posted 22 October 2002 - 18:44

Well, I posted this twice to the InstallShield Newsgroups and didn't get a response. After submitting a request to InstallShield Support, I was told to contact Microsoft for problems with the RegisterWindowMessage() API described in the aforementioned MSDN article. (I wasn't having problems with RegisterWindowMessage, I was having problems figuring out how to call it from InstallScript!;)

After complaining that what I need is information on how to execute the code from InstallScript, I was told to reference article Q102918 for instructions on how to call APIs from InstallScript.

Yet, again I have been let down by the useless support personnel at InstallShield.

AS A WORKAROUND,
I decided to use the FileBrowseDlg() procedure described in article Q104325 because opening the File Browse dialog automatically disables AutoRun temporarily.

However, I still feel that someone should post the (InstallShield) programmatic solution for temporarily disabling AutoRun using the RegisterWindowMessage API. In fact, this should be a built-in InstallScript option for Enable/Disable (similar to HOURGLASS).

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 24 October 2002 - 10:47

I don't think it's possible to receive this type of message in InstallScript. The scripting engine doesn't pass all the messages to your script. I believe you'll have to create an exe for that purpose that you launch from your script. (a DLL might also work). So there's no way around C as far as I can see...

colby

colby
  • Full Members
  • 37 posts

Posted 29 October 2002 - 02:28

I don't think InstallScript needs to receive the message.  It needs to broadcast the message.  I believe this can be done using the RegisterWindowMessage and SendMessage APIs but I don't know how to do it.

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 04 November 2002 - 17:21

The operating system will send the QueryCancelAutoPlay to the foreground window. Your setup has to handle it in its message loop and return TRUE to cancel the autoplay.
I think a feature request has been submitted to InstallShield to include such functionality in a future version.