Premise Where to start: Minibroker and making a standalone .net program...

Motorola Premise

etc6849

Senior Member
I've never made a standalone application, let alone one that works with Premise. However, I'd like to attempt a simple one using .net and minibroker. Is there an example somewhere that demonstrates what to do? I could also use the Premise SDK if that's easier...? For this initial simple program, all I really want to do is grab certain emails using POP3 with SSL and the associated attachments (in this case I'm grabbing google voicemail notifications and the associated audio files).

I know how to do this in vbscript and it's easy. However, I'd like to make a standalone program that runs in its own thread to do this.

The reason is since SYS runs all of vbscrit like modules in a common thread, I'm experiencing a delay of a few seconds when a COM object is contacting the mail server and down loading the emails. I think this is going to happen by design since I'm not using a standalone program and all vbscripts in SYS run in a common thread.

Any pointers are appreciated. Assume I know nothing about using an SDK or even a compiler.
 
Where to begin? :D

If you don't already have full-blown visual studio, you should consider getting one of the "free" Visual Studio Express compilers from the Microsoft website. Since you've cracked VBSCRIPT, you may want to consider VB.NET. The syntax is very similar. Like C# and F#, VB.NET is a .NET language. All the real magic happens under the covers with the .NET runtime, so you should be able to do everything you want with VB.NET if it's simpler for you.

To use the Premise HSDK, you need to use C++ (not C# or any other .NET language). The HSDK is not trivial, but not impossible either. Personally, I prefer .NET, so I'm relegated to using minibroker (albeit unsuccessfully lately on 64 bit platforms.

The trick in working with Minibroker in a .NET environment is to make sure you first import a reference to it (right click references under the project you create in visual studio and click Add a reference...). Visual studio will create an .NET Interop layer automatically that exposes all of the minibroker classes. The second thing you need to do is make your assembly COM-visible (right click the project, select properties, select the Application Tab, click the Assembly Information button and then click the Make COM visible check box). If you don't, property change subscriptions won't work.

That should get your started from a development environment perspective. There is some sample minibroker code on the old premise forum. If you can't find it, let me know and I'll post it for you here. Using it is fairly straight foward. You create an instance of the minibroker class and make a connection to the server using the connect method. The connect method returns an IRemotePremiseObject class object that has all of the methods of a Premise class accessible under the Builder. From there, you can do anything. Accessing properties are a little different in that you need to explicitly use GetValue and SetValue methods.

You may run into an access violation if you use minibroker under VISTA or Windows 7 (32 bit). That's caused by the Data Execution Protection (DEP) feature introduced by Microsoft to prevent malware planting itself in a section of memory tagged as Data. For some reason, minibroker triggers DEP. You can disable it either system-wide or for the app you are developing. There are lots of articles on MSDN and other places on how to do that.

Good luck!!!!

If you figure out how to make property change subscriptions work on 64 bit Windows 7 or Windows 2008, let me know!!!

-John
 
This is all very useful information John thanks! I'll get started learning this week :) I think minibroker and .net is the place to start for me. I looked at a couple of HSDK examples and was lost as I don't know C++ at all.
 
So I've bought a used copy of visual studio 2005 professional and I'm working through a couple of examples on creating a windows application. This part seems very easy.

What's not easy is finding the vb.net example mentioned here (or equivalent):
http://forums.premisesystems.net/forums/6941/ShowPost.aspx

Anyone know if it was ever posted anywhere?

EDIT: this is the only example I could find and it uses C#: http://www.satter.org/2003/05/tutorial_minibr.html

However, it's still useful since it explains how to get started with using minibroker.
 
Back
Top