Delphi Examples: DbiStartSession

<< Click to Display Table of Contents >>

Navigation:  »No topics above this level«

Delphi Examples: DbiStartSession

Return to chapter overview

Example 1: Start a new session for the client application.

Delphi programs can use the TSession object in the component library.

procedure fDbiStartSession(pName: string; var hSes: hDBISes; pNetDir: string);

begin

 Check(DbiStartSession(PChar(pName), hSes, PChar(pNetDir)));

end;

Example 2: Create a new session and return the session number.

Most Delphi users can use TSession.Open, TSessionList.OpenSession or the TSession component.

This example uses the following input:

 SesNo := fDbiStartSession('NewSession', hSes, 'C:\Netdir');

 

The function is:

function fDbiStartSession(pName: string; var hSes: hDBISes; pNetDir: string): Word;

var

 Ses: SESInfo;

begin

 Check(DbiStartSession(PChar(pName), hSes, PChar(pNetDir)));

 Check(DbiGetSesInfo(Ses));

 Result := Ses.iSession;

end;