Sponsored links

Go Back   MP3Car.com > Mp3Car Technical > Software & Software Development > Front Ends > StreetDeck > DigitalMods (Scripts / API)


Reply
 
Share Thread Tools Display Modes
Old 01-21-2007, 07:19 PM   #1
Newbie
 
Join Date: May 2005
Posts: 46
slojam is on a distinguished road
Visual BASIC Syntax check for .NET addin

I am trying the simplist of .NET addins using Visual BASIC Studio 2005. I am not an object oriented programming expert --- using this as a learning experience!

I have boiled down an example into the following to simply toggle the screen between fullscreen and windowed...I have followed the instructions of the C# sample, incluing putting the .dll in the Addins directory under the GUID, making the dll COM visible etc. Here is my visual basic code:

============================
Code:
Imports System.Runtime.InteropServices Namespace PDAKey <GuidAttribute("0304F473-515A-45ab-BE2E-E93419F21CB8"), ProgId("StreetDeck.PDAKey"), ComVisible(True)> _ Public Class Class1 Implements StreetDeck.IDualStreetDeckAddin Dim app As StreetDeck.StreetDeckApp Public Sub OnConnection(ByVal Application As Object, ByVal eConnectMode As StreetDeck.enumAddinConnectMode) Implements StreetDeck.IDualStreetDeckAddin.OnConnection app.SendFunction(StreetDeck.enumSDFunctions.eFunctionToggleFullscreen) End Sub Public Sub OnDisconnect() Implements StreetDeck.IDualStreetDeckAddin.OnDisconnect End Sub End Class End Namespace

=========================

The app builds and is in the addins directory under the GUID. When I run StreetDeck and look under Digital Mods within StreetDeck, it says that the Digital mod that I have created is 'stopped'

Firstly, is my syntax correct for the above code, particular for the 'DIM app..' statement and use of 'app' for the app.sendfunction call...

I have only created a script project withn StreetDeck..it is not clear to me what magic within StreetDeck looks within the 'addins' directory under the GUID to pull in the dll. I have not defined a scripted overlay or a module as I am not intending to script anything within StreetDeck (for this simple test case). I simply want the addin to be loaded, toggle the screen to confirm that I am connecting 'all of the dots correctly'

I am sure others will want to use Visual BASIC to create a .NET addin, and hopefuly this thread will provide a tutorial of benefit.

Thanks
__________________
SLOJAM

1972 'slightly enhanced' 240Z
Epia M10000 Win XP
Creative Soundblaster Audigy 2 ZS
7" Touchscreen XMPCR GPS

Last edited by slojam; 01-22-2007 at 01:22 AM.
slojam is offline   Reply With Quote
Advertisement
 
Advertisement
Sponsored links

Old 01-21-2007, 11:43 PM   #2
Newbie
 
Join Date: May 2005
Posts: 46
slojam is on a distinguished road
Can any of you C# experts help translate the syntax of this code snippet into a Visual Basic call....it's from the example code. Apologies if this is elemental!

Thanks!

Code:
StreetDeck.Panel btnShowOverlay = (StreetDeck.Panel) module.CreatePanel(StreetDeck.enumCreatePanelType.eCPTButton, "BUTTON.LISTITEM_HIGH", "ShowOverlay", //This is the function name that will be given back to us in any OnExec call and for all intents and purposes is the name of this panel app.GetSystemMetric(StreetDeck.enumSystemMetrics.eSMGenericModuleClientX), app.GetSystemMetric(StreetDeck.enumSystemMetrics.eSMGenericModuleClientY), 200, 200);

__________________
SLOJAM

1972 'slightly enhanced' 240Z
Epia M10000 Win XP
Creative Soundblaster Audigy 2 ZS
7" Touchscreen XMPCR GPS
slojam is offline   Reply With Quote
Old 01-22-2007, 02:29 AM   #3
Newbie
 
Join Date: Aug 2006
Posts: 49
pogitalonx is an unknown quantity at this point
I think you have to do something like:

Code:
Public Sub OnConnection(ByVal Application As Object, ByVal eConnectMode As StreetDeck.enumAddinConnectMode) Implements StreetDeck.IDualStreetDeckAddin.OnConnection app = Application app.SendFunction(StreetDeck.enumSDFunctions.eFunctionToggleFullscreen) End Sub

Try that out and see if it works.

Quote:
Can any of you C# experts help translate the syntax of this code snippet into a Visual Basic call....it's from the example code. Apologies if this is elemental!

As for this...

Code:
Dim myModule As StreetDeck.ScriptModule myModule = app.CreateModule("MyModule") Dim btnShowOverlay As StreetDeck.Panel btnShowOverlay = myModule.CreatePanel(StreetDeck.enumCreatePanelType.eCPTButton, _ "BUTTON.LISTITEM_HIGH", "ShowOverlay", _ app.GetSystemMetric(StreetDeck.enumSystemMetrics.eSMGenericModuleClientX), _ app.GetSystemMetric(StreetDeck.enumSystemMetrics.eSMGenericModuleClientY), 200, 200)

Kind of messy, but it gets the job done. the "_" are to put one line of code on several lines to make it easier to read instead of having one huge long line of code that scrolls off the page.

Last edited by pogitalonx; 01-22-2007 at 02:30 AM. Reason: fixed formatting
pogitalonx is offline   Reply With Quote
Old 01-22-2007, 11:49 AM   #4
Newbie
 
Join Date: May 2005
Posts: 46
slojam is on a distinguished road
Pogi,

Thanks for your help. Still not toggling the screen.

If I create the .dll (which I am) and place it in the addins directory, do I need to do anything within StreetDeck other than create the script project as outlined in the tutorial, which creates the GUID and GUID directory to actually have the addin 'run'? In other words, should I create a superficial script overlay within StreetDeck to kickstart the addin? It seems in the Com++ example that is the case. Again, apologies for simple questions...

The fact that StreetDeck indicates that my DigMod is 'stopped' is the root of my question.

Thanks any and all for wisdom...I am sure it will help others.
__________________
SLOJAM

1972 'slightly enhanced' 240Z
Epia M10000 Win XP
Creative Soundblaster Audigy 2 ZS
7" Touchscreen XMPCR GPS
slojam is offline   Reply With Quote
Old 01-23-2007, 12:29 AM   #5
Newbie
 
Join Date: May 2005
Posts: 46
slojam is on a distinguished road
Got it running...I had a problem within Visual Studio where I had declared a 'root namespace' on the application tab within Studio for this application, which basically prefixes to the Namespace given within the .vb file...e.g. instead of PDAKey.Class, the build was PDAKey.PDAKey.Class as I had used the root namespace field. I left that blank and I was then able to link to the dll as an exposed object properly.

Also, no need to do anything in script overlay to get the addin to load and execute On_Create as I was suspecting.
__________________
SLOJAM

1972 'slightly enhanced' 240Z
Epia M10000 Win XP
Creative Soundblaster Audigy 2 ZS
7" Touchscreen XMPCR GPS
slojam is offline   Reply With Quote
Old 01-23-2007, 04:52 PM   #6
Newbie
 
Join Date: Aug 2006
Posts: 49
pogitalonx is an unknown quantity at this point
Sweet! Time to write some kick-*** addins!
pogitalonx is offline   Reply With Quote
Old 01-24-2007, 11:33 PM   #7
Newbie
 
Join Date: May 2005
Posts: 46
slojam is on a distinguished road
For those interested...below is the simple 'Example1' that Chuck wrote in C# transposed into Visual BASIC 2005.

Code:
Imports System.Runtime.InteropServices Imports System.Diagnostics Namespace StreetDeckVBAddin <GuidAttribute("0304F473-515A-45ab-BE2E-E93419F21CB8"), ProgId("StreetDeckVBAddin.Class1")> _ Public Class Class1 Implements StreetDeck.IDualStreetDeckAddin Public app As StreetDeck.StreetDeckApp Dim MyModule As StreetDeck.ScriptModule Dim overlay As StreetDeck.ScriptOverlay Dim btnShowOverlay As StreetDeck.Panel Public Sub OnConnection(ByVal Application As Object, ByVal eConnectMode As StreetDeck.enumAddinConnectMode) Implements StreetDeck.IDualStreetDeckAddin.OnConnection app = Application ' setup local reference to Object MyModule = app.CreateModule("ModuleName") btnShowOverlay = MyModule.CreatePanel(StreetDeck.enumCreatePanelType.eCPTButton, _ "BUTTON.LISTITEM_HIGH", "ShowOverlay", _ app.GetSystemMetric(StreetDeck.enumSystemMetrics.eSMGenericModuleClientX), _ app.GetSystemMetric(StreetDeck.enumSystemMetrics.eSMGenericModuleClientY), _ 200, 200) btnShowOverlay.Caption = "Show Overlay" overlay = app.CreateOverlay("OverlayTest") ' Register for events AddHandler MyModule.OnExec, AddressOf module_OnExec End Sub Public Sub OnDisconnect() Implements StreetDeck.IDualStreetDeckAddin.OnDisconnect RemoveHandler MyModule.OnExec, AddressOf module_OnExec End Sub Public Function module_OnExec(ByVal Description As String, ByVal eEM As StreetDeck.enumExecMessage, ByVal wParam As Int32) As Boolean If (Description = "ShowOverlay") Then If (eEM = StreetDeck.enumExecMessage.eEMSelect) Then overlay.Visible = Not (overlay.Visible) overlay.MsgBox("Overlay Visibility Changed!", "Button Clicked") Return True End If End If Return False End Function End Class End Namespace

I first wrote this using the free 'Express' version of Visual BASIC, which is good enough except it does not allow you to run an external program (StreetDeck) for debugging purposes. I downloaded the 90 day trial of Visual Studio, which allowed me to trace through the execution of the .dll and find a couple of bugs/issues -- a really neat capability not available in the Express version.

At any rate, I hope the above snippet helps those of you looking to write something in Visual BASIC as a .NET addin - I have learned a lot about object oriented programming and will now move on to creating a 'real' app.
__________________
SLOJAM

1972 'slightly enhanced' 240Z
Epia M10000 Win XP
Creative Soundblaster Audigy 2 ZS
7" Touchscreen XMPCR GPS
slojam is offline   Reply With Quote
Sponsored links
Advertisement
 
Advertisement
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Damn visual basic BiohazrD Software & Software Development 2 02-04-2005 02:10 PM
Return from Hibernate - Visual Basic Laidback Software & Software Development 3 01-28-2005 02:41 PM
i need a visual basic OCX for an generic infrared receiver babas151 Software & Software Development 9 04-20-2002 03:10 AM
visual basic programming mr0range Software & Software Development 1 11-07-2001 05:39 PM
Visual Basic HD44780 OCX, please? Christian Software & Software Development 4 05-15-2000 02:46 PM



All times are GMT -5. The time now is 09:22 AM.


Powered by vBulletin® Version 3.8.4
Copyright ©2000 - 2009, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO 3.3.2
Copyright © 1999 - 2008 Mp3Car.com Inc.Ad Management by RedTyger
Message Board Statistics