From: Mr. X. on
OK.
Solved.

For Token :
I wrote a class : clsTokenMgr, that includes CreateToken & CheckToken
functions.

For the timer :
each time, I use the clsTokenMgr function, I do :

....
TokenMgr = new clsTokenMgr()
....
SynLock TokenMgr
TokenMgr.createToken ...
or
TokenMgr.CheckToken
End SynLock

I see, when I run other exe-file , even I don't call some of TokenMgr
methods in the called exe, When there is a SynLock TokenMgr in the main
calling exe, computer waits, anyway.
Since when there is waiting - I am on a thread (timer), it doesn't bother
(this is the only situation, when there may be an infinitive wait).

Thanks :)

From: Patrice on
Great it is solved but I would suggest to always explain what is the non
technical overall goal. It helps to raise better suggestion including doing
this in other and possibly simplest ways..

--
Patrice

From: Mr. X. on
O.K.

Let's start over.
I am developing Mini-ERP system, but a very smart one. Fits for lot of
industries, with minimal tables and code. Has multilingual support, and a
very modular system.
I made the whole design and tables, programmed some code, and also checked
out the market needs.
If you live on Israel, you see the first burst out of the system.

There is a lot of "but" ... and the most difficult thing to do is obviously
the marketing, and to sell my first product.
Also, that I somehow ask silly question, in order to get good answers, and
this helps me a lot.
Don't get confused for the massive silly question I asked. I have lot of
years experiment, using many technologies, but due some personal issues, for
years - I get stuck ...
I hope my question will be reduced soon. There is a light for the hours I
spend for the system, and many intelligence behind code.

Anyway - Thanks :)


From: Patrice on
I meant more specifically that what you told us is that you needed to check
and recreate a "string token". It seems to be checked every second (?!) and
recreated every 20 minutes but we have no idea about the usage of this
string token.

Knowing what is the purpose of this string token could perhaps allow someone
to give suggestion about achieving the same goal another way. I've seen this
several times (i.e the question is about a particular technical issue but
later when knowing the overall goal one come and says "hey you could do that
this better way instead !").

--
Patrice

From: Mr. X. on
OK.
There is a system (main program - which has a menu).
The main program run (by choosing the menu) another exec program.
When I close the called program, I return to main program.

Each program I called is an exe.
I don't want that the exe program will be run as stand-alone, but only by
the main program.

So, the main program calculates a token string, and send it as a parameter
to the called program.
The called program has this token string, and when first enter the called
program, I check the validity of the token string.
If everything is OK, so I can go on.

There is a choice, that the called program is not closed for hours, and I
don't want that the token string will stayed (when it is calculated, it is
stored on database for the specific user),
so I renew it for about 20 minutes.

For the one second checking - It's not the issue.
I just want a solution, that if I use a timer, there won't be any
thread-problems, so one solution, as far as I know (and not good enough),
is to make one timer, that acts as a dispatcher (all the related commands
are triggered by the timer) - That's the reason for one second,
because checking if token is OK, should return answer immediately, and one
second is negligible for waiting.

Thanks :)