Re: NewEra 2.2/Crystal Reports Query
Posted in 1999
Topics: General Discussion
llarian@my-deja.com wrote: > > Hi, > > I am currently developing an application using > INFORMIX-NewEra v2.2 and am trying to use the > Crystal ver 5.0 NewEra Class Library. I managed > to get it to work, but I need to have the ability > to choose a printer. Hi there :> I dont understand your comments about C++. It all can be done using the Windows API. I wrote the following procedure for printer selection: FUNCTION cr_select_printer_dialog(thejob CRPEJob, parentwin ixWindow) RETURNING BOOLEAN VARIABLE thehand, succ SMALLINT, ok BOOLEAN BEGIN_C HWND hparentwin; HWND __getHWndFromixWindow(struct ixWindow*); PRINTDLG pd; LPDEVNAMES lpDevNames; LPDEVMODE lpDevMode; LPSTR lpszDriverName,lpszDeviceName,lpszPortName; END_C LET thehand=thejob.getjobhandle() LET succ = 0 BEGIN_C hparentwin=__getHWndFromixWindow(parentwin); memset(&pd, 0, sizeof(PRINTDLG)); pd.lStructSize = sizeof(PRINTDLG); pd.hwndOwner = hparentwin; pd.Flags = PD_PRINTSETUP; if (PrintDlg(&pd) != 0) { succ=1; lpDevNames = (LPDEVNAMES)GlobalLock(pd.hDevNames); lpDevMode = (LPDEVMODE)GlobalLock(pd.hDevMode); lpszDriverName = (LPSTR)lpDevNames + lpDevNames->wDriverOffset; lpszDeviceName = (LPSTR)lpDevNames + lpDevNames->wDeviceOffset; lpszPortName = (LPSTR)lpDevNames + lpDevNames->wOutputOffset; PESelectPrinter (thehand, lpszDriverName, lpszDeviceName, lpszPortName, lpDevMode); GlobalUnlock(pd.hDevNames); GlobalUnlock(pd.hDevMode); } END_C IF succ=1 THEN RETURN TRUE ELSE RETURN FALSE END IF RETURN TRUE END FUNCTION As you can see it executes the Windows select printer dialog and attaches the selected printer to the CR print job. Hope this helps. Dirk -- -- Dirk Gunsthoevel phone: +49 (0)251 624947 -- Hoeftestr.49 fax: +49 (0)251 624177 -- 48167 Muenster mobile: +49 (0)170 5464715 -- Germany http://www.killerbunny.de
In article <810seu$22r$1@news.xmission.com>, Dirk Gunsthoevel <gunstho@uni-muenster.de> wrote: > > Hi there :> > I dont understand your comments about C++. It all > can be done using the Windows API. > I wrote the following procedure for printer > selection: Hi, Thank you for the help. I actually managed to figure it out last week; I was overcomplicating things. This is the first time I've integrated C code into NewEra, so it took a few tries to sort things out.. Anna :) Sent via Deja.com http://www.deja.com/ Before you buy.