Solved

OLE Container problem

Posted on 2000-03-22
9
711 Views
Last Modified: 2013-11-25
I've got problems using an OLE Container in my application. I've linked it to a pdf file, then i've associated the DoVerb method to the mouse click event.
When I run my application, pdf files open in an Acrobat Reader window (correctly ...), but I'm not able to open that window maximized.

How can I do that?
Thanks in advance (sorry for my poor english ...)

Andrea

0
Comment
Question by:andrea_v
  • 5
  • 4
9 Comments
 
LVL 1

Expert Comment

by:phiro
ID: 2643981
You cannot.
You would need to increase the size of your OLE container (Maximize the form on which it is situated and maximize the container as well) or you would have to start an instance of Acrobat outside of your application :
For instance (I do not know this works for I have no Acrobat here so I give you an example for Word: )

In your form code :

Public oWord As Word.Application
Public oDoc As Word.Document

Private Sub cmdVerb_Click()
    Set oWord = New Word.Application
    oWord.WindowState = wdWindowStateMaximize
    Set oDoc = oWord.Documents.Open("c:\Doc1.doc")
    oWord.Visible = True
End Sub

You need to have an existing document at the path.
Now to use this with acrobat,
You would need to use the Acrobat COM library. You find that in VB by opening the "Project" menu and select "references". Now look for the Acrobat library and check the checkbox.
Now you can use the objects simulair to the example I showed you.
Press F2 to find out how the functions and properties are called for Acrobat.

Good luck, let me know when you need more info.

0
 

Author Comment

by:andrea_v
ID: 2648200
Adjusted points from 100 to 130
0
 

Author Comment

by:andrea_v
ID: 2648201
The only library I found contains only a PdfLib.Pdf class with few and useless methods.
Where can I find more specific libraries?

Can I build my application in a different way?
For example, using OLE AutoSize method and opening the document in a separate frame? How can I do that?

Many thanks for your time.

Andrea
0
 
LVL 1

Expert Comment

by:phiro
ID: 2648578
Well, you could create a new form, maximize it and but an OLE container over the whole surface. When you activate the first OLE container (Or better, just use a button to start it) you will have a full screen OLE container.
You'd open the second form by:
Lets assume it is called frmFullOLE
the call would be :

dim obj as New frmFullOLE
frmFullOLE.Show

Another option is, when you cannot find a good COM lib. Is to use the API call to start the application itself with the file you want to use.

In the general declaration part of your form, add this:
'*** START ADD


Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

'***END ADD

Do not be alarmed if this seems complicated. It gets better <g>

Now in your code where you want to start the application just put the line :


ShellExecute Me.hwnd, "open", sFileNameAndPathPdfFile, vbNullString, vbNullString, 1

Just set the path and filename at the place where sFileNameAndPathPdfFile is. leave the rest.
Now windows will open the file for you.

Hope this helps you further.


0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 

Author Comment

by:andrea_v
ID: 2649168
Ok, I've tried that way, but Acrobat still opens NOT MAXIMIZED!!!

I think to have to change ShellExecute's last parameter (1), but I don't know what's the right value ...

Thanks, bye.

Andrea
0
 
LVL 1

Accepted Solution

by:
phiro earned 140 total points
ID: 2649767
Oops,

My mistake ,

Change 1 for 3 (SW_MAXIMIZE)
So :
ShellExecute Me.hwnd, "open", sFileNameAndPathPdfFile, vbNullString, vbNullString, 3


This opens it maximized !

Cheers PhiRo

0
 

Author Comment

by:andrea_v
ID: 2650115
Adjusted points from 130 to 140
0
 

Author Comment

by:andrea_v
ID: 2650116
Many thanks to phiro for his "fast" answers!
0
 
LVL 1

Expert Comment

by:phiro
ID: 2652633
You're welcome !
0

Featured Post

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
Background What I'm presenting in this article is the result of 2 conditions in my work area: We have a SQL Server production environment but no development or test environment; andWe have an MS Access front end using tables in SQL Server but we a…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

746 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now