Thanks all for the help and the education on hex ORing. I have now got the wait function working fine.

In the code you just have to put Call MsgWait(200) and it will wait 200 millisecond, while I believe processing any current processes going, and it works on XP (which sleep doesn't- at least that is what I am led to believe).

Not sure if it helped the problem in the end, but after more work, I am more convinced the issues with XP are related to doing a rapid number of selections and fetching on small files.

If any one is interested, I wrote a function to return the cutter object given a line and a polygon. The current function that MapBasic provides puts the line into the same table and then it puts the cutter in there as well, which means that you then have to clean it out later. Having a function that returns an cutter object variable means you can do the split processing in object variables, thereby reducing the amount of selections. This seems to have made a difference to the number of crashes, but am not confident yet that the problem is resolved. It is still in testing, but if anyone is interested, I would be happy to share.

Anyway the code for the wait function (may be of use for printing problems?) is:


'DEFINES for the Wait function DEFINE QS_KEY 1 DEFINE QS_MOUSEMOVE 2 DEFINE QS_MOUSEBUTTON 4 DEFINE QS_POSTMESSAGE 8 DEFINE QS_TIMER 16 DEFINE QS_PAINT 32 DEFINE QS_SENDMESSAGE 64 DEFINE QS_HOTKEY 128 DEFINE QS_MOUSE 6 DEFINE QS_INPUT 7 DEFINE QS_ALLEVENTS 191 DEFINE QS_ALLINPUT 255


Declare Function GetTickCount Lib "kernel32" () As Integer
Declare Function MsgWaitForMultipleObjects Lib "user32" (ByVal nCount As Integer, pHandles As Integer, ByVal fWaitAll As Integer, ByVal dwMilliseconds As Integer, ByVal dwWakeMask As Integer) As Integer


Declare Sub MsgWait(ByVal ms As Integer)


Sub MsgWait(ByVal ms As Integer) '----------------------- 'Written By: RC '-----------------------

Dim start As Integer
Dim timeRemaining As Integer
Dim timeNow As Integer
Dim Handles As Integer

'Set up general error handler
ONERROR GOTO ErrorHandler

Print "Waiting " + ms + " milliseconds."

start = GetTickCount()
timeRemaining = ms
Do
If MsgWaitForMultipleObjects(0, Handles, 0, timeRemaining, QS_ALLINPUT) > 0 Then
End If
timeNow = GetTickCount()
If timeNow - start >= timeRemaining Then
Exit Sub
ElseIf timeNow < start Then
' Handle GetTickCount 49.7 day wrap around
start = timeNow
End If
timeRemaining = timeRemaining - (timeNow - start)
start = timeNow
'DoEvents
Loop
EXIT SUB
ErrorHandler:
CALL ErrorMessage("MsgWait")
END SUB 'ProForma


r
--

Robert Crossley
Agtrix P/L
9 Short St
PO Box 63
New Brighton 2483
Far Southern Queensland
AUSTRALIA

153.549004 E 28.517344 S

P: 02 6680 1309
F: New Connection
M: 0419 718 642
E: [EMAIL PROTECTED]
W: www.agtrix.com
W: www.wotzhere.com

---------------------------------------------------------------------
List hosting provided by Directions Magazine | www.directionsmag.com |
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
Message number: 11779



Reply via email to