CView也是从CObject派生来的,CObject的函数CView也可以使用。
不过这要区别情况,看你使用函数做什么?光盘自动播放好象是个SHELL函数,用VB也可以调用。不过抱歉没有用过,让我查一下吧我也没有给过分,不过前面好象有讨论如何给分的贴子。好象是在别人回答时的名字后边直接修改得分值,然后系统要你的密码,输入即可。

解决方案 »

  1.   

    哈哈,懒得翻译自己看吧。
    是SDK程序,不过我觉得有简单方法,是通过配置文件配合做到的,好多光盘上都有一个autorun.inf的配置文件。Suppressing AutoPlay Programmatically
    There are a variety of situations where AutoPlay may need to be suppressed programmatically. Two examples are:Your application has a setup program that requires the user to insert another disc that may contain an Autorun.inf file. 
    During the operation of your application, the user may need to insert another disc that may contain an Autorun.inf file. 
    In either case, you will normally not want to launch another application while the original is in progress.Users can manually suppress AutoPlay by holding down the SHIFT key when they insert the CD-ROM. However, it is usually preferable to handle this operation programmatically rather than depending on the user.With systems that have shell version 4.70 and later, Microsoft® Windows® sends a "QueryCancelAutoPlay" message to the foreground window. Your application can respond to this message to suppress AutoPlay. This approach is used by system utilities such as the Open common dialog box to disable AutoPlay. You will not get a "QueryCancelAutoPlay" message with versions of Windows 95 that do not have the Internet Explorer 4.0 integrated shell installed.The following code fragments illustrate how to set up and handle this message. Your application must be running in the foreground window. First, register "QueryCancelAutoPlay" as a Windows message:uMessage = RegisterWindowMessage(TEXT("QueryCancelAutoPlay")); 
     
    Your application's window must be in the foreground to receive this message. The message handler should return TRUE to cancel AutoPlay and FALSE to enable it. The following code fragment illustrates how to use this message to disable AutoPlay.
    UINT g_uQueryCancelAutoPlay = 0;LRESULT WndProc(HWND hwnd, UINT uMsg,  WPARAM wParam, LPARAM lParam) 

        switch (uMsg) { 
        ... 
        default: 
            if (!g_uQueryCancelAutoPlay)
            { 
                g_uQueryCancelAutoPlay = RegisterWindowMessage(TEXT("QueryCancelAutoPlay"));
            } 
            if (uMsg && uMsg == g_uQueryCancelAutoPlay)
            { 
                return TRUE;       // cancel auto-play
            }
        }
    }
     
    If your application is using a dialog box and needs to respond to a "QueryCancelAutoPlay" message, it cannot simply return TRUE or FALSE. Instead, call SetWindowLong with nIndex set to DWL_MSGRESULT. Set the dwNewLong parameter to TRUE to cancel AutoPlay, and FALSE to enable it. For example, the following sample dialog procedure cancels AutoPlay when it receives a "QueryCancelAutoPlay" message.UINT g_uQueryCancelAutoPlay = 0;BOOL DialogProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) 

        switch (uMsg) { 
        ...
        default: 
            if (!g_uQueryCancelAutoPlay)
            {
                g_uQueryCancelAutoPlay = RegisterWindowMessage(TEXT("QueryCancelAutoPlay"));
            } 
            if (uMsg == g_uQueryCancelAutoPlay) 
            {
                SetWindowLong(hDlg, DWL_MSGRESULT, TRUE);          
                return 1;               
            }
        } 

    下面是通过操作系统设置支持自动播放的说明How to Enable or Disable the CD-ROM Autorun Feature
    ID: Q155217  --------------------------------------------------------------------------------
    The information in this article applies to:Microsoft Windows NT Server 
    Microsoft Windows NT Workstation 
    Microsoft Windows 2000 Professional 
    Microsoft Windows 2000 Server 
    Microsoft Windows 2000 Advanced Server--------------------------------------------------------------------------------
    SUMMARY
    If there is a CD-ROM changer attached to your computer, you may want to disable the Autorun (the automatic running of a compact disc or the automatic playing of an audio compact disc) feature. If the Autorun feature is enabled with a CD-ROM changer, each time a new compact disc is inserted into one of the trays, Windows NT will cycle through every tray in the changer. This article describes how to disable the Autorun feature in Windows NT version 4.0. MORE INFORMATION
    There is no user interface option to enable or disable the Autorun feature. To enable or disable the feature, you must edit the registry. To do so, follow the steps below. WARNING: Using Registry Editor incorrectly can cause serious problems that may require you to reinstall Windows NT. Microsoft cannot guarantee that problems resulting from the incorrect use of Registry Editor can be solved. Use Registry Editor at your own risk. Change the Autorun value in the following registry key:HKEY_LOCAL_MACHINE\System\CurrentControlSet\Services\CDRomTo disable the Autorun feature, change the Autorun value to 0. To enable the Autorun feature, change the Autorun value to 1. 
    Restart the computer. 
    NOTE: The above method disables the Autorun feature completely. If you want to disable the feature on a per compact disc basis, you can hold down one of the SHIFT keys while inserting the compact disc.
    For more information on this utility see the following article in the Microsoft Knowledge Base:ARTICLE-ID: Q168113
    TITLE : Using Windows 95 PowerToys with Windows NT 4.0Additional Information
    There are two other keys that can affect this functionality: 
    HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer 
    NoDriveTypeAutoRun = 0x00000095 
    HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Policies\Explorer 
    NoDriveTypeAutoRun = 0x00000095 
    The correct value for each is0x00000095. Additional query words: prodnt auto autoinsert insert notification autorun.inf Keywords : kbenv nthowto ntconfig ntregistry NTSrvWkst 
    Version : WINDOWS:2000; winnt: 
    Platform : WINDOWS winnt 
    Issue type : kbhowto