who dares to give the solution [message #86182] |
Tue, 07 September 2004 06:58 |
fanni
Messages: 96 Registered: March 2004
|
Member |
|
|
hi every body
i am using mscomm component for reading data from COM PORT connected with a weigh scale.
i have got placed the MSCOMM ocx in my form (of FORMS 6) and have imported its packages
containing all its methods and events.
i got all it functions and procedures but i found only this piece of code under events
package .
--------------------------------------
PACKAGE BODY MSCOMMLib_MSComm_1_EVENTS IS
-- The Events Package:
PROCEDURE /* OnComm */ EVENT1(interface OleObj) IS
BEGIN
null;
END;
END;
---------------------------------------
whereas i imported the events package for MSCAL.calendar. Its events package shows a
detailed list of events.
How i'll capture different events for mscomm component e.g port open, port close, input ,
output etc.
Moreover i am unable to understand that how ON-DISPATCH-TRIGGER trigger will be used for
MSCOMM.
If any body has idea about it. Please give me a hint.
I need it on urgent basis.
farhan ashraf
|
|
|
Re: who dares to give the solution [message #86184 is a reply to message #86182] |
Tue, 07 September 2004 22:08 |
Himanshu
Messages: 457 Registered: December 2001
|
Senior Member |
|
|
Hi,
Try this code:
1. Open form
2. Import "MSCOMMLib.MSComm" interface. ( "Program"/"Import OLE Library interface". In OLE importer selected: OLE Classes "MSCOMMLib.MSComm" Method package "IMSComm" )
3. Write the following code:
-- -----------
DECLARE
ovS OleVar;
s varchar2(100);
BEGIN
:item('block3.comport').OCX.MSCOMMLIB.MSCOMM.COMMPORT := 1;
:item('block3.comport').OCX.MSCOMMLIB.MSCOMM.Settings := '9600,N,8,1';
:item('block3.comport').OCX.MSCOMMLIB.MSCOMM.PortOpen := 1;
-- :item('block3.comport').OCX.MSCOMMLIB.MSCOMM.OUTPUT := 'TEST';
s:='ATDP;'||chr(13); -- command for modem
MSCOMMLib_IMSComm.OUTPUT( :item('block3.comport').interface, TO_VARIANT(s) );
:item('block3.comport').OCX.MSCOMMLIB.MSCOMM.InputMode := MSCOMMLIB_CONSTANTS.comInputModeText ;
s:=null;
WHILE s is null LOOP
ovS:=MSCOMMLib_IMSComm.INPUT( :item('block3.comport').interface );
s:=VAR_TO_CHAR( ovS );
END LOOP;
Message( s );
END;
HTH
Regards
Himanshu
|
|
|
Re: who dares to give the solution [message #311933 is a reply to message #86182] |
Mon, 07 April 2008 07:54 |
owais_baba
Messages: 289 Registered: March 2008 Location: MUSCAT
|
Senior Member |
|
|
hi dear i treid your sample code mscomm pls can u explain me
i wrote this code on when button pressed -trigger
when i run this form and clicked on button error message was there "ole not defined for comport" and one more thing pls clear that things i would be very thankful to u. this sample code which u have pasted in a forum how its works wheither its bringing data in a text file or anyother procedure kindly explain these things because i want to read data from serail either in a oracle table or in a text file pls help me to do that
thanks
owaisuzair2007@yahoo.com
|
|
|
|
|
|
|