// *********************************************************************//
// The Class CoCMLangConvertCharset provides a Create and CreateRemote method to
// create instances of the default interface IMLangConvertCharset exposed by
// the CoClass CMLangConvertCharset. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoCMLangConvertCharset = class
class function Create: IMLangConvertCharset;
class function CreateRemote(const MachineName: string): IMLangConvertCharset;
end;
// *********************************************************************//
// OLE Server Proxy class declaration
// Server Object : TCMLangConvertCharset
// Help String :
// Default Interface: IMLangConvertCharset
// Def. Intf. DISP? : No
// Event Interface:
// TypeFlags : (2) CanCreate
// *********************************************************************//
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
TCMLangConvertCharsetProperties= class;
{$ENDIF}
TCMLangConvertCharset = class(TOleServer)
private
FIntf: IMLangConvertCharset;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
FProps: TCMLangConvertCharsetProperties;
function GetServerProperties: TCMLangConvertCharsetProperties;
{$ENDIF}
function GetDefaultInterface: IMLangConvertCharset;
protected
procedure InitServerData; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Connect; override;
procedure ConnectTo(svrIntf: IMLangConvertCharset);
procedure Disconnect; override;
function Initialize(uiSrcCodePage: SYSUINT; uiDstCodePage: SYSUINT; dwProperty: LongWord): HResult;
function GetSourceCodePage(out puiSrcCodePage: SYSUINT): HResult;
function GetDestinationCodePage(out puiDstCodePage: SYSUINT): HResult;
function GetProperty(out pdwProperty: LongWord): HResult;
function DoConversion(var pSrcStr: Byte; var pcSrcSize: SYSUINT; var pDstStr: Byte;
var pcDstSize: SYSUINT): HResult;
function DoConversionToUnicode(var pSrcStr: Shortint; var pcSrcSize: SYSUINT;
var pDstStr: Word; var pcDstSize: SYSUINT): HResult;
function DoConversionFromUnicode(var pSrcStr: Word; var pcSrcSize: SYSUINT;
var pDstStr: Shortint; var pcDstSize: SYSUINT): HResult;
property DefaultInterface: IMLangConvertCharset read GetDefaultInterface;
published
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
property Server: TCMLangConvertCharsetProperties read GetServerProperties;
{$ENDIF}
end;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
// *********************************************************************//
// OLE Server Properties Proxy Class
// Server Object : TCMLangConvertCharset
// (This object is used by the IDE's Property Inspector to allow editing
// of the properties of this server)
// *********************************************************************//
TCMLangConvertCharsetProperties = class(TPersistent)
private
FServer: TCMLangConvertCharset;
function GetDefaultInterface: IMLangConvertCharset;
constructor Create(AServer: TCMLangConvertCharset);
protected
public
property DefaultInterface: IMLangConvertCharset read GetDefaultInterface;
published
end;
{$ENDIF}
// *********************************************************************//
// The Class CoCMultiLanguage provides a Create and CreateRemote method to
// create instances of the default interface IMultiLanguage exposed by
// the CoClass CMultiLanguage. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoCMultiLanguage = class
class function Create: IMultiLanguage;
class function CreateRemote(const MachineName: string): IMultiLanguage;
end;
// *********************************************************************//
// OLE Server Proxy class declaration
// Server Object : TCMultiLanguage
// Help String :
// Default Interface: IMultiLanguage
// Def. Intf. DISP? : No
// Event Interface:
// TypeFlags : (2) CanCreate
// *********************************************************************//
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
TCMultiLanguageProperties= class;
{$ENDIF}
TCMultiLanguage = class(TOleServer)
private
FIntf: IMultiLanguage;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
FProps: TCMultiLanguageProperties;
function GetServerProperties: TCMultiLanguageProperties;
{$ENDIF}
function GetDefaultInterface: IMultiLanguage;
protected
procedure InitServerData; override;
public
constructor Create(AOwner: TComponent); override;
destructor Destroy; override;
procedure Connect; override;
procedure ConnectTo(svrIntf: IMultiLanguage);
procedure Disconnect; override;
function GetNumberOfCodePageInfo(out pcCodePage: SYSUINT): HResult;
function GetCodePageInfo(uiCodePage: SYSUINT; out pCodePageInfo: tagMIMECPINFO): HResult;
function GetFamilyCodePage(uiCodePage: SYSUINT; out puiFamilyCodePage: SYSUINT): HResult;
function EnumCodePages(grfFlags: LongWord; out ppEnumCodePage: IEnumCodePage): HResult;
function GetCharsetInfo(const Charset: WideString; out pCharsetInfo: tagMIMECSETINFO): HResult;
function IsConvertible(dwSrcEncoding: LongWord; dwDstEncoding: LongWord): HResult;
function ConvertString(var pdwMode: LongWord; dwSrcEncoding: LongWord; dwDstEncoding: LongWord;
var pSrcStr: Byte; var pcSrcSize: SYSUINT; var pDstStr: Byte;
var pcDstSize: SYSUINT): HResult;
function ConvertStringToUnicode(var pdwMode: LongWord; dwEncoding: LongWord;
var pSrcStr: Shortint; var pcSrcSize: SYSUINT;
var pDstStr: Word; var pcDstSize: SYSUINT): HResult;
function ConvertStringFromUnicode(var pdwMode: LongWord; dwEncoding: LongWord;
var pSrcStr: Word; var pcSrcSize: SYSUINT;
var pDstStr: Shortint; var pcDstSize: SYSUINT): HResult;
function ConvertStringReset: HResult;
function GetRfc1766FromLcid(locale: LongWord; out pbstrRfc1766: WideString): HResult;
function GetLcidFromRfc1766(out plocale: LongWord; const bstrRfc1766: WideString): HResult;
function EnumRfc1766(out ppEnumRfc1766: IEnumRfc1766): HResult;
function GetRfc1766Info(locale: LongWord; out pRfc1766Info: tagRFC1766INFO): HResult;
function CreateConvertCharset(uiSrcCodePage: SYSUINT; uiDstCodePage: SYSUINT;
dwProperty: LongWord;
out ppMLangConvertCharset: IMLangConvertCharset): HResult;
property DefaultInterface: IMultiLanguage read GetDefaultInterface;
published
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
property Server: TCMultiLanguageProperties read GetServerProperties;
{$ENDIF}
end;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
// *********************************************************************//
// OLE Server Properties Proxy Class
// Server Object : TCMultiLanguage
// (This object is used by the IDE's Property Inspector to allow editing
// of the properties of this server)
// *********************************************************************//
TCMultiLanguageProperties = class(TPersistent)
private
FServer: TCMultiLanguage;
function GetDefaultInterface: IMultiLanguage;
constructor Create(AServer: TCMultiLanguage);
protected
public
property DefaultInterface: IMultiLanguage read GetDefaultInterface;
published
end;
{$ENDIF}
procedure Register;
resourcestring
dtlServerPage = 'ActiveX';
implementation
uses ComObj;
class function CoCMLangString.Create: IMLangString;
begin
Result := CreateComObject(CLASS_CMLangString) as IMLangString;
end;
class function CoCMLangString.CreateRemote(const MachineName: string): IMLangString;
begin
Result := CreateRemoteComObject(MachineName, CLASS_CMLangString) as IMLangString;
end;
procedure TCMLangString.InitServerData;
const
CServerData: TServerData = (
ClassID: '{C04D65CF-B70D-11D0-B188-00AA0038C969}';
IntfIID: '{C04D65CE-B70D-11D0-B188-00AA0038C969}';
EventIID: '';
LicenseKey: nil;
Version: 500);
begin
ServerData := @CServerData;
end;
procedure TCMLangString.Connect;
var
punk: IUnknown;
begin
if FIntf = nil then
begin
punk := GetServer;
Fintf:= punk as IMLangString;
end;
end;
procedure TCMLangString.ConnectTo(svrIntf: IMLangString);
begin
Disconnect;
FIntf := svrIntf;
end;
procedure TCMLangString.DisConnect;
begin
if Fintf <> nil then
begin
FIntf := nil;
end;
end;
function TCMLangString.GetDefaultInterface: IMLangString;
begin
if FIntf = nil then
Connect;
Assert(FIntf <> nil, 'DefaultInterface is NULL. Component is not connected to Server. You must call ''Connect'' or ''ConnectTo'' before this operation');
Result := FIntf;
end;
constructor TCMLangString.Create(AOwner: TComponent);
begin
inherited Create(AOwner);
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
FProps := TCMLangStringProperties.Create(Self);
{$ENDIF}
end;
destructor TCMLangString.Destroy;
begin
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
FProps.Free;
{$ENDIF}
inherited Destroy;
end;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
function TCMLangString.GetServerProperties: TCMLangStringProperties;
begin
Result := FProps;
end;
{$ENDIF}
function TCMLangString.Sync(fNoAccess: Integer): HResult;
begin
Result := DefaultInterface.Sync(fNoAccess);
end;
function TCMLangString.GetLength(out plLen: Integer): HResult;
begin
Result := DefaultInterface.GetLength(plLen);
end;
function TCMLangString.SetMLStr(lDestPos: Integer; lDestLen: Integer; const pSrcMLStr: IUnknown;
lSrcPos: Integer; lSrcLen: Integer): HResult;
begin
Result := DefaultInterface.SetMLStr(lDestPos, lDestLen, pSrcMLStr, lSrcPos, lSrcLen);
end;
function TCMLangString.GetMLStr(lSrcPos: Integer; lSrcLen: Integer; const pUnkOuter: IUnknown;
dwClsContext: LongWord; var piid: TGUID; out ppDestMLStr: IUnknown;
out plDestPos: Integer; out plDestLen: Integer): HResult;
begin
Result := DefaultInterface.GetMLStr(lSrcPos, lSrcLen, pUnkOuter, dwClsContext, piid, ppDestMLStr,
plDestPos, plDestLen);
end;
{$IFDEF LIVE_SERVER_AT_DESIGN_TIME}
constructor TCMLangStringProperties.Create(AServer: TCMLangString);
begin
inherited Create;
FServer := AServer;
end;
function TCMLangStringProperties.GetDefaultInterface: IMLangString;
begin
Result := FServer.DefaultInterface;
end;
{$ENDIF}
class function CoCMLangConvertCharset.Create: IMLangConvertCharset;
begin
Result := CreateComObject(CLASS_CMLangConvertCharset) as IMLangConvertCharset;
end;
class function CoCMLangConvertCharset.CreateRemote(const MachineName: string): IMLangConvertCharset;
begin
Result := CreateRemoteComObject(MachineName, CLASS_CMLangConvertCharset) as IMLangConvertCharset;
end;
procedure TCMLangConvertCharset.InitServerData;
const
CServerData: TServerData = (
ClassID: '{D66D6F99-CDAA-11D0-B822-00C04FC9B31F}';
IntfIID: '{D66D6F98-CDAA-11D0-B822-00C04FC9B31F}';
EventIID: '';
LicenseKey: nil;
Version: 500);
begin
ServerData := @CServerData;
end;
procedure TCMLangConvertCharset.Connect;
var
punk: IUnknown;
begin
if FIntf = nil then
begin
punk := GetServer;
Fintf:= punk as IMLangConvertCharset;
end;
end;