Go Back   Forum Care Forums > Development Reference Area > Visual Basic

Reply
 
LinkBack Thread Tools Display Modes
PDFreader?
Old
  (#1)
John Lauwers
Guest
 
Posts: n/a
Default PDFreader? - 06-04-2007, 08:51 AM

Hello,

With the API Shellexecute function I open a PDF document with the PDFreader,
How can I set the position of the PDF Reader?
Also With an API ???

ShellExecute Me.hwnd, "Open", "Helpbestand Q-Cycle.pdf", 0, 0, vbNormalFocus

Now I have to set the position .

Hope You can help me.

Greets John.


   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote

Re: PDFreader?
Old
  (#2)
J French
Guest
 
Posts: n/a
Default Re: PDFreader? - 06-04-2007, 08:51 AM

On Tue, 25 Nov 2003 09:20:59 +0100, "John Lauwers"
<EMAIL REMOVED> wrote:

>Hello,
>
>With the API Shellexecute function I open a PDF document with the PDFreader,
>How can I set the position of the PDF Reader?
>Also With an API ???
>
>ShellExecute Me.hwnd, "Open", "Helpbestand Q-Cycle.pdf", 0, 0, vbNormalFocus
>
>Now I have to set the position .


You'll need to get the Windows Handle of the PDF Reader and then use
the MoveWindow API

SetWindowPos is an alternative

Alternatively you could use the SetParent API to force the PDFReader
into one of your Forms
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: PDFreader?
Old
  (#3)
John Lauwers
Guest
 
Posts: n/a
Default Re: PDFreader? - 06-04-2007, 08:51 AM

Thanks J.French
But can I now programatticaly use the print command of the PDF reader
without pushing the print button?

Greets John


"J French" <EMAIL REMOVED> schreef in bericht
news:EMAIL REMOVED...
> On Tue, 25 Nov 2003 09:20:59 +0100, "John Lauwers"
> <EMAIL REMOVED> wrote:
>
> >Hello,
> >
> >With the API Shellexecute function I open a PDF document with the

PDFreader,
> >How can I set the position of the PDF Reader?
> >Also With an API ???
> >
> >ShellExecute Me.hwnd, "Open", "Helpbestand Q-Cycle.pdf", 0, 0,

vbNormalFocus
> >
> >Now I have to set the position .

>
> You'll need to get the Windows Handle of the PDF Reader and then use
> the MoveWindow API
>
> SetWindowPos is an alternative
>
> Alternatively you could use the SetParent API to force the PDFReader
> into one of your Forms



   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: PDFreader?
Old
  (#4)
J French
Guest
 
Posts: n/a
Default Re: PDFreader? - 06-04-2007, 08:51 AM

On Tue, 25 Nov 2003 11:23:06 +0100, "John Lauwers"
<EMAIL REMOVED> wrote:

>Thanks J.French
>But can I now programatticaly use the print command of the PDF reader
>without pushing the print button?


I ***ume that button responds to Ctl P

- force the target App into focus, then ...

// --- Force in Ctl O
call keybd_event(VK_CONTROL, 0, 0, 0)
call keybd_event(VK_P, 0, 0, 0)
call keybd_event(VK_P, 0, KEYEVENTF_KEYUP, 0)
call keybd_event(VK_CONTROL, 0, KEYEVENTF_KEYUP, 0)

You could probably also use SendKeys


   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: PDFreader?
Old
  (#5)
Raoul Watson
Guest
 
Posts: n/a
Default Re: PDFreader? - 06-04-2007, 08:51 AM


"John Lauwers" <EMAIL REMOVED> wrote in message
news:3fc32d51$0$22016$EMAIL REMOVED .be...

> But can I now programatticaly use the print command of the PDF reader
> without pushing the print button?
>
> Greets John
>


John..

There is an OCX that pdf users would have installed (comes with the reader).
The name is pdf.ocx. If you use that in your component, you will be
surprised what you can do with it.. this to include:

pdfcontrol.print
pdfcontrol.printpages
pdfcontrol.left
etc..

I have no idea where these are documented but experimentation within VB (by
just typing controlname <period> and watch the pop-up of procs and
properties usually will be sufficient.


   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: PDFreader?
Old
  (#6)
John Lauwers
Guest
 
Posts: n/a
Default Re: PDFreader? - 06-04-2007, 08:51 AM

J.French,

I will use SetParent API but how can a obtain the Hwnd from the PDFreader
that I opened ?

Greets John


"J French" <EMAIL REMOVED> schreef in bericht
news:EMAIL REMOVED...
> On Tue, 25 Nov 2003 09:20:59 +0100, "John Lauwers"
> <EMAIL REMOVED> wrote:
>
> >Hello,
> >
> >With the API Shellexecute function I open a PDF document with the

PDFreader,
> >How can I set the position of the PDF Reader?
> >Also With an API ???
> >
> >ShellExecute Me.hwnd, "Open", "Helpbestand Q-Cycle.pdf", 0, 0,

vbNormalFocus
> >
> >Now I have to set the position .

>
> You'll need to get the Windows Handle of the PDF Reader and then use
> the MoveWindow API
>
> SetWindowPos is an alternative
>
> Alternatively you could use the SetParent API to force the PDFReader
> into one of your Forms



   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: PDFreader?
Old
  (#7)
J French
Guest
 
Posts: n/a
Default Re: PDFreader? - 06-04-2007, 08:52 AM

On Tue, 25 Nov 2003 12:28:47 +0100, "John Lauwers"
<EMAIL REMOVED> wrote:

>J.French,
>
>I will use SetParent API but how can a obtain the Hwnd from the PDFreader
>that I opened ?


Not tonight - this is a bookmark
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: PDFreader?
Old
  (#8)
J French
Guest
 
Posts: n/a
Default Re: PDFreader? - 06-04-2007, 08:52 AM

On Tue, 25 Nov 2003 22:46:57 +0000 (UTC), EMAIL REMOVED (J
French) wrote:

>On Tue, 25 Nov 2003 12:28:47 +0100, "John Lauwers"
><EMAIL REMOVED> wrote:
>
>>J.French,
>>
>>I will use SetParent API but how can a obtain the Hwnd from the PDFreader
>>that I opened ?

>
>Not tonight - this is a bookmark


Ok, goto www.AllAPI.net

Download their API Guide and look at the example for Terminate Process

The bit you want is: InstanceToWnd

It would be wise *not* to use Shell, better use CreateProcess
Although Shell returns a PID - it is reportedly not totally reliable
Start with Shell and then replace it later

I could cut and paste the bits you need, but you would be much better
off spending a few minutes sniffing through the API Guide
- besides you'll need the rest of it

BTW don't use TerminateProcess - it is poison

Try sending a WM_QUIT or WM_CLOSE message, well behaved Apps will
close

HTH
   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: PDFreader?
Old
  (#9)
Randy Birch
Guest
 
Posts: n/a
Default Re: PDFreader? - 06-04-2007, 08:52 AM

If found them in the \adobe\acrobat\reader\activex folder. In the VB
component's dialog it appears as "acrobat control for activex". I used the
component dialog to browse to that control (pdf.ocx) and select it, thus
causing it to become registered (it wasn't listed in my dialog), and two
lines of code did the trick.

--

Randy Birch
MVP Visual Basic
http://www.mvps.org/vbnet/
Please respond only to the newsgroups so all can benefit.


"Raoul Watson" <EMAIL REMOVED> wrote in message
news:9uGwb.1915$EMAIL REMOVED...
:
: "John Lauwers" <EMAIL REMOVED> wrote in message
: news:3fc32d51$0$22016$EMAIL REMOVED .be...
:
: > But can I now programatticaly use the print command of the PDF reader
: > without pushing the print button?
: >
: > Greets John
: >
:
: John..
:
: There is an OCX that pdf users would have installed (comes with the
reader).
: The name is pdf.ocx. If you use that in your component, you will be
: surprised what you can do with it.. this to include:
:
: pdfcontrol.print
: pdfcontrol.printpages
: pdfcontrol.left
: etc..
:
: I have no idea where these are documented but experimentation within VB
(by
: just typing controlname <period> and watch the pop-up of procs and
: properties usually will be sufficient.
:
:


   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Re: PDFreader?
Old
  (#10)
John Lauwers
Guest
 
Posts: n/a
Default Re: PDFreader? - 06-04-2007, 08:52 AM

J.Frech,

The Shellexecute API doesn't return a handle it returns a long which
represents the error code when the function fails.

Greets John



"J French" <EMAIL REMOVED> schreef in bericht
news:EMAIL REMOVED...
> On Tue, 25 Nov 2003 22:46:57 +0000 (UTC), EMAIL REMOVED (J
> French) wrote:
>
> >On Tue, 25 Nov 2003 12:28:47 +0100, "John Lauwers"
> ><EMAIL REMOVED> wrote:
> >
> >>J.French,
> >>
> >>I will use SetParent API but how can a obtain the Hwnd from the

PDFreader
> >>that I opened ?

> >
> >Not tonight - this is a bookmark

>
> Ok, goto www.AllAPI.net
>
> Download their API Guide and look at the example for Terminate Process
>
> The bit you want is: InstanceToWnd
>
> It would be wise *not* to use Shell, better use CreateProcess
> Although Shell returns a PID - it is reportedly not totally reliable
> Start with Shell and then replace it later
>
> I could cut and paste the bits you need, but you would be much better
> off spending a few minutes sniffing through the API Guide
> - besides you'll need the rest of it
>
> BTW don't use TerminateProcess - it is poison
>
> Try sending a WM_QUIT or WM_CLOSE message, well behaved Apps will
> close
>
> HTH



   
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On





Contact Us - Forum Care Forums - Archive - Top