152 Remember that the WinExec API uses a PAnsiChar parameter and has no wide version, as module names in Windows are not Unicode enabled, like function names exposed by DLLs and referenced by the GetProcAddress API.

When calling ToString for one of the secondary forms, this returns the status of the connected server object, calling its public ToString method:

function TFormDsmcClient.ToString: string; begi n

InitStorageServer; Result := StorageServer.ToString; end;

As a first execution example, I've created the server with the default Session life cycle, opened two client forms, set the values to 3 and 4, and asked for the overall status, with this result: Session l: Value: 3 - Object: lC38400 2: Value: 4 - Object: lC384E0

In a second execution, I've gone for the the Invocation life cycle, and asking for the overall status twice I saw the following output: Invocation l: Value: 0 - Object: lDl85B0 2: Value: 0 - Object: 1d18490 l: Value: 0 - Object: 1D185C0 2: Value: 0 - Object: 1D185D0

Notice that you are getting a new object for each execution, and the objects status is always zero (an any setting will immediately be lost when the object is destroyed immediately after each invocation). Needless to say, this makes sense only for stateless operations.

Finally, I've repeated the same steps (setting values to 3 and 4) with the Server life cycle setting, and this time every client form uses the same server object, with the last value set: Server

1: Value: 4 - Object: 1E08490 2: Value: 4 - Object: 1E08490

In other words, the practice shows... that the theory is correct! While exploring life cycle configuration in the demo, we've also looked at an example of a client starting the (local) server it needs and of a client with multiple concurrent connections to the server.

Was this article helpful?

0 0
Project Management Made Easy

Project Management Made Easy

What you need to know about… Project Management Made Easy! Project management consists of more than just a large building project and can encompass small projects as well. No matter what the size of your project, you need to have some sort of project management. How you manage your project has everything to do with its outcome.

Get My Free Ebook

Post a comment