ACTIVEX紧急救助!!!!!!!!!!!!!!!!(100)

  • 主题发起人 主题发起人 nnyy66
  • 开始时间 开始时间
N

nnyy66

Unregistered / Unconfirmed
GUEST, unregistred user!
最近在做个打印的ACTIVEX,我用ACTIVEX LIBRARY+AUTOMATION OBJECT做的在IE调用提示 Error:对象不支持此属性或方法 但我用程序调用就可以正常运行.求助高手帮我看看
 
贴上代码library testP;uses ComServ, testP_TLB in 'testP_TLB.pas', Unit1 in 'Unit1.pas' {testPrint: CoClass};exports DllGetClassObject, DllCanUnloadNow, DllRegisterServer, DllUnregisterServer;{$R *.TLB}{$R *.RES}begin
end.
unit Unit1;{$WARN SYMBOL_PLATFORM OFF}interfaceuses ComObj, ActiveX, testP_TLB, StdVcl,Dialogs,Printers;type TtestPrint = class(TAutoObject, ItestPrint) public procedure TS;
safecall;
{ Protected declarations } end;
implementationuses ComServ;procedure TtestPrint.TS;var t: textfile;begin
AssignFile(t,'c:/ccc.txt');
Rewrite(t);
Writeln(t, 'aaa');
CloseFile(t);
//Printer.begin
Doc;
//Printer.EndDoc;
// ShowMessage('a');end;
initialization TAutoObjectFactory.Create(ComServer, TtestPrint, Class_testPrint, ciMultiInstance, tmApartment);end.
unit testP_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 2009-3-16 18:32:14 from Type Library described below.// ************************************************************************ //// Type Lib: F:/test/ActiveX/testP.tlb (1)// LIBID: {476A5819-D165-42DF-A502-46343BDD934F}// LCID: 0// Helpfile: // DepndLst: // (1) v2.0 stdole, (C:/WINDOWS/system32/STDOLE2.TLB)// (2) v4.0 StdVCL, (C:/WINDOWS/system32/stdvcl40.dll)// ************************************************************************ //{$TYPEDADDRESS OFF} // Unit must be compiled without type-checked pointers. {$WARN SYMBOL_PLATFORM OFF}{$WRITEABLECONST ON}interfaceuses ActiveX, Classes, Graphics, 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 testPMajorVersion = 1;
testPMinorVersion = 0;
LIBID_testP: TGUID = '{476A5819-D165-42DF-A502-46343BDD934F}';
IID_ItestPrint: TGUID = '{38C5D2EC-AF08-40DF-9441-1C8C6ABB2428}';
CLASS_testPrint: TGUID = '{06BB8EB2-E5BA-4E41-9AA2-9D0E7C25C678}';type// *********************************************************************//// Forward declaration of types defined in TypeLibrary // *********************************************************************// ItestPrint = interface;
ItestPrintDisp = dispinterface;// *********************************************************************//// Declaration of CoClasses defined in Type Library // (NOTE: Here we map each CoClass to its Default Interface) // *********************************************************************// testPrint = ItestPrint;// *********************************************************************//// Interface: ItestPrint// Flags: (6464) Dual OleAutomation Replaceable Dispatchable// GUID: {38C5D2EC-AF08-40DF-9441-1C8C6ABB2428}// *********************************************************************// ItestPrint = interface(IDispatch) ['{38C5D2EC-AF08-40DF-9441-1C8C6ABB2428}'] procedure TS;
safecall;
end;
// *********************************************************************//// DispIntf: ItestPrintDisp// Flags: (6464) Dual OleAutomation Replaceable Dispatchable// GUID: {38C5D2EC-AF08-40DF-9441-1C8C6ABB2428}// *********************************************************************// ItestPrintDisp = dispinterface ['{38C5D2EC-AF08-40DF-9441-1C8C6ABB2428}'] procedure TS;
dispid 1;
end;
// *********************************************************************//// The Class CotestPrint provides a Create and CreateRemote method to // create instances of the default interface ItestPrint exposed by // the CoClass testPrint. The functions are intended to be used by // clients wishing to automate the CoClass objects exposed by the // server of this typelibrary. // *********************************************************************// CotestPrint = class class function Create: ItestPrint;
class function CreateRemote(const MachineName: string): ItestPrint;
end;
implementationuses ComObj;class function CotestPrint.Create: ItestPrint;begin
Result := CreateComObject(CLASS_testPrint) as ItestPrint;end;
class function CotestPrint.CreateRemote(const MachineName: string): ItestPrint;begin
Result := CreateRemoteComObject(MachineName, CLASS_testPrint) as ItestPrint;end;
end.
 
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><HTML xmlns="http://www.w3.org/1999/xhtml"><H1> Delphi 6 ActiveX Test Page </H1>You should see your Delphi 6 forms or controls embedded in the form below.<body><OBJECT classid=CLSID:06BB8EB2-E5BA-4E41-9AA2-9D0E7C25C678 height=0 id="testPrint" width=0></OBJECT> <input type="button" value="直接打印" onclick=testPrint.TS ></body></HTML>
 
急啊。。。。有没人帮我看下啊?
 
已解决了....
 
斑竹帮我结贴吧
 
我很想知道楼主怎么解决的.因为我也打算做这种ActiveX,不需要Form的ActiveX(嘿嘿).
 
很简单 就和做DLL差不多 有些代码 DELPHI会自动给你生成好的
 
后退
顶部