Home > Archive > Cobol > November 2004 > Power Cobol and Windows API Routines
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
Power Cobol and Windows API Routines
|
|
| James Sugrue 2004-11-22, 8:55 pm |
| Does anyone have any examples on how to use the Windows API calls with
Fujitsu PowerCobol (6) ?
I want to use some GDI line drawing calls. LineTo etc.
| |
| Pete Dashwood 2004-11-23, 3:55 am |
| Yes, I have some.
Before you start here are some suggestions:
1. Download a current API reference. (I use API Guide downloadable from:
http://www.allapi.net
2. Find out what part of windows your API call "lives in". (The document in
1 above will tell you this.)
3. Make sure you include the library containing these entry points into your
PowerCOBOL project. Note that Fujitsu do NOT provide a comprehensive set of
libraries. Some must be obtained by getting the Windows SDK.However,
libraries for most of the APIs you will use are provided by Fujitsu.
On checking, I find that the API you have requested is part of windows
GDI32.dll. This means you will need GDI32.lib included in your PowerCOBOL
project.(This is not provided by Fujitsu per se. You will probably need the
Windows SDK - downloadable for free from MS but it is over 100MB).
Here is the prototype in "VB speak":(You will need to "translate" this into
COBOL before using it...)
Declare Function LineTo Lib "gdi32" Alias "LineTo" (ByVal hdc As Long, ByVal
x As Long, ByVal y As Long) As Long
"hdc" is a device context, "x" is the x co-ordinate for the line end, "y" is
the y co-ordinate for the line end.
Check the PowerCOBOL sample code (I think there is an example API call in
it).
When you have some code of your own, post it here if you can't get it to
work. Or send me the PowerCOBOL project privately.
HTH,
Pete.
(top post no more below.)
"James Sugrue" <jamessugrue@xtra.co.nz> wrote in message
news:Kivod.9052$9A.208371@news.xtra.co.nz...
> Does anyone have any examples on how to use the Windows API calls with
> Fujitsu PowerCobol (6) ?
>
> I want to use some GDI line drawing calls. LineTo etc.
>
| |
| JerryMouse 2004-11-23, 3:55 am |
| James Sugrue wrote:
> Does anyone have any examples on how to use the Windows API calls with
> Fujitsu PowerCobol (6) ?
>
> I want to use some GDI line drawing calls. LineTo etc.
Second what Pete says - it's pretty easy once you get the hang of it.
Watch out for proper casing - the API routines are positively anal about
that. You'll have to add a compile directive to your form. Double-click the
script to bring up "Properties" and add the following to "Compile" tab /
options:
"ALPHAL(WORD)" (no quotes)
otherwise calls to subprograms get folded to upper-case.
Here's an example to get the Windows directory:
01 The-Path-Name PIC X(256).
01 Path-Len Pic 9(9) Comp-5.
Move 255 To Path-Len
Call 'GetWindowsDirectoryA' With STDCALL Using
By Reference The-Path-Name
By Value Path-Len
| |
| Lueko Willms 2004-11-23, 8:55 am |
| .. On 23.11.04
wrote jamessugrue@xtra.co.nz (James Sugrue)
on /COMP/LANG/COBOL
in Kivod.9052$9A.208371@news.xtra.co.nz
about Power Cobol and Windows API Routines
JS> Does anyone have any examples on how to use the Windows API calls
JS> with Fujitsu PowerCobol (6) ?
One can download a couple of sample programs from the Fujitsu COBOL
website, www.adtools.com , right here:
http://www.adtools.com/student/samples/
OK, well, these are samples for the version 3.0 compiler, which can
be downloaded free as a "student version".
But here are sample programs for later versions:
http://www.adtools.com/download/v4samples/index.htm
Yours,
Lüko Willms http://www.willms-edv.de
/--------- L.WILLMS@jpberlin.de -- Alle Rechte vorbehalten --
Das Buch muß erst ausgedroschen werden. -G.C.Lichtenberg
| |
| James Sugrue 2004-11-24, 3:55 am |
| James Sugrue wrote:
> Does anyone have any examples on how to use the Windows API calls with
> Fujitsu PowerCobol (6) ?
>
> I want to use some GDI line drawing calls. LineTo etc.
Thanks guys. I will have a look at the suggestions and let you know how
I get on.
|
|
|
|
|