Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
MSCOMM class added to project - create class from it in prg?
Message
De
14/01/2002 11:07:36
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Titre:
MSCOMM class added to project - create class from it in prg?
Divers
Thread ID:
00604353
Message ID:
00604353
Vues:
91
This may be a silly question, but I have never tried to do this so here goes. I haved added an mscommcontainer under mscommclass to my project so I could easily add properties and methods to it.

I have a prg in my program and I want to define/create/call this mscomm control that I added to my project under classes programmatically. I define the form and then the mscomm control, however I create a different mscomm control entirely. How do I either add my class that I added to my project to form, or create a subclass of it programmatically and add it to my form? This is all done in a prg and will be programmatic.

I can send/receive data via this code, (below it actually does play the msg stored in my phonetree system) but I cannot access the properties I added to the class in my project visually. How do I ensure that when I create this class it is created from the class I added to my project (just as though I had dropped the mscomm onto the form)? It has to be in the ADDOBJECT line, correct? Is there anyway to add an object from a class visually added in the project under classes, but not defined in code in the prg?

TIA!

Here is my code so far:
PUBLIC ComForm
ComForm = CREATEOBJECT('Form')
ComForm.AddObject("MsCom","MSCOMMCLASS")
DO PlayMsg
RETURN

DEFINE CLASS MsCommClass AS OLEControl
	OLECLASS = [MSCOMMLib.MSComm.1]
ENDDEFINE

PROCEDURE PlayMsg
	WITH ComForm.MsCom
		.RThreshold = 1
		.SThreshold = 1
		.Settings = [9600,n,8,1]
		.RTSEnable = .F.
		.InputLen = 0
	ENDWITH
	m_port=1
	ComForm.MsCom.CommPort = m_port
	ComForm.MsCom.PortOpen = .T.
	ComForm.MsCom.Output = "~PLAY " + chr(13)
	ComForm.MsCom.Output = "M " + chr(13)
	ComForm.MsCom.PortOpen = .F.
RETURN
.·*´¨)
.·`TCH
(..·*

010000110101001101101000011000010111001001110000010011110111001001000010011101010111001101110100
"When the debate is lost, slander becomes the tool of the loser." - Socrates
Vita contingit, Vive cum eo. (Life Happens, Live With it.)
"Life is not measured by the number of breaths we take, but by the moments that take our breath away." -- author unknown
"De omnibus dubitandum"
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform