× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Hi Kurt,

      *  Display the Print Dialog Window
     D PrintDlgEx      PR            10u 0 ExtProc('PrintDlgEx')
     D                                     dll('comdlg32.dll')
     D                                     LinkAge(*StdCall)
     D  pPrintDS                       *   Value

Hmmm.. I haven't written anything in VARPG, but I've used this function from a C program, and I'm pretty familiar with ILE RPG, so I'll take a stab at it...

In Windows, there are two versions of most functions in the WIN32 API. There's a normal ASCII version, and there's a "wide character" (Unicode) version of each API. In the C include files, you'd see something like this:

#if (WINVER >= 0x0500)
HRESULT WINAPI PrintDlgExA(LPPRINTDLGEXA);
HRESULT WINAPI PrintDlgExW(LPPRINTDLGEXW);
#ifdef UNICODE
typedef PRINTDLGEXW PRINTDLGEX, *LPPRINTDLGEX;
#define PrintDlgEx PrintDlgExW
#else
typedef PRINTDLGEXA PRINTDLGEX, *LPPRINTDLGEX;
#define PrintDlgEx PrintDlgExA
#endif
#endif

Not sure if you understand C or not, but this basically maps any call to PrintDlgEx so that it calls PrintDlgExW or PrintDlgExA, depending on whether UNICODE is defined. It also maps the data type of the parameter, accordingly.

To do the same thing in RPG (Assuming that VARPG syntax is the same as ILE), you'd want to code something like this:


       *  Display the Print Dialog Window
       /if defined(UNICODE)
      D PrintDlgEx      PR            10i 0 ExtProc('PrintDlgExW')
      D                                     dll('comdlg32.dll')
      D                                     LinkAge(*StdCall)
      D  pPrintDS                           likeds(PRINTDLGEXW)
       /else
      D PrintDlgEx      PR            10i 0 ExtProc('PrintDlgExA')
      D                                     dll('comdlg32.dll')
      D                                     LinkAge(*StdCall)
      D  pPrintDS                           likeds(PRINTDLGEXA)
       /endif

Naturally, you'd have to define the PRINTDLGEXW and PRINTDLGEXA data structures as well.

Also note that I changed the return values from your definition of "10u 0" to "10i 0". I did this because HRESULT is supposed to be a signed integer, at least, in C, I have this definition:

#ifndef _HRESULT_DEFINED
typedef long HRESULT;
#define _HRESULT_DEFINED
#endif

As you can see, HRESULT is defined as long, which is a 32-bit signed integer (same as 10i 0 in RPG!)

Hope that helps...

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.