PDA

Click to See Complete Forum and Search --> : serial communication


lennart
Jan 8th, 2001, 06:29 AM
I want to create an activeX DLL.
The DLL does not have a form to put an MScomm control on. The DLL however still have to be able to communicate trough the serial port.
Is the best way to do this by using API? If so - where do I find information about these API's?

Best regard/Lennart

Orpheus
Jan 9th, 2001, 12:16 PM
A little trick that I recently discovered...

Create a form within your DLL and then whilst editing the form layout, select the MSComm controll and put it onto the control bar.

Now, within your class (in the DLL project), declare a member variable as type MSComm.

Within the Class Initialise (or wherever is appropriate),
Set m_MyCommControl = new MSComm

You may now reference m_MyCommControl and use it as if it were a control on a form.

At this point, you may also delete the form that you inserted into the project, VB will remember that the MSComm control needs to be included !

<now sit back with a smug expression before completing the project .............>

[Edited by Orpheus on 01-09-2001 at 01:21 PM]

lennart
Jan 10th, 2001, 01:41 AM
I also posted this question in the general section and got the suggestion to do like this:

'load the commcontrol without a form
dim C1 as Object
set C1 = CreateObject("MSCommLib.MSComm")

then I could use the C1 as an MSComm-control

Orpheus
Jan 13th, 2001, 07:30 AM
There is always more than one way to skin a cat.

Both of the options result in the same scenario; a MSComm control available as an object in your project.

I do not believe that either method is any better than the other, however, you may find that you have to manually add the MSCommLib to your distribution with the CreateObject method, whereas the method that I described should force the Packaging and Deployment wizard, along with the Windows Installer, to pick up the MSCommLib automatically.