Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

PowerCobol
How can call a .HLP or .PDF files in Power Cobol

Thank you for any help
Joe



Report this thread to moderator Post Follow-up to this message
Old Post
ProdCil
01-27-06 12:55 PM


Re: PowerCobol
On Fri, 27 Jan 2006 12:10:46 -0000, "ProdCil" <nospam_prodcil@sgs.com>
wrote:

>How can call a .HLP or .PDF files in Power Cobol
>
>Thank you for any help
>Joe
>
what exactly are you trying to accomplish? a LOT more details please


Frederico Fonseca
ema il: frederico_fonseca at syssoft-int.com

Report this thread to moderator Post Follow-up to this message
Old Post
Frederico Fonseca
01-27-06 12:55 PM


Re: PowerCobol
Thanks Frederico,

I can make thi:
INVOKE pow-self "Execute" USING "notepad.exe text.txt"

I want to do the same, but calling "text.chm"  for help files and
"text.pdf",  for example.

If i do:
INVOKE pow-self "Execute" USING "AcroRd32.exe text.pdf"

don't work.

Regards




"Frederico Fonseca" <real-email-in-msg-spam@email.com> wrote in message
 news:o27kt11o4i8vhlcvf6rsqqtvjmtaetcimc@
4ax.com...
> On Fri, 27 Jan 2006 12:10:46 -0000, "ProdCil" <nospam_prodcil@sgs.com>
> wrote:
> 
> what exactly are you trying to accomplish? a LOT more details please
>
>
> Frederico Fonseca
> ema il: frederico_fonseca at syssoft-int.com



Report this thread to moderator Post Follow-up to this message
Old Post
ProdCil
01-27-06 11:55 PM


Re: PowerCobol
ProdCil wrote:
> Thanks Frederico,
>
> I can make thi:
>    INVOKE pow-self "Execute" USING "notepad.exe text.txt"
>
> I want to do the same, but calling "text.chm"  for help files and
> "text.pdf",  for example.
>
> If i do:
>    INVOKE pow-self "Execute" USING "AcroRd32.exe text.pdf"
>
> don't work.

Here's how we get access to a helpfile:

02  HANDLE     PIC S9(9) COMP-5.
02  HELPFILE    PIC X(255).
02  FILLER     PIC X VALUE LOW-VALUES.
02  HELPHANDLE    PIC S9(9) COMP-4.
02  HELPREQUEST.
05  HELPREQUEST-A  PIC S9(4) COMP-5.
05  FILLER    PIC X(2) VALUE LOW-VALUES.


COMPUTE SUBCOMMAND = FUNCTION NUMVAL(TOPIC-NUMBER-X).
MOVE "Hwnd" of pow-self TO HANDLE
MOVE 1 TO HELPREQUEST-A.
CALL "WinHelpA" WITH STDCALL LINKAGE USING
BY VALUE HANDLE
BY REFERENCE HELPFILE
BY VALUE HELPREQUEST-A
BY VALUE SUBCOMMAND.



Report this thread to moderator Post Follow-up to this message
Old Post
HeyBub
01-27-06 11:55 PM


Re: PowerCobol
"ProdCil" <nospam_prodcil@sgs.com> wrote in message
news:newscache$cxerti$x3j$1@newsfront4.netvisao.pt...
> Thanks Frederico,
>
> I can make thi:
>    INVOKE pow-self "Execute" USING "notepad.exe text.txt"
>
> I want to do the same, but calling "text.chm"  for help files and
> "text.pdf",  for example.
>
> If i do:
>    INVOKE pow-self "Execute" USING "AcroRd32.exe text.pdf"
>
> don't work.

I don't know why COBOL would treat notepad.exe differently from
AcroRd32.exe. Did you verify that:

(1) the "AcroRd32.exe" file actually exists
(2) "AcroRd32.exe" is in the search path

?

- Oliver



Report this thread to moderator Post Follow-up to this message
Old Post
Oliver Wong
01-27-06 11:55 PM


Re: PowerCobol
ProdCil a écrit :
> I can make thi:
>     INVOKE pow-self "Execute" USING "notepad.exe text.txt"
>
> I want to do the same, but calling "text.chm"  for help files and
> "text.pdf",  for example.
>
> If i do:
>     INVOKE pow-self "Execute" USING "AcroRd32.exe text.pdf"
>
> don't work. 

You can call the windows function that opens a file based on the
extension association.

In MF Cobol, it is
call WINAPI ShellExecute using
by value 0 size 4,           *> window handle
by reference z"open",        *> operation to perform
by reference
z"myfile.pdf",               *> document to open
by value 0 size 4,           *> parameters (none here)
by reference sw-cwd,         *> directory
by value SW-SHOWNORMAL       *> show the file when open
returning se-hInstance
end-call


and there must be the equivalent in PowerCobol (it's the windows API).

If Acrobat is installed on the computer, all pdf files should be
associated with that application. When you call the ShellExecute api, it
looks at the file extension at starts the application associated with it.

a myfile.txt will start notepad, etc...

You don't have to worry about where the application is installed...

Regards.

Alain

Report this thread to moderator Post Follow-up to this message
Old Post
Alain Reymond
01-28-06 08:55 AM


Re: PowerCobol
Alain Reymond wrote:
> ProdCil a =E9crit : 
>=20
> You can call the windows function that opens a file based on the
> extension association.
>=20
> In MF Cobol, it is
>            call WINAPI ShellExecute using
>                 by value 0 size 4,           *> window handle
>                 by reference z"open",        *> operation to perform
>                 by reference
>                 z"myfile.pdf",               *> document to open
>                 by value 0 size 4,           *> parameters (none here)
>                 by reference sw-cwd,         *> directory
>                 by value SW-SHOWNORMAL       *> show the file when open=

>                 returning se-hInstance
>            end-call
>=20
>=20
> and there must be the equivalent in PowerCobol (it's the windows API).
>=20
> If Acrobat is installed on the computer, all pdf files should be
> associated with that application. When you call the ShellExecute api, i=
t
> looks at the file extension at starts the application associated with i=
t.
>=20
> a myfile.txt will start notepad, etc...
>=20
> You don't have to worry about where the application is installed...
>=20
> Regards.
>=20
> Alain

Here is a PowerCobol version:

ENVIRONMENT DIVISION.
* special-names.
*     symbolic constant
*         SW-SHOWNORMAL is 1.
DATA DIVISION.
WORKING-STORAGE SECTION.
* These group items are C-style null terminated strings.
1      open-command.
2     filler        pic x(4)  value "open".
2     filler        pic x(1)  value low-value.

1      file-to-open.
2     filler        pic x(12) value "THF6A_OM.pdf".
2     filler        pic x(1)  value low-value.

1      default-directory.
2     filler        pic x(17) value "D:\downloads\pdfs".
2     filler        pic x(1)  value low-value.

77     se-hInstance    pic s9(9) comp-5.
77     ReturnValue     pic s9(9) comp-5.

PROCEDURE DIVISION.
*** To use this routine, the SHELL32.LIB file needs to be added
*** to the PowerCobol project.

call "ShellExecuteA" with stdcall linkage
using
by value 0       *> window handle
by reference
open-command *> operation to perform
file-to-open *> document to open
by value 0       *> parameters (none here)
by reference
default-directory, *> directory (could also be null)
by value 1       *> SW-SHOWNORMAL show the file when open
returning
se-hInstance     *> not 'really' a handle,
*> more an error return
end-call

if se-hInstance is not greater than 32 then
INVOKE pow-self "DisplayMessage"
USING "Could not open document" "Bad Open" POW-DMICONERROR
RETURNING ReturnValue
end-if

exit program

. *> term

Hope that helps!,

Jeff Campbell N8WXS


----== Posted via mcse.ms - Unlimited-Unrestricted-Secure Usenet News=
=----
http://www.mcse.ms The #1 Newsgroup Service in the World! 120,000+ New
sgroups
----= East and West-Coast Server Farms - Total Privacy via Encryption =----

Report this thread to moderator Post Follow-up to this message
Old Post
Jeff Campbell
01-28-06 11:55 PM


Re: PowerCobol
grateful to all for the help



"Jeff Campbell" <n8wxs@arrl.net> wrote in message
news:1138493465_3767@sp6iad.superfeed.net...
Alain Reymond wrote:
> ProdCil a écrit : 
>
> You can call the windows function that opens a file based on the
> extension association.
>
> In MF Cobol, it is
>            call WINAPI ShellExecute using
>                 by value 0 size 4,           *> window handle
>                 by reference z"open",        *> operation to perform
>                 by reference
>                 z"myfile.pdf",               *> document to open
>                 by value 0 size 4,           *> parameters (none here)
>                 by reference sw-cwd,         *> directory
>                 by value SW-SHOWNORMAL       *> show the file when open
>                 returning se-hInstance
>            end-call
>
>
> and there must be the equivalent in PowerCobol (it's the windows API).
>
> If Acrobat is installed on the computer, all pdf files should be
> associated with that application. When you call the ShellExecute api, it
> looks at the file extension at starts the application associated with it.
>
> a myfile.txt will start notepad, etc...
>
> You don't have to worry about where the application is installed...
>
> Regards.
>
> Alain

Here is a PowerCobol version:

ENVIRONMENT DIVISION.
* special-names.
*     symbolic constant
*         SW-SHOWNORMAL is 1.
DATA DIVISION.
WORKING-STORAGE SECTION.
* These group items are C-style null terminated strings.
1      open-command.
2     filler        pic x(4)  value "open".
2     filler        pic x(1)  value low-value.

1      file-to-open.
2     filler        pic x(12) value "THF6A_OM.pdf".
2     filler        pic x(1)  value low-value.

1      default-directory.
2     filler        pic x(17) value "D:\downloads\pdfs".
2     filler        pic x(1)  value low-value.

77     se-hInstance    pic s9(9) comp-5.
77     ReturnValue     pic s9(9) comp-5.

PROCEDURE DIVISION.
*** To use this routine, the SHELL32.LIB file needs to be added
*** to the PowerCobol project.

call "ShellExecuteA" with stdcall linkage
using
by value 0       *> window handle
by reference
open-command *> operation to perform
file-to-open *> document to open
by value 0       *> parameters (none here)
by reference
default-directory, *> directory (could also be null)
by value 1       *> SW-SHOWNORMAL show the file when open
returning
se-hInstance     *> not 'really' a handle,
*> more an error return
end-call

if se-hInstance is not greater than 32 then
INVOKE pow-self "DisplayMessage"
USING "Could not open document" "Bad Open" POW-DMICONERROR
RETURNING ReturnValue
end-if

exit program

. *> term

Hope that helps!,

Jeff Campbell N8WXS


----=Posted via mcse.ms - Unlimited-Unrestricted-Secure Usenet
News=---
http://www.mcse.ms The #1 Newsgroup Service in the World! 120,000+
Newsgroups
----=ast and West-Coast Server Farms - Total Privacy via Encryption =--



Report this thread to moderator Post Follow-up to this message
Old Post
ProdCil
01-30-06 12:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Cobol archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:04 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.