Using commands in vb with a class to control the command
Heres your chance to share your own tutorials with the community. Just post them on here. If your lucky they may even be posted on the main site.
3 posts
Page 1 of 1
Hello this is my first tutorial
this is about using commands sort of like sendmessage type stuff!
------------------------------------------------------------------------------------------------------------------------------------------------------------
You need:
1 Class named Command.vb
1 Contextstrip named "Commands" - put a menustriptool name it devices then add on cd drive then open:

under form1 design change the name to "core"
also set contextmenu to: commands
right click core and click view code, and copy and paste this:
there are many more commands like that have to do with os based stuff plus things like advanced pc restart shutdown start screensaver and more good luck!
Credits:
50% MSDN forums - for the set audio cd open code!
50% Me - doing the custom _command part
I am using this to make something very special i might release it in the yay future if i ever finish it :P

------------------------------------------------------------------------------------------------------------------------------------------------------------
You need:
1 Class named Command.vb
1 Contextstrip named "Commands" - put a menustriptool name it devices then add on cd drive then open:

under form1 design change the name to "core"
also set contextmenu to: commands
right click core and click view code, and copy and paste this:
Code: Select all
last copy and paste this in command.vb:
Public Class Core
Dim _command As New Command
Private Sub OpenToolStripMenuItem_Click(sender As System.Object, e As System.EventArgs) Handles OpenToolStripMenuItem.Click
_command.OpenCD()
End Sub
End Class
Code: Select all
Debug it right click then use the context menu to navigate to the open drive and click it and it should open your drive!!!Public Class Command
Declare Function mciSendString Lib "winmm.dll" Alias "mciSendStringA" _
(ByVal lpszCommand As String, ByVal lpszReturnString As String, _
ByVal cchReturnLength As Long, ByVal hwndCallback As Long) As Long
Public Sub OpenCD()
mciSendString("set CDAudio door open", 0, 0, 0)
End Sub
End Class
there are many more commands like that have to do with os based stuff plus things like advanced pc restart shutdown start screensaver and more good luck!
Credits:
50% MSDN forums - for the set audio cd open code!
50% Me - doing the custom _command part
I am using this to make something very special i might release it in the yay future if i ever finish it :P
You do not have the required permissions to view the files attached to this post.
Last edited by lucky134 on Fri Jul 20, 2012 7:01 am, edited 2 times in total.
That's ma brother :P
<a href="http://www.points2shop.com/s/xbox_point ... 5082"><img src="http://points2shop.com/images/promotion ... ricoxg.gif" border="0"/></a>
3 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023