DoEvents

forum.centura.team.developer (1998-2005) & forum.sqlwindows (2000-2005)
Ravi

DoEvents

Post by Ravi » 01 Feb 2005, 14:46

 Posted by:  Ravi 

Hi NG,

Is there a DoEvents(in VB) equivalent in Centura/Gupta?

Regards,
Ravi

RainerE
Germany
Posts: 2223
Joined: 27 Apr 2021, 12:40
Location: Germany

Re: DoEvents

Post by RainerE » 01 Feb 2005, 15:48

 Posted by:  Rainer Ebert 

Depends on what you want to to.

You can use SalUpdateWindow() or SalInvalidateWindow() to redraw a window.

You can use the SalYield*() functions to enable application/object yielding.

You can use SalPause( nMilliseconds ) or better the Windows api function
Sleep( nMilliseconds ). This halts the application for one or more
milliseconds and in this time other messages will be processed. SalPause has
bugs which will lead to an unexpected behaviour in some cases, so I
recommend to use Sleep() instead.

In a case where I needed DoEvents() to give NTSVX.OCX the chance to
communicate with the Windows service control manager, I did the following:
1) I enabled application yielding SalYieldEnable()
2) I enabled message yielding for the ocx SalYieldStartMessages().
3) In my loop I called Sleep(1) every 0,5 seconds.

Rainer

P.S.: You have to declare Sleep as external function in Kernel32.dll as
follows:
Function: Sleep
Description: The Sleep function suspends the execution of the current
thread for the specified interval (milliseconds).
Export Ordinal: 0
Returns
Parameters
Number: DWORD

Ravi

Re: DoEvents

Post by Ravi » 02 Feb 2005, 01:34

 Posted by:  Ravi 

I'm trying to get data from an external device using mscomm32.ocx but there
are situations when the data being returned is incomplete. This is where I
thought I would require a command equivalent to DoEvents. I'm not sure if I
could do the same that you do for NTSCX.OCX. Thanks Rainer, for your
response.

Best Regards,
Ravi

Krister Henningsson

Re: DoEvents

Post by Krister Henningsson » 02 Feb 2005, 14:53

 Posted by:  Krister Henningsson 

Hello Ravi,

Back in the 90s I did a interface to a telephone switchboard using VB6
mscomm.ocx.

I got all garbage and no sence out of it untill I had set the mscomm to the
speed
the exchange could muster. Slow it down and see if it becomes more stable.

Regards, Kriss

Ravi

Re: DoEvents

Post by Ravi » 02 Feb 2005, 19:07

 Posted by:  Ravi 

Hi Kriss,

In my case, I'm not getting garbage but incomplete data ( if it is supposed
to return Date/Time and Values, it returns date/Time only or the other way
around).

"...untill I had set the mscomm to the speed the exchange could muster.
Slow it down and see if it becomes more stable." - How am I supposed to do
that?

Best Regards,
Ravi

Jim McNamara

Re: DoEvents

Post by Jim McNamara » 02 Feb 2005, 22:04

 Posted by:  Jim McNamara 

Set the Baud rate. If you don't have Visual Studio, you can find docs for
the ocx at:

http://msdn.microsoft.com/

Ravi

Re: DoEvents

Post by Ravi » 03 Feb 2005, 00:23

 Posted by:  Ravi 

I'm setting the Baud rate (and other properties) as told in the
manufacturer's document. Inspite of that the data I receive is incomplete.

Krister Henningsson

Re: DoEvents

Post by Krister Henningsson » 03 Feb 2005, 08:41

 Posted by:  Krister Henningsson 

tnx Jim :-)

Ravi,
How do you receive and present the data?
check if the number of bytes you are suposed to receive,
reach your app at all

"kriss 2005" -->source_pc cable target_pc mscomm gupta --> " 2005"
OR
"kriss 2005" -->source_pc cable target_pc mscomm gupta -->"2005"
makes a different...
regards, Kriiss

Jim McNamara

Re: DoEvents

Post by Jim McNamara » 03 Feb 2005, 16:43

 Posted by:  Jim McNamara 

If there is a null character in the string, TD (and C) pick that up as the
end of the string. You will need to attach the cstruct.apl,
SalStrSetBufferLength(...) and read the string form the port a byte at a
time.

Ravi

Re: DoEvents

Post by Ravi » 04 Feb 2005, 00:49

 Posted by:  Ravi 

The external device needed a little bit time to respond and I was able to
work-around that and got this to work properly. Thankyou all for your help!
Regards,
Ravi

Return to “forum.sqlwindows”

Who is online

Users browsing this forum: No registered users and 0 guests