|
Thanks Mike and Scott. I've made a couple changes. After a lot of mucking around, I'm now getting an InvalidArg error and I wonder if it's the value of nStartPage. It's telling me that if should be START_PAGE_GENERAL if I don't have an array defined... Yet I can't find what the value of START_PAGE_GENERAL is in order to define it. What I know: My active window handle is valid. My code so far: D PrintDialogDS DS Based( pPrintDialogDS ) Qualified D lStructSize 10u 0 D hWndOwner 10u 0 D hDevMode 10u 0 D hDevNames 10u 0 D hDC 10u 0 D Flags 10u 0 D Flags2 10u 0 D ExclusionFlags... D 10u 0 D nPageRanges 10u 0 D nMaxPageRanges... D 10u 0 D lpPageRanges * D nMinPage 10u 0 D nMaxPage 10u 0 D nCopies 10u 0 D hInstance 10u 0 D lpPrintTemplateName... D * D lpCallBack * D nPropertyPages... D 10u 0 D lphPropertyPages... D * D nStartPage 10u 0 D dwResultAction... D 10u 0 // Windows API Constants D PD_RETURNDC C x'00000100' // Global Variables D gResult S 10i 0 // Display the Print Dialog Window D DspPrintDialog PR 10i 0 ExtProc('PrintDlgExA') D dll('comdlg32.dll') D LinkAge(*StdCall) D pPrintDS * Value // Display the Print Dialog Box pPrintDialogDS = %alloc( %size( PrintDialogDS ) ); PrintDialogDS.hWndOwner = GetForeWdw(); PrintDialogDS.lStructSize = %size( PrintDialogDS ); PrintDialogDS.hDevNames = x'00'; PrintDialogDS.hDevMode = x'00'; PrintDialogDS.hDC = x'00'; PrintDialogDS.Flags = PD_RETURNDC; PrintDialogDS.Flags2 = 0; PrintDialogDS.ExclusionFlags = 0; PrintDialogDS.nPageRanges = 0; PrintDialogDS.nMaxPageRanges = 0; PrintDialogDS.lpPageRanges = *Null; PrintDialogDS.nMinPage = 1; PrintDialogDS.nMaxPage = 1000; PrintDialogDS.nCopies = 1; PrintDialogDS.hInstance = 0; PrintDialogDS.lpPrintTemplateName = *Null; PrintDialogDS.lpCallBack = *Null; PrintDialogDS.nPropertyPages = 0; PrintDialogDS.lphPropertyPages = *Null; PrintDialogDS.nStartPage = 0; // I've also tried this with a 1 PrintDialogDS.dwResultAction = 0; gResult = DspPrintDialog( pPrintDialogDS ); This has been a learning experience. I appreciate all the help. Kurt Anderson Application Developer Highsmith Inc -----Original Message----- From: wdsci-l-bounces@xxxxxxxxxxxx [mailto:wdsci-l-bounces@xxxxxxxxxxxx] On Behalf Of Scott Klement Sent: Thursday, March 29, 2007 4:04 AM To: Websphere Development Studio Client for iSeries Subject: Re: [WDSCI-L] VARPG Window API call - PrintDlgEx 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 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.