Link to home
Start Free TrialLog in
Avatar of JackVannoy
JackVannoy

asked on

Close An Acrobat Reader PDF file from Visual Basic 6

Have a VB6 form that opens and displays a PDF file.  When exiting the VB6 form, I want to close the PDF file.  After returning to the calling program, I want to Kill the PDF file that is residing in a directory.

I have submitted the code that I a using along with note commemts.
Would appreciate any help.

Thanks

Jack
General Declarations
    '''''''''''''''''
    Private Const SW_SHOWNORMAL = 0.75
    Private Const SW_CLOSE = True
    
    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
    ''''''''''''''''
Form Activate
        '=== Put in the routine to display the PDF file ==================================
        'Note: the PassString(6) carries the directory path and name of the previously
        ' saved PDF file
 
            ShellExecute Me.hwnd, "open", PassString(6), vbNullString, _
            vbNullString, SW_SHOWNORMAL
 
            'Note: The above code seems to work fine.
        '======================================================================
 
This is my attempt to close the file so that when 
Form Unload
        ShellExecute Me.hwnd, "close", PassString(6), vbNullString,  vbNullString, 1
 
         ' Note: the code executes but the PDF file is not closed, it just moves down to
        ' the task bar at bottom of screen

Open in new window

Avatar of JackVannoy
JackVannoy

ASKER

I really need help on this problem, so  would like to change the number of points from 500 to 100 but not sure how to do this.

SOLUTION
Avatar of itsmeandnobodyelse
itsmeandnobodyelse
Flag of Germany image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In my comment wishing to change the points, I said from 500 to 100.  That was in error.  I really want to change the points from 500 to 1000.
Sorry about that.

Jack
Sorry, I didn't realize that 500 was the maximum points for any one question.

Jack
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
http://vbnet.mvps.org/

http://www.mvps.org/links.html#VisualBasic

the 2 above sites should help you on your quest :)
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
The reason for the point split is that I took portions of all of the three experts who responded, and arrived at a soultion.

Thank all of you very much for your responses.

Jack