Hi. I have a commercial dll which is invisible to VB.net, ie. I can't use it. I think I need to put it in a wrapper.
Are there some dlls that can't be wrapped? What do I need to know about the dll to determine whether it can be wrapped?
I'm OK in VB.net, but no knowledge of VC++, C# etc.
I've seen tutorials, but they refer to a dll which a) can be wrapped, and b) about which you know everything. I have some documentation as to calls etc., but nothing more.
Thank you.
More info: the dll is to do with waking up a battery-operated Bluetooth printer that has fallen asleep to conserve battery charge. The printer is 'connected' to a battery operated handheld Windows CE terminal, like parcel delivery drivers have. The dll is an Atinav product, and they have gone bust, I think. Allegedly.
Loading
VulpesPosted Dec 6, 2011, 11:57 AM
I'd place the dll in your application folder and the add this class to your project:
You should then be able to call the functions from some other class, like this:
Dim bOn As Boolean = Albtradio.BTRadioOn() ' if bOn is true it worked
Dim bOff As Boolean = Albtradio.BTRadioOff() ' if bOff is true it worked
Dim status As UInteger
Dim bStatus As Boolean = Albtradio.BTRadioStatus(status) ' if bStatus is true it worked
If status = 0 Then Console.WriteLine("Status is Power-down")
Sam HobbsPosted Dec 6, 2011, 2:39 PM
The fact that it does not work when you try to add a reference using the DLL does not prove that the DLL is a regular DLL. It is possible for a type library to exist in a separate file. Note that the terminology can be confusing; the terms that I think are more useful are "regular DLL" and "COM object". For example, note that Vulpes says "if the dll is written in C (as low level stuff often is) or it's a C++/VB6 COM dll" and "that looks like a C dll". I think he intends to mean that the DLL is a regular DLL, yet "VB6 COM dll" is not a regular DLL. A VB 6 DLL cannot be called using "Platform Invoke mechanism (DllImport attribute or the older Declare statement)." Vulpes is differentiating between a regular DLL and a COM DLL by calling them a C DLL and a C++ DLL respectively but it is possible to write a COM DLL using C and a regular DLL using C++.
To get an idea of what makes a COM object is, look at my Introduction to COM Automation. Note that in that I use the term COM Automation but that is essentially the same as COM Object. I admit that that article is not easy to understand, but I hope it at least gives an idea of the difference between a regular DLL and a DLL that can be used as a COM object.
Jonathan TrahairPosted Dec 6, 2011, 11:35 AM
A reference to 'C:\whatever.dll' could not be added. Please make sure that the file is accessible, and that it is a valid assembly or COM component.
I have this much documentation - see below.
Does this tell me if it's a C or COM dll?
Thank you for your reply.
//Document starts:
This document describes the APIs provided for Power –UP/Power-Down Built-in Bluetooth module of JettXL devices from Two tech.
Inorder to program Bluetooth using avelinkBT SDK, you must power-up the built-in module before calling any of the Bluetooth APIs.Similarly you must power-down the Bluetooth once the work is over.
1) BOOLEAN BTRadioOn()
This method is used to power-up the Built-in Bluetooth module in JettXL Devices.
Parameters : NIL
Returns : Boolean, TRUE if success ; FALSE if failure
2) BOOLEAN BTRadioOff()
This method is used to power-down the Built-in Bluetooth module in JettXL Devices.
Parameters : NIL
Returns : Boolean, TRUE if success ; FALSE if failure
3) BOOLEAN BTRadioStatus(DWORD *status);
This method is used to get the current power status of the Builtin Bluetooth module JettXL Devices.
Parameters :
Status : [in/out] Retreives the current power state. A value 0 indicates the power-down.
Returns : Boolean, TRUE if success ; FALSE if failure
Requirements
Header: include albtradio.h
Library: albtradio.lib
//Document ends.
VulpesPosted Dec 6, 2011, 10:56 AM