Hi..i want to creat a autorun programme to cd's which i am writing.so i want to creat that programme using vb 6.
now i want to creat a command button when i click on it open a seperate window and browse the cd..please help me to creat that..

Recommended Answers

All 2 Replies

declare function mcisendstring lib"winmm.dll" alais "mcisendstringA"

retvalue=mcisendstring("set cdaudio door open",returnstring,127,0)
end sub

retvalue=mcisendstring("set cdaudio door closed",returnstring,127,0)
end sub

In my case this is how i do it...
1.) Create an Autorun file, do this by opening Notepad, and add this:


Then save it as: Autorun.ini

Then go back to your VB6 project and on that main window program add this code:

Option Explicit

Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Private Sub Command1_Click()
ShellExecute 0, vbNullString, "\Name of some folder on that CD that you might want to browse to it", vbNullString, vbNullString, vbNormalFocus
End Sub

You can add it to a command button, or have the code to be execute on runtime.

Private Sub Form_Load()
Code here
End Sub
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.