im having a really strange problem.
im using a c++ dll to hook into an extern application. there i do subclass 2 labels.
with every WM_SETTEXT posted to one of the labels, an event in my app is raised and i retrieve the current text. so far it works prefectly, no problems.
the problem ocurres when i try to let my application do a break.
when the event is raised i know that the label's content is refreshed. but depending with the label, some other details on the extern form application get changed.
but these changes (animations) happen a little bit later, than my receive_event is raised.
for using my event as a signal to take a snapshot of the extern form i need to pause my application for some miliseconds (i guess). because while my code is waiting the extern program updates their form. when the update is done, its the right moment for me to take the snapshot.
these are my simple thoughts to make it work... but it doesnt seem that easy.
i tried Threading.Thread.Sleep and
Private Sub Delay(ByVal dblSecs As Double) Const OneSec As Double = 1.0# / (1440.0# * 60.0#) Dim dblWaitTil As Date Now.AddSeconds(OneSec) dblWaitTil = Now.AddSeconds(OneSec).AddSeconds(dblSecs) Do Until Now > dblWaitTil Application.DoEvents() ' Allow windows messages to be processed Loop End Sub
and even others. what happens is always the same:
while im delaying my application (when the receive_event is just raised) the extern form is frozen... as long as my app is in the delay. exactly when my app leaves the delay function, the extern form starts working again too, and all changes are done at once.
so the only thing i achieved is having a break in both, the extern app and mine. thats useless to me!
it seems like everything i do with the thread or process (idk, im not really concerned about hooks) is done with the hooked application too. although i just subclassed 2 labels of it.
maybe it is a common mistake im making, or im just not seeing something!
i didnt provide much code because i dont know what exactly u'd like to see. but i give u all u'd like to see immediatly. the class i use to hook is attached.
i hope anyone can tell me what to do, or at least point me in the right direction.
Number of downloads: 270