BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

How do I use OCX in Delphi

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi ActiveX Controls Usage
View previous topic :: View next topic  
Author Message
Barry
Guest





PostPosted: Thu Oct 30, 2003 7:25 pm    Post subject: How do I use OCX in Delphi Reply with quote



I have a com file from pdf_tools that I want to use with delphi. This
program will print a pdf file. The problem is how do I use this with
delphi? How do I create this class(?) do I can use it? The program
compiles but give me an access violation when I run it on the following
line. pdf_prt.PrintFile('c:578585.pdf','HP LaserJet 1200 Series
PCL','');

Any help would be appreciated.

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

uses printerocxlib_tlb;

procedure TForm1.Button1Click(Sender: TObject);
var
pdf_prt : pdfprinter;
begin
pdf_prt.PrintFile('c:578585.pdf','HP LaserJet 1200 Series PCL','');
end;

end.


Back to top
Ignacio Vazquez
Guest





PostPosted: Thu Oct 30, 2003 7:26 pm    Post subject: Re: How do I use OCX in Delphi Reply with quote



"Barry" <barry_wells (AT) ca4 (DOT) uscourts.gov> wrote in message
3fa16516$1 (AT) newsgroups (DOT) borland.com...
Quote:
The program
compiles but give me an access violation when I run it on the following
line. pdf_prt.PrintFile('c:578585.pdf','HP LaserJet 1200 Series
PCL','');

That's because you forgot to create a pdfprinter object:

pdf_prt:=pdfprinter.Create(...);

Cheers,
Ignacio

--
The strange part isn't so much that he had an accent. No accent was
detectable. It was just sounds and burbs and gurgles coming from him. He
was a like a chubby, old R2-D2.
- La Üter



Back to top
Ignacio Vazquez
Guest





PostPosted: Thu Oct 30, 2003 7:36 pm    Post subject: Re: How do I use OCX in Delphi Reply with quote



"Barry" <barry_wells (AT) ca4 (DOT) uscourts.gov> wrote in message
3fa167bc$1 (AT) newsgroups (DOT) borland.com...
Quote:
Actually, I tried that and I get Object or class type required.

I don't know enough about the OCX to be able to help you with that. Do you
have a link?

Cheers,
Ignacio

--
The strange part isn't so much that he had an accent. No accent was
detectable. It was just sounds and burbs and gurgles coming from him. He
was a like a chubby, old R2-D2.
- La Üter



Back to top
Barry
Guest





PostPosted: Thu Oct 30, 2003 7:36 pm    Post subject: Re: How do I use OCX in Delphi Reply with quote

Actually, I tried that and I get Object or class type required.

unit Unit1;

interface

uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls;

type
TForm1 = class(TForm)
Button1: TButton;
procedure Button1Click(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
end;

var
Form1: TForm1;

implementation

{$R *.dfm}

uses printerocxlib_tlb;

procedure TForm1.Button1Click(Sender: TObject);
var
pdf_prt : pdfprinter;
begin
pdf_prt := pdfprinter.create(self);
pdf_prt.PrintFile('c:578585.pdf','HP LaserJet 1200 Series PCL','');
end;

end.

"Ignacio Vazquez" <ivazquezATorioncommunications.com> wrote

Quote:
"Barry" <barry_wells (AT) ca4 (DOT) uscourts.gov> wrote in message
3fa16516$1 (AT) newsgroups (DOT) borland.com...
The program
compiles but give me an access violation when I run it on the following
line. pdf_prt.PrintFile('c:578585.pdf','HP LaserJet 1200 Series
PCL','');

That's because you forgot to create a pdfprinter object:

pdf_prt:=pdfprinter.Create(...);

Cheers,
Ignacio

--
The strange part isn't so much that he had an accent. No accent was
detectable. It was just sounds and burbs and gurgles coming from him. He
was a like a chubby, old R2-D2.
- La Üter





Back to top
Barry
Guest





PostPosted: Thu Oct 30, 2003 7:58 pm    Post subject: Re: How do I use OCX in Delphi Reply with quote

link?

"Ignacio Vazquez" <ivazquezATorioncommunications.com> wrote

Quote:
"Barry" <barry_wells (AT) ca4 (DOT) uscourts.gov> wrote in message
3fa167bc$1 (AT) newsgroups (DOT) borland.com...
Actually, I tried that and I get Object or class type required.

I don't know enough about the OCX to be able to help you with that. Do you
have a link?

Cheers,
Ignacio

--
The strange part isn't so much that he had an accent. No accent was
detectable. It was just sounds and burbs and gurgles coming from him. He
was a like a chubby, old R2-D2.
- La Üter





Back to top
Ignacio Vazquez
Guest





PostPosted: Thu Oct 30, 2003 8:19 pm    Post subject: Re: How do I use OCX in Delphi Reply with quote

"Barry" <barry_wells (AT) ca4 (DOT) uscourts.gov> wrote in message
3fa16d01$1 (AT) newsgroups (DOT) borland.com...
Quote:
link?

To the component, if it's available over the Internet.

Cheers,
Ignacio

--
The strange part isn't so much that he had an accent. No accent was
detectable. It was just sounds and burbs and gurgles coming from him. He
was a like a chubby, old R2-D2.
- La Üter



Back to top
Dennis Passmore
Guest





PostPosted: Thu Oct 30, 2003 11:28 pm    Post subject: Re: Re: How do I use OCX in Delphi Reply with quote

If you have a true OCX library then the following syntax might be correct.

uses printerocxlib_tlb;

procedure TForm1.Button1Click(Sender: TObject);
var
pdf_prt : pdfprinter;
begin
pdf_prt := CoPdfprinter.create;
pdf_prt.PrintFile('c:578585.pdf','HP LaserJet 1200 Series PCL','');
end;



Dennis Passmore
Ultimate Software, Inc.
Back to top
Barry
Guest





PostPosted: Fri Oct 31, 2003 12:34 pm    Post subject: Re: Re: How do I use OCX in Delphi Reply with quote

That did it! Thank you.

<Dennis Passmore> wrote

Quote:
If you have a true OCX library then the following syntax might be correct.

uses printerocxlib_tlb;

procedure TForm1.Button1Click(Sender: TObject);
var
pdf_prt : pdfprinter;
begin
pdf_prt := CoPdfprinter.create;
pdf_prt.PrintFile('c:578585.pdf','HP LaserJet 1200 Series PCL','');
end;



Dennis Passmore
Ultimate Software, Inc.



Back to top
Barry
Guest





PostPosted: Fri Oct 31, 2003 1:08 pm    Post subject: Re: Re: How do I use OCX in Delphi Reply with quote

Do I need to free it after I use it?

"Barry" <barry_wells (AT) ca4 (DOT) uscourts.gov> wrote

Quote:
That did it! Thank you.

Dennis Passmore> wrote in message
news:3k73qvo9hcj3ieftf5bmiat81ph8slchh9 (AT) 4ax (DOT) com...
If you have a true OCX library then the following syntax might be
correct.

uses printerocxlib_tlb;

procedure TForm1.Button1Click(Sender: TObject);
var
pdf_prt : pdfprinter;
begin
pdf_prt := CoPdfprinter.create;
pdf_prt.PrintFile('c:578585.pdf','HP LaserJet 1200 Series PCL','');
end;



Dennis Passmore
Ultimate Software, Inc.





Back to top
Dennis Passmore
Guest





PostPosted: Sat Nov 01, 2003 5:32 am    Post subject: Re: Re: Re: How do I use OCX in Delphi Reply with quote

No, since it worked as I thought then it is a standard COM interface and just setting it
to NIL or doing nothing is fine.

Dennis Passmore
Ultimate Software, Inc.
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi ActiveX Controls Usage All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.