Timers and loops

User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Timers and loops

Post by Antonio Linares »

These posts from Przemek are advisable to be read before start using MT code:
http://www.matrixlist.com/pipermail/har ... 26773.html

Very important warning about how to deal with Windows messages:
http://www.matrixlist.com/pipermail/har ... 26781.html
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Timers and loops

Post 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= ... naries_win. Unfortunately the downloaded xHarbour zip too does not contain the said crtmt.lib

Regards
Anser
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Timers and loops

Post by anserkk »

Dear Mr.EMG,
crtmt.lib exists in the xHarbour CVS
Thank you. Now I have to start learning about using CVS :)

Anser
Patrizio
Posts: 90
Joined: Wed Nov 07, 2007 8:56 am
Location: Italy
Contact:

Re: Timers and loops

Post 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:
User avatar
Enrico Maria Giordano
Posts: 7355
Joined: Thu Oct 06, 2005 8:17 pm
Location: Roma - Italia
Contact:

Re: Timers and loops

Post 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
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Timers and loops

Post by anserkk »

Thank you both Mr.EMG and Mr.Patrizio

Regards
Anser
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Timers and loops

Post 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
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Timers and loops

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Timers and loops

Post 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 :-)
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
anserkk
Posts: 1280
Joined: Fri Jun 13, 2008 11:04 am
Location: Kochi, India

Re: Timers and loops

Post by anserkk »

Dear Mr.Antonio,

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

Code: Select all

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
erwinn
Posts: 2
Joined: Mon Mar 02, 2009 10:15 am

Re: Timers and loops

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Timers and loops

Post by Antonio Linares »

Erwin,

Are you creating and using the dialog from the same thread ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
erwinn
Posts: 2
Joined: Mon Mar 02, 2009 10:15 am

Re: Timers and loops

Post 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
User avatar
Antonio Linares
Site Admin
Posts: 37481
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain
Contact:

Re: Timers and loops

Post by Antonio Linares »

Erwin,

Have you loaded the richedit DLL ?

Code: Select all

   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
regards, saludos

Antonio Linares
www.fivetechsoft.com
Post Reply