- PDF files

From: [at]} <Juan>
Date: Mon, 07 Feb 2005 12:59:29 +0100

----boundary-LibPST-iamunique-1424365729_-_-
Content-type: text/plain

If you use ShellExecute rather than WinExec, Windows does it for you:

MODULE Shell ["SHELL32"];

IMPORT WinApi;

PROCEDURE ShellExecuteA* (hwnd: WinApi.HWND; lpOperation: WinApi.PtrSTR;
lpFile: WinApi.PtrSTR; lpParameters: WinApi.PtrSTR; lpDirectory:
WinApi.PtrSTR; nShowCmd: INTEGER): WinApi.HINSTANCE;

END Shell.

MODULE Wandsacrobat;
IMPORT WinApi, SYSTEM, Shell;

PROCEDURE Display*(IN path, file: ARRAY OF CHAR);
  VAR
    cmd: POINTER TO ARRAY OF SHORTCHAR;
    instance: WinApi.HINSTANCE;
  BEGIN
    NEW(cmd, LEN(path$) + LEN(file$) + 1);
    cmd^ := SHORT(path + file);
    instance := Shell.ShellExecuteA(0, "open", cmd^, NIL, "",
WinApi.SW_SHOW );
  END Display;

END Wandsacrobat.

Regards,
Juan

Campbell, Robert D (UK Edinburgh) wrote:

>I have written a small Command to open a 'PDF' file.
>It works for me, but has several problems, in particular:
>
>1 - A customer might have a different version of Acrobat.
>2 - She might keep in in a different path
>3 - or not have Acrobat
>4 - or prefers to use GSview etc.
>
>It is also not memory safe!
>
>Does anyone know a better approach?
>
>Thanks
>
>Robert
>
>
>
>MODULE WandsAcrobat;
>IMPORT WinApi, SYSTEM;
>CONST
> Acrobat = 'C:\Program Files\Adobe\Acrobat 5.0\Reader\AcroRd32.exe ';
>
>PROCEDURE Display*(IN path, file: ARRAY OF CHAR);
> VAR
> cmd: WinApi.PtrSTR;
> BEGIN
> cmd := '012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789';
> cmd^ := Acrobat + SHORT(path + file);
> IF WinApi.WinExec(cmd, WinApi.SW_SHOW) = 0 THEN END
> END Display;
>
>END WandsAcrobat.
>
>
> DevDebug.Unload
>
> "WandsAcrobat.Display('P:\MyProject\MySubsystem','MyComponentSpecification.pdf')"
>
>********************************************************************
>This email and any attachments are confidential to the intended
>recipient and may also be privileged. If you are not the intended
>recipient please delete it from your system and notify the sender.
>You should not copy it or use it for any purpose nor disclose or
>distribute its contents to any other person.
>********************************************************************
>
>--- BlackBox
>--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy
>
>
>
>
>

--- BlackBox
--- send subject HELP or UNSUBSCRIBE to blackbox{([at]})nowhere.xy



----boundary-LibPST-iamunique-1424365729_-_-
Content-type: application/rtf
Content-transfer-encoding: base64
Content-Disposition: attachment; filename="rtf-body.rtf"

e1xydGYxXGFuc2lcYW5zaWNwZzEyNTJcZnJvbXRleHQgXGRlZmYwe1xmb250dGJsDQp7XGYwXGZz
d2lzcyBBcmlhbDt9DQp7XGYxXGZtb2Rlcm4gQ291cmllciBOZXc7fQ0Ke1xmMlxmbmlsXGZjaGFy
c2V0MiBTeW1ib2w7fQ0Ke1xmM1xmbW9kZXJuXGZjaGFyc2V0MCBDb3VyaWVyIE5ldzt9fQ0Ke1xj
b2xvcnRibFxyZWQwXGdyZWVuMFxibHVlMDtccmVkMFxncmVlbjBcYmx1ZTI1NTt9DQpcdWMxXHBh
cmRccGxhaW5cZGVmdGFiMzYwIFxmMFxmczIwIElmIHlvdSB1c2UgU2hlbGxFeGVjdXRlIHJhdGhl
ciB0aGFuIFdpbkV4ZWMsIFdpbmRvd3MgZG9lcyBpdCBmb3IgeW91OlxwYXINClxwYXINCk1PRFVM
RSBTaGVsbCBbIlNIRUxMMzIiXTtccGFyDQpccGFyDQpJTVBPUlQgV2luQXBpO1xwYXINClxwYXIN
ClBST0NFRFVSRSBTaGVsbEV4ZWN1dGVBKiAoaHduZDogV2luQXBpLkhXTkQ7IGxwT3BlcmF0aW9u
OiBXaW5BcGkuUHRyU1RSOyBccGFyDQpscEZpbGU6IFdpbkFwaS5QdHJTVFI7IGxwUGFyYW1ldGVy
czogV2luQXBpLlB0clNUUjsg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ioqKioqKioq
KioqKioqKioqKioqKioqKioqKioqKioqKioqKioqXHBhcg0KPlxwYXINCj4tLS0gQmxhY2tCb3hc
cGFyDQo+LS0tIHNlbmQgc3ViamVjdCBIRUxQIG9yIFVOU1VCU0NSSUJFIHRvIGJsYWNrYm94QG9i
ZXJvbi5jaFxwYXINCj5ccGFyDQo+XHBhcg0KPlxwYXINCj4gIFxwYXINCj5ccGFyDQpccGFyDQot
LS0gQmxhY2tCb3hccGFyDQotLS0gc2VuZCBzdWJqZWN0IEhFTFAgb3IgVU5TVUJTQ1JJQkUgdG8g
YmxhY2tib3hAb2Jlcm9uLmNoXHBhcg0KfX0AdHRhYw==


----boundary-LibPST-iamunique-1424365729_-_---
Received on Mon Feb 07 2005 - 12:59:29 UTC

This archive was generated by hypermail 2.3.0 : Thu Sep 26 2013 - 06:28:25 UTC