Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 6
Default Threading Problem

I have an excel program that is 'listening' for events on an external object.
It's defined as follows:

Public WithEvents OrderQuery As CacheControl

I also have a procedure that is being called by windows every few seconds.
This is being accomplished via the Windows SetTimer function.

Now, the problem. The OrderQuery object gets events from an external
application. In the event procedure I update some state vars and return.
Then, in the timer callback I react to those events. There is a reason I'm
not doing it in the event itself, trust me on that part. The callback then
makes calls to the application in order to react to the messages it is
processing. This is where the problem comes in. When those messages are
sent the application is sending messages back (via the event procedure) in
response (as well as other ongoing messages). It appears that these two
procedures are interrupting each other and that is causing issues related to
program and variable state.

In C++ I'd use a CriticalSection to lock up the context while I was in those
two areas. I can't seem to find such a thing in VBA.

Notes:
I didn't write the external app and have no control over its design.
I'd really rather not write an ActiveX object (or any other type of external
object) to deal with this.

Any and all help would be greatly appreciated.

Thanks,

Mike

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Excel Multi-threading Randy L[_2_] Excel Discussion (Misc queries) 2 February 16th 07 07:13 PM
Excel and Hyper-Threading Processors David Benson Excel Discussion (Misc queries) 3 March 24th 05 06:11 AM
ExcelTip/ExcelForum threading keepITcool Excel Programming 9 October 29th 04 04:40 PM
Hyper-Threading Technology for XP with Excel 2000 Eric[_15_] Excel Programming 1 November 7th 03 11:34 AM
vba multi threading Steve[_42_] Excel Programming 1 October 29th 03 11:11 AM


All times are GMT +1. The time now is 03:53 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"