Page 3 of 4

Re: Timers and loops

PostPosted: Tue Feb 09, 2010 5:51 pm
by Antonio Linares
These posts from Przemek are advisable to be read before start using MT code:
http://www.matrixlist.com/pipermail/harbour/2009-November/026773.html

Very important warning about how to deal with Windows messages:
http://www.matrixlist.com/pipermail/harbour/2009-November/026781.html

Re: Timers and loops

PostPosted: Wed Feb 10, 2010 4:54 am
by anserkk
Mr.Antonio,

Thank you for the information.

Mr.Patrizio,

I have ctmt.lib, but no crtmt.lib in my xHarbour libs folder (Supplied along with FWH 9.08). Linking ctmt.lib did not solve the problem. I tried to download xHarbour binaries for Borland C++ 5.5.1 from http://www.xharbour.org/index.asp?page=download/windows/binaries_win. Unfortunately the downloaded xHarbour zip too does not contain the said crtmt.lib

Regards
Anser

Re: Timers and loops

PostPosted: Wed Feb 10, 2010 7:51 am
by Enrico Maria Giordano
No crtmt.lib exists in the xHarbour CVS.

EMG

Re: Timers and loops

PostPosted: Wed Feb 10, 2010 8:06 am
by anserkk
Dear Mr.EMG,

crtmt.lib exists in the xHarbour CVS


Thank you. Now I have to start learning about using CVS :)

Anser

Re: Timers and loops

PostPosted: Wed Feb 10, 2010 8:14 am
by Patrizio
Anserkk, sorry i use xHarbour commercial.

Try to link vmmt.lib.

If you download Explorer Lib http://codigo-base.blogspot.com/search/ ... orer%20Lib you can see all the function provide by a lib and seek the lib to link for undefined function like this :wink:

Re: Timers and loops

PostPosted: Wed Feb 10, 2010 8:32 am
by Enrico Maria Giordano
anserkk wrote:Dear Mr.EMG,

crtmt.lib exists in the xHarbour CVS


Thank you. Now I have to start learning about using CVS :)

Anser


Please reread my message: "No crtmt.lib exists..."

EMG

Re: Timers and loops

PostPosted: Wed Feb 10, 2010 9:19 am
by anserkk
Thank you both Mr.EMG and Mr.Patrizio

Regards
Anser

Re: Timers and loops

PostPosted: Wed Feb 10, 2010 12:33 pm
by Antonio Linares
Anser,

To build it using xHarbour and Borland, these libraries are required:

From xharbour:
rtlmt.lib instead of rtl.lib
vmmt.lib instad of vm.lib

From Borland:
cw32mt.lib instead of cw32.lib

Anyhow, with xHarbour and Borland it crashes

Re: Timers and loops

PostPosted: Thu Feb 11, 2010 6:56 am
by anserkk
Dear Mr.Antonio,

Anyhow, with xHarbour and Borland it crashes

You are right.

What about with Harbour ?.

To do a MultiThread test using Harbour, In the BuildH.Bat, I replaced the lib HbVm with HbVmMt, but the replacement lib for HbRtl, HbRtlMt does not exist in my lib folder

Regards
Anser

Re: Timers and loops

PostPosted: Thu Feb 11, 2010 9:17 am
by Antonio Linares
Anser,

With Harbour it worked fine with these libraries (and a little change in the example source code):

From Harbour:
hbvmmt.lib instead of hbvm.lib
adding xhb.lib (to have xHarbour compatibility on threads)

From Borland:
cw32mt.lib instead of cw32.lib

And I modified this line this way:
oDlg:Say(n,0, Str( n ) ) // "Thread ID" + lTrim(Str(GetThreadID())) + " system id: " + lTrim(Str(GetSystemThreadID())))

It seems to work fine :-)

Re: Timers and loops

PostPosted: Thu Feb 11, 2010 9:54 am
by anserkk
Dear Mr.Antonio,

Thank you. You are right.
GetThreadID() is giving error but GetSystemThreadID() is working fine

Code: Select all  Expand view
oDlg:Say(n,0,"system id: " + lTrim(Str(GetSystemThreadID())))


So I understand that as of now, for Multi threads projects using xHarbour & Borland is not a good choice. :(

I would like to know whether any body here is using Multi thread technology in their existing apps using Harbour and Borland

Regards
Anser

Re: Timers and loops

PostPosted: Tue Feb 16, 2010 12:53 pm
by erwinn
Antonio Linares wrote:Patrizio,

Have you tried to use mt with FiveWin ? :-)

mt should work fine except for some GUI components (modal dialog boxes)



Hello.

I'm trying to get MT working with FiveWin for Xharbour.
When a try to avoid using modal dialogs, I probably need to enable dispatching events from the queue using SysWait otherwise the dialog/window just freezes. When I call Syswait in a secondary thread (in which the dialog was created), I see that the events are dipatches ok but I see a GPF now and then.

Probably this problem is related to the Windows messaging / MT discussions posted previously.
Is there another way to overcome this?

Regards,
Erwin

Re: Timers and loops

PostPosted: Tue Feb 16, 2010 1:14 pm
by Antonio Linares
Erwin,

Are you creating and using the dialog from the same thread ?

Re: Timers and loops

PostPosted: Wed Feb 17, 2010 7:48 am
by erwinn
Hello Antonio,

I develop an MDI application that checks for messages on the internet as a background thread. When a message is received, it is displayed in an MDI window.

When I try to display the richtech message in a dialog, I experience a Fivewin : Cannot create Dialog box error. This is why I create a new MDI window to show the RTF message. I have made a sketch to explain this. consider Thread 0 the main thread and thread 1 the first spawned thread. Thread 1.1 was spawned from thread 1.


Image

Currently thread 1 opens a modal dialog asking the user whether or not to show the message. Hereafter, the thread 1.1 is spawned.

Regards,
Erwin

Re: Timers and loops

PostPosted: Wed Feb 17, 2010 8:35 am
by Antonio Linares
Erwin,

Have you loaded the richedit DLL ?
Code: Select all  Expand view

   local hDLL := LoadLibrary( "Riched20.dll" )
 

In case you did, please try to load it in the same thread where you try to build the dialog