 |
BorlandTalk.com Borland discussion newsgroups
|
| View previous topic :: View next topic |
| Author |
Message |
Barry Guest
|
Posted: Thu Oct 30, 2003 7:25 pm Post subject: How do I use OCX in Delphi |
|
|
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
|
Posted: Thu Oct 30, 2003 7:26 pm Post subject: Re: How do I use OCX in Delphi |
|
|
"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
|
Posted: Thu Oct 30, 2003 7:36 pm Post subject: Re: How do I use OCX in Delphi |
|
|
"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
|
Posted: Thu Oct 30, 2003 7:36 pm Post subject: Re: How do I use OCX in Delphi |
|
|
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
|
Posted: Thu Oct 30, 2003 7:58 pm Post subject: Re: How do I use OCX in Delphi |
|
|
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
|
Posted: Thu Oct 30, 2003 8:19 pm Post subject: Re: How do I use OCX in Delphi |
|
|
"Barry" <barry_wells (AT) ca4 (DOT) uscourts.gov> wrote in message
3fa16d01$1 (AT) newsgroups (DOT) borland.com...
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
|
Posted: Thu Oct 30, 2003 11:28 pm Post subject: Re: Re: How do I use OCX in Delphi |
|
|
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
|
Posted: Fri Oct 31, 2003 12:34 pm Post subject: Re: Re: How do I use OCX in Delphi |
|
|
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
|
Posted: Fri Oct 31, 2003 1:08 pm Post subject: Re: Re: How do I use OCX in Delphi |
|
|
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
|
Posted: Sat Nov 01, 2003 5:32 am Post subject: Re: Re: Re: How do I use OCX in Delphi |
|
|
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 |
|
 |
|
|
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
|
|