線上訂房服務-台灣趴趴狗聯合訂房中心
發文 回覆 瀏覽次數:1101
推到 Plurk!
推到 Facebook!

如何取消CD auto play時所產生的表單

尚未結案
LeonSun
一般會員


發表:5
回覆:9
積分:2
註冊:2003-10-17

發送簡訊給我
#1 引用回覆 回覆 發表時間:2004-02-18 20:21:39 IP:61.56.xxx.xxx 未訂閱
在XP下,若在光碟機中放入音樂片,會自動產生要求使用者選擇哪一種視窗播放的表單,請問各位大大要如何在程式中寫Code讓此表單不在show出,且能再關閉程式時,我可以回復原設定。謝謝! 發表人 - taishyang 於 2004/02/18 21:04:44
CuteBabyBoy
初階會員


發表:18
回覆:97
積分:48
註冊:2003-07-11

發送簡訊給我
#2 引用回覆 回覆 發表時間:2004-02-23 11:13:04 IP:218.167.xxx.xxx 未訂閱
您可以 Try Try 看 去更新 Regedit [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\policies\Explorer] "NoDriveTypeAutoRun"=dword:000000b5 加上這個值就可以擋掉 如果要回復~~~刪掉即可 Baby
LeonSun
一般會員


發表:5
回覆:9
積分:2
註冊:2003-10-17

發送簡訊給我
#3 引用回覆 回覆 發表時間:2004-02-23 12:44:26 IP:61.219.xxx.xxx 未訂閱
真的嗎?我一直不知道是哪一個Registry,感謝不已,我馬上就試!
LeonSun
一般會員


發表:5
回覆:9
積分:2
註冊:2003-10-17

發送簡訊給我
#4 引用回覆 回覆 發表時間:2004-02-23 13:13:40 IP:61.219.xxx.xxx 未訂閱
我試過了,再次感謝CuteBabyBoy兄的幫忙,我試過之後有一個問題就是當改完這個Registry後,必須要重新開機才可以正常工作,是不是可以有即時就可以工作的機制,就是當User啟動我的程式後即將AutoPlay關掉,當將我的程式關掉則又恢復AutoPlay,抱歉,我之前沒有說清楚。
CuteBabyBoy
初階會員


發表:18
回覆:97
積分:48
註冊:2003-07-11

發送簡訊給我
#5 引用回覆 回覆 發表時間:2004-02-24 11:47:39 IP:218.167.xxx.xxx 未訂閱
Dear LeonSun 的確,當我更新Registry時,通常都要重開機才會生效!如果您想要即時生效,我 " 感覺 " 應該是用 下Command 的方式才有可能發生。(雖然我也在查如何下Command) 而我自己所寫的程式,是Always Close CD-AutoRun,所以比較沒這個問題! 所以大家一起來討論吧....^^ Baby (我也是在學習中,功力不夠的地方請多多包含唷..^^) Baby
LeonSun
一般會員


發表:5
回覆:9
積分:2
註冊:2003-10-17

發送簡訊給我
#6 引用回覆 回覆 發表時間:2004-02-27 09:58:52 IP:61.219.xxx.xxx 未訂閱
CuteBabyBoy兄,您說的Always Close CD-AutoRun,其實我有想過,但這樣不會因有User去改回Registry而毀了這個機制嗎?可能我想比較多吧! 所以我還在等您的Command,若能以每次啟動的機制我覺得比較完美。
CuteBabyBoy
初階會員


發表:18
回覆:97
積分:48
註冊:2003-07-11

發送簡訊給我
#7 引用回覆 回覆 發表時間:2004-02-28 07:35:02 IP:61.229.xxx.xxx 未訂閱
引言: CuteBabyBoy兄,您說的Always Close CD-AutoRun,其實我有想過,但這樣不會因有User去改回Registry而毀了這個機制嗎?可能我想比較多吧! 所以我還在等您的Command,若能以每次啟動的機制我覺得比較完美。
哈哈...我最近有去國外的站找..........找不到啦........>< 可能這次有點抱歉....幫不上忙了...........>< Baby
LeonSun
一般會員


發表:5
回覆:9
積分:2
註冊:2003-10-17

發送簡訊給我
#8 引用回覆 回覆 發表時間:2004-02-28 11:01:50 IP:61.229.xxx.xxx 未訂閱
CuteBabyBoy兄,您太客氣了,有如此的解決方向提供給我,我已經感激不盡。 雖然沒有比較完美答案,在這還是由衷感謝您。
ttol
一般會員


發表:1
回覆:3
積分:0
註冊:2004-05-04

發送簡訊給我
#9 引用回覆 回覆 發表時間:2004-06-19 09:06:36 IP:211.76.xxx.xxx 未訂閱
關於 NoDriveTypeAutoRun 的詳細設定 http://www.microsoft.com/windows2000/techinfo/reskit/en-us/default.asp?url=/windows2000/techinfo/reskit/en-us/regentry/91525.asp    若要讓修改立即生效, 只要把 Explorer.exe 的 process 殺掉重新執行就好了 只是我在 xp 中, 把 Explorer.exe 殺掉後, xp 會自動重新載入, 就不用在自己動手了 其他的環境我就沒試過會不會自動重載了    
procedure DisableAutoRun();
var reg:TRegistry;
begin
  Reg := TRegistry.Create;
  try
    Reg.RootKey := HKEY_CURRENT_USER;
    if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer', True) then
    begin
      reg.WriteInteger('NoDriveTypeAutoRun',$95);
      Reg.CloseKey;
    end;
  finally
    Reg.Free;
  end;
  RerunExeFile('Explorer.exe');
end;    procedure EnableAutoRun();
var reg:TRegistry;
begin
  Reg := TRegistry.Create;
  try
    Reg.RootKey := HKEY_CURRENT_USER;
    if Reg.OpenKey('\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer', True) then
    begin
      reg.WriteInteger('NoDriveTypeAutoRun',$91);
      Reg.CloseKey;
    end;
  finally
    Reg.Free;
  end;
  RerunExeFile('Explorer.exe');
end;    Procedure RerunExeFile(FileName:String);
var
  Found: Boolean;
  AWnd, AHandle: THandle;
  ProcessEntry32: TProcessEntry32;
  APath: array [0..MAX_PATH] of Char;
begin
  AWnd := Application.MainForm.Handle;//FindWindow('TMainForm', nil);
  if AWnd = 0 then Exit;
  AHandle := CreateToolhelp32Snapshot(TH32CS_SNAPPROCESS, 0);
  try
    ProcessEntry32.dwSize := Sizeof(ProcessEntry32);
    Found := Process32First(AHandle, ProcessEntry32);
    while Found do
    begin
      if uppercase(StrPas(ProcessEntry32.szExeFile)) = UpperCase(FileName) then
      begin
        GetModuleFileNameEx(OpenProcess(PROCESS_QUERY_INFORMATION or PROCESS_VM_READ, False,
              ProcessEntry32.th32ProcessID), 0, @APath[0], SizeOf(APath));//取得進程路徑
        TerminateProcess(OpenProcess(PROCESS_ALL_ACCESS, True,
              ProcessEntry32.th32ProcessID), 0);//結束進程
//        ShellExecute(AWnd, 'open', APath,  nil, nil,  SW_SHOW);//重新運行程式
//        Break;
      end;
      Found := Process32Next(AHandle, ProcessEntry32);
    end;
  finally
    CloseHandle(AHandle);
  end;
end;
ttol
一般會員


發表:1
回覆:3
積分:0
註冊:2004-05-04

發送簡訊給我
#10 引用回覆 回覆 發表時間:2004-06-19 09:16:44 IP:211.76.xxx.xxx 未訂閱
NoDriveTypeAutoRun HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\Explorer Data type : REG_DWORD Range : 0x0–0xFF Default value : 0x95 Description Disables the Autoplay feature on all drives of the type specified. Autoplay begins reading from a drive as soon as media is inserted in the drive. As a result, the setup file of programs and the sound on audio media starts immediately. This entry stores the setting of the Disable Autoplay Group Policy. Group Policy adds this entry to the registry when you enable the Disable Autoplay policy. If you disable the policy or set it to Not configured, Group Policy deletes this entry from the registry, and the system behaves as though the value is 0x95. This entry is a bitmapped value. To disable Autoplay on a particular type of drive, set the bit representing that drive type to 1. To disable more than one type of drive, set the bits representing each type to 1, or sum the hexadecimal values of the representative bits. Value Meaning 0x1 Disables Autoplay on drives of unknown type. 0x4 Disables Autoplay on removable drives. 0x8 Disables Autoplay on fixed drives. 0x10 Disables Autoplay on network drives. 0x20 Disables Autoplay on CD-ROM drives. 0x40 Disables Autoplay on RAM disks. 0x80 Disables Autoplay on drives of unknown type. 0xFF Disables Autoplay on all types of drives. By default, Autoplay is disabled on removable drives, such as the floppy disk drive (but not the CD-ROM drive), and on network drives. The default value 0x95 (149) is the sum of 0x1, 0x81 (unknown types), 0x4 (floppy drives), and 0x10 (network drives).
系統時間:2024-05-04 19:57:58
聯絡我們 | Delphi K.Top討論版
本站聲明
1. 本論壇為無營利行為之開放平台,所有文章都是由網友自行張貼,如牽涉到法律糾紛一切與本站無關。
2. 假如網友發表之內容涉及侵權,而損及您的利益,請立即通知版主刪除。
3. 請勿批評中華民國元首及政府或批評各政黨,是藍是綠本站無權干涉,但這裡不是政治性論壇!