0

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..

3
Contributors
2
Replies
3
Views
5 Years
Discussion Span
Last Post by C0ding
0

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

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

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

0

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

[autorun]
Open=Your-Main-Window-CD-Program.exe
Icon=Your-Main-Window-CD-Program.exe

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.
Example:

Private Sub Form_Load()
Code here
End Sub
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.