Announcement

Collapse
No announcement yet.

What's wrong with my approach?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • What's wrong with my approach?

    I am trying to write a program that toggles the data/audio
    CD autorunning feature in my Win98 SE. The audio CD autorunning
    toggling part works fine. It's the data CD part that I can't get
    to work.

    I am a registred user of StepUp 98. Its autorunning toggling
    software DOES work. So, I ran REGMON while using it, then I
    ran it while using my TEST program, and the results are NEARLY
    identical, except that the EXPLORER does more stuff when using
    the StepUp feature. So, is there additional message posting that
    my program needs to do to Windows in order for the change in the
    data CD autorunning flag to be "noticed" by Windows? Is there an
    INI file that also has to change? Both my test program and StepUp
    change exactly the same value in the Registry. It's just that,
    for some reason, when using my program, EXPLORER doesn't go
    completely through the steps that it does when StepUp makes the
    changes. So, I must presume that there is additional message
    traffic between StepUp and Windows 98 SE that REGMON doesn't
    show. Unfortunately, the LOG's from REGMON for both StepUp and
    my TEST programs are way too big to post or outline here.

    One thought that crossed my mind is that I am using the wrong
    format in changing the value data in the Registry for the data
    CD flag. The flag is a REG_BINARY value, and has one of the
    following values:

    95 00 00 00 (autorunning enabled)
    b5 00 00 00 (autorunning disabled)

    I have tried the following, amongst other things:

    DIM wx AS ASCIIZ*4
    DIM L1 AS LONG
    DIM L2 AS LONG
    wx = CHR$(149) + CHR$(0) + CHR$(0) + CHR$(0)
    L1 = 4

    RegOpenKeyEx %HKEY_CURRENT_USER, _
    "Software\Microsoft\Windows\CurrentVersion\Policies\Explorer", _
    0, %KEY_SET_VALUE, L2

    RegSetValueEx L2, "NoDriveTypeAutoRun", 0, %REG_BINARY, _
    wx, L1

    I've also tried the following adaptations:

    DIM wx AS DWORD
    wx = 149

    and:

    DIM wx AS LONG
    wx = 149

    My code DOES change the flag in the Registry, according to
    RegEdit,
    BUT, it has NO effect on the autorunning status of
    the CD-ROM drives. StepUp, on the other hand, DOES work.

    Any ideas would be GREATLY appreciated! Thanks in advance!



    ------------------
    Clay C. Clear

    http://www.v3space.com/a/a39/202/

    [email protected]
    [email protected]

  • #2
    This is an update to my first posting.

    It turns out that my data CD autorunning toggling DOES work,
    but ONLY if I reboot my machine. Then, any changes I make to it
    won't take effect until I reboot AGAIN. With the StepUp software,
    the changes are immediate and don't require a reboot. So,
    apparently, StepUp does something besides just changing the
    value. I've pored through the LOG's that I created from REGMON
    while running StepUp, and so far, I can't find where it does
    something that is obvious.

    If anybody has a down-and-dirty answer as to what I need to do
    besides changing the data CD's value, please let me know.

    BTW, I did a search on Microsoft's site for the value name, and
    according to the printouts I made from the results, the value
    is a REG_DWORD, NOT a REG_BINARY, as is used by StepUp.
    However, the discrepancy might be because the only search
    results that I found relate to Win2000, not Win98. I do know
    that StepUp WORKS, so, I have to conclude that it uses the
    correct value type.

    Any ideas?

    Thanks in advance!



    ------------------
    Clay C. Clear

    http://www.v3space.com/a/a39/202/

    [email protected]
    [email protected]

    Comment


    • #3
      OK, another update.

      I did some more research on Microsoft's homesite, this time
      for the keyword "autorun", and found out more info.

      According to the article I read, the Registry value manipulated
      by StepUp and my program is a PERSISTENT variable. So, it's not
      SUPPOSED to be effective immediately (i.e., it's SUPPOSED to
      require a reboot to become effective, and not respond in realtime
      to changes to the variable?) Also, according to the article,
      for Windows 2000 and Windows NT, the user is suppose dto rerun
      Windows Explorer to make the changes take effect. I tried that
      approach in the hopes that it also applied to Win98, but it
      didn't.

      So, my final question on the subject - does anybody have any
      idea on how I can write the program so it has the same realtime
      effects as StepUp? Don't worry - I have every intention of
      ordering Charles Petzold's book. I am WAY too inexperienced
      at writing 32-bit Windows programs to not do so.

      Also, one more note - the article on MS said that the autorun
      feature can be programmatically altered using a Windows message;
      however, that requires the calling program to be the foreground
      program. This will not work for my program, as it'll be placed
      in the Taskbar Notification Area, and will be an on-demand
      program. It's not a program that is run as-needed, then
      terminates itself.

      Thanks!



      ------------------
      Clay C. Clear

      http://www.v3space.com/a/a39/202/

      [email protected]
      [email protected]

      Comment


      • #4
        Explorer re-reads registry, if to stimulate it only.
        Almost sure, that you need SHChangeNotify.
        Difficult to say with which flags - probably, SHCNE_DRIVEADD / SHCNE_MEDIAINSERTED / SHCNE_ALLEVENTS.
        For example, to update a desktop - SHCNE_ASSOCCHANGED.

        ------------------
        E-MAIL: [email protected]

        Comment

        Working...
        X