Home All Groups Group Topic Archive Search About
Author
4 Feb 2006 5:33 PM
everett.gillert
how do you add a icon to the task bar and when clicked on trigger a
event
this is the program im making
"
Set WMP = CreateObject("WMPlayer.OCX.7" ) '  vbscript
Set CDROMs = WMP.cdromCollection

If CDROMs.Count >= 1 Then
For i = 0 to CDROMs.Count - 1
  CDROMs.Item(i).Eject
Next
End If "
it ejects the cdrom drive i need to have a icon on the taskbar to
trigger the event for this and can you get vbscript in to vb.net code
thank you in advance

Author
4 Feb 2005 10:21 PM
Crouchie
Are you talking System Tray or Taskbar? I think you are talking about System
Tray

If you mean Taskbar then you can use the IsIconic property to check to see
if the program is minimised in Form_Resize()

If you are talking about about system tray then that makes more sense for
what you want to do

Add a Notifyicon to your application with a Context Menu

You will need to look into the WMP SDK for some info you require, but for
ejecting the CD-ROM is just simple API. See below:

Private Declare Function mciSendString Lib "winmm.dll" Alias
"mciSendStringA" (ByVal lpstrCommand As String, ByVal lpstrReturnString As
String, ByVal uReturnLength As Int32, ByVal hwndCallback As Int32) As Int32

Open CD Drive:

mciSendString("set CDAudio door open", vbNull, 127, 0)

Close CD Drive:

mciSendString("set CDAudio door closed", vbNull, 127, 0)

I hope this helps

Crouchie1998
BA (HONS) MCP MCSE