Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Mscomm32.ocx
Message
De
01/10/2007 01:49:50
 
 
À
21/09/2007 16:26:01
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
Divers
Thread ID:
01254049
Message ID:
01257665
Vues:
26
>Hi Gerard
>Make sure the mscomm32.ocx is copied into c:\windows\system32. In clients machine, I also copy this file in c:\windows\system32 and also in the folder where the program runs from.
>HTH. Shafid


Hi Shafid & Gerard

How's things in NZ?

Just wanted to point out a few "misconceptions" in this entire post.

MSCOMM32.OCX is a Microsoft Activex that is basically an easy way to program the COM ports, using methods and properties.

Before you can use MSCOMM32.OCX on any computer it must be registered in the registry. You can place it anywhere (one copy is enough and there is no need for multiple copies in any other folder) but the usual is in the windows\system32 directory. When you register it you must supply the full path to it so this is recorded in the registry.

to register:
c:\windows\system32\Regsvr32 c:\windows\system32\mscomm32.ocx
There is no need for any .REG file at all.

Once registered you can insert it into your form using the Activex Control(Ole Control) object and appears in the list as Microsoft Communications Control V6.0

If you are a sucker for punishment and use PRG classes and refuse to develop visually then you will need to instantiate it manually in code at runtime, set it's properties, call its methods and respond to events.

However since you cannot add code to a method at runtime, you are basically screwed, because most users use the OnComm event to read in data and you cannot add code at runtime into a method or event. You will have to resort to BindEvents which is not the way to go.

Easiest way is as follows:

1. Add MSCOMM32.OCX as described above to a form. Note down the ReadOnly property:
OleClass = MsCommLib.Mscomm.1(as this is what you will use to instantiate it in a prg - not actually needed)

2. Set up your PEM's
3. Select the object and choose from the File menu - Save As Class and save this as a class. It is this class you can now subclass in code or otherwise and just by using ADDOBJECT() or CREATEOBJECT()
4. Make sure your Base MsComm Class has code to handle the OnComm event. You can even put some generic code in there to call out to another function where you can now place your runtime code.

HTH.
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform