开发MIDAS:代码:ClientDataModule.ClientDataSet1.AppServer.QueryNew(Edit1.Text );
程序运行到这的时候提示!Undeclared identifer 'QueryNew'
QueryNew这个过程是我给添加的!请问为什么!
程序运行到这的时候提示!Undeclared identifer 'QueryNew'
QueryNew这个过程是我给添加的!请问为什么!
出这个错误基本上都是你没有在Type Library Editor中添加,而仅仅只是在代码中添加。
然后在你使用方法的unit文件里uses这个文件
unit Server_TLB;// ************************************************************************ //
// WARNING
// -------
// The types declared in this file were generated from data read from a
// Type Library. If this type library is explicitly or indirectly (via
// another type library referring to this type library) re-imported, or the
// 'Refresh' command of the Type Library Editor activated while editing the
// Type Library, the contents of this file will be regenerated and all
// manual modifications will be lost.
// ************************************************************************ //// PASTLWTR : $Revision: 1.130 $
// File generated on 2003-2-28 20:33:43 from Type Library described below.// ************************************************************************ //
// Type Lib: E:\server2\Server.tlb (1)
// LIBID: {A36A9294-9600-46D8-BE3B-44336DF231FF}
// LCID: 0
// Helpfile:
// DepndLst:
// (1) v1.0 Midas, (C:\WINNT\System32\midas.dll)
// (2) v2.0 stdole, (C:\WINNT\System32\stdole2.tlb)
// (3) v4.0 StdVCL, (C:\WINNT\System32\stdvcl40.dll)
// ************************************************************************ //
{$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers.
{$WARN SYMBOL_PLATFORM OFF}
{$WRITEABLECONST ON}interfaceuses ActiveX, Classes, Graphics, Midas, StdVCL, Variants, Windows;
// *********************************************************************//
// GUIDS declared in the TypeLibrary. Following prefixes are used:
// Type Libraries : LIBID_xxxx
// CoClasses : CLASS_xxxx
// DISPInterfaces : DIID_xxxx
// Non-DISP interfaces: IID_xxxx
// *********************************************************************//
const
// TypeLibrary Major and minor versions
ServerMajorVersion = 1;
ServerMinorVersion = 0; LIBID_Server: TGUID = '{A36A9294-9600-46D8-BE3B-44336DF231FF}'; IID_IServerReDataModule: TGUID = '{E8AB028D-9A29-454B-9C1E-8E67EEF5879B}';
CLASS_ServerReDataModule: TGUID = '{781C6A1D-BA42-43F3-8FF1-CCFC333DD5FC}';
type// *********************************************************************//
// Forward declaration of types defined in TypeLibrary
// *********************************************************************//
IServerReDataModule = interface;
IServerReDataModuleDisp = dispinterface;// *********************************************************************//
// Declaration of CoClasses defined in Type Library
// (NOTE: Here we map each CoClass to its Default Interface)
// *********************************************************************//
ServerReDataModule = IServerReDataModule;
// *********************************************************************//
// Interface: IServerReDataModule
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {E8AB028D-9A29-454B-9C1E-8E67EEF5879B}
// *********************************************************************//
IServerReDataModule = interface(IAppServer)
['{E8AB028D-9A29-454B-9C1E-8E67EEF5879B}']
function Get_ClientCount: Integer; safecall;
procedure Set_ClientCount(Value: Integer); safecall;
procedure QueryNew(CountryName: OleVariant); safecall;
property ClientCount: Integer read Get_ClientCount write Set_ClientCount;
end;// *********************************************************************//
// DispIntf: IServerReDataModuleDisp
// Flags: (4416) Dual OleAutomation Dispatchable
// GUID: {E8AB028D-9A29-454B-9C1E-8E67EEF5879B}
// *********************************************************************//
IServerReDataModuleDisp = dispinterface
['{E8AB028D-9A29-454B-9C1E-8E67EEF5879B}']
property ClientCount: Integer dispid 1;
procedure QueryNew(CountryName: OleVariant); dispid 2;
function AS_ApplyUpdates(const ProviderName: WideString; Delta: OleVariant;
MaxErrors: Integer; out ErrorCount: Integer; var OwnerData: OleVariant): OleVariant; dispid 20000000;
function AS_GetRecords(const ProviderName: WideString; Count: Integer; out RecsOut: Integer;
Options: Integer; const CommandText: WideString;
var Params: OleVariant; var OwnerData: OleVariant): OleVariant; dispid 20000001;
function AS_DataRequest(const ProviderName: WideString; Data: OleVariant): OleVariant; dispid 20000002;
function AS_GetProviderNames: OleVariant; dispid 20000003;
function AS_GetParams(const ProviderName: WideString; var OwnerData: OleVariant): OleVariant; dispid 20000004;
function AS_RowRequest(const ProviderName: WideString; Row: OleVariant; RequestType: Integer;
var OwnerData: OleVariant): OleVariant; dispid 20000005;
procedure AS_Execute(const ProviderName: WideString; const CommandText: WideString;
var Params: OleVariant; var OwnerData: OleVariant); dispid 20000006;
end;// *********************************************************************//
// The Class CoServerReDataModule provides a Create and CreateRemote method to
// create instances of the default interface IServerReDataModule exposed by
// the CoClass ServerReDataModule. The functions are intended to be used by
// clients wishing to automate the CoClass objects exposed by the
// server of this typelibrary.
// *********************************************************************//
CoServerReDataModule = class
class function Create: IServerReDataModule;
class function CreateRemote(const MachineName: string): IServerReDataModule;
end;implementationuses ComObj;class function CoServerReDataModule.Create: IServerReDataModule;
begin
Result := CreateComObject(CLASS_ServerReDataModule) as IServerReDataModule;
end;class function CoServerReDataModule.CreateRemote(const MachineName: string): IServerReDataModule;
begin
Result := CreateRemoteComObject(MachineName, CLASS_ServerReDataModule) as IServerReDataModule;
end;end.
从Interface 中已经看到很明显在类型库中啊!注册过了
IDispatch* disp = (IDispatch*)(MyConnection->AppServer)
IMyAppServerDisp TempInterface( (IMyAppServer*)disp);
TempInterface.SpecialMethod(x,y);