From: Patrice on
> 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 why to built them as EXE files ? By using DLLs you could likely better
tied them to your main application (not sure what is the problem of runnig
them directly if the main app is nothing more than a kind of "menu" which is
for now my understanding)...

> 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.

With a DLL scenario you could perhaps check the identity of the caller
perhaps based on a strong name. Additionaly it allows to check that nothing
was changed i.e. someone tried to decompile/recompile your code even though
I assume your code is obsfucated.

> 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),

Storing it in a db seems a weak point.

>
> 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.

Not sure about the overall architecture but my very first thought when
seeing your post is that you could check this sometimes (i.e when a
frequently used function is called and keep the last date/time it was
generated to renew it when enough time elapsed, this way you don't need any
timer).

Unfamiliar with this, but it looks also quite similar to a licensing scheme
(http://msdn.microsoft.com/en-us/library/fe8b1eh9.aspx).

--
Patrice

From: Mr. X. on
O.K.
I will check that out.
Maybe I shall adopt some of your advices (especially use dlls)

Thanks :)