----boundary-LibPST-iamunique-1709599923_-_-
Content-type: text/plain
Hi Andrew,
Common techniques for minimising problems when processing long-running
commands in Win32 applications include:
1. Periodically inspect the message queue and process any pending messages.
2. Run the long-running command in a separate thread to the main
application.
I have an idea that what you have been doing when using Services.Action may
well be BlackBox's equivalent of running separate threads.
To inspect the message queue and process any pending messages try calling
the following function at a convenient point in your processing loop (every
100 - 500 milliseconds perhaps?)
PROCEDURE ProcessMessages;
VAR msg: Win.MSG; res: INTEGER;
BEGIN
WHILE Win.PeekMessage(msg, 0, 0, 0, Win.PM_REMOVE) # 0 DO
res := Win.TranslateMessage(msg);
res := Win.DispatchMessageA(msg)
END
END ProcessMessages;
I'm no expert in this sort of low-level WinAPI processing, so if anybody
wants to jump in with any refinements to this technique I'm all ears!
Chris Burrows
CFB Software
http://www.cfbsoftware.com/gpcp
> -----Original Message-----
> From: blackbox{([at]})nowhere.xy> Behalf Of A Thomas
> Sent: Tuesday, 16 January 2007 6:23 PM
> To: BlackBox Mailing List
> Subject: [BlackBox] - Ctrl+Break patch
>
> Hei Alexander,
>
> I am finding what you say about long running commands
> very interesting. They are something which causes me lots of
> problems. I find it best if possible to break them up into
> short running commands attached to a Services.action. But
> this is not always feasible.
>
> You have explained the "...is not responding" that I kept
> seeing. Thanks.
> One disaster that I keep finding with a long running command
> is if I say go into my email and then back to BB BB will not
> continue to rum the command it will be in a zombie state.
> This is more than a little difficult. I can just not use
> email etc in these situations but the same thing happens with
> screen savers etc. Have you seen this behavior?
>
> Moi
>
> Andrew
>
--- BlackBox
--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy
----boundary-LibPST-iamunique-1709599923_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"
e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBO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