+static HGLOBAL wxCreateDevNames(const wxString& driverName, const wxString& printerName, const wxString& portName)
+{
+ HGLOBAL hDev = NULL;
+ // if (!driverName.IsEmpty() && !printerName.IsEmpty() && !portName.IsEmpty())
+ if (driverName.IsEmpty() && printerName.IsEmpty() && portName.IsEmpty())
+ {
+ }
+ else
+ {
+ hDev = GlobalAlloc(GPTR, 4*sizeof(WORD)+
+ driverName.Length() + 1 +
+ printerName.Length() + 1 +
+ portName.Length()+1);
+ LPDEVNAMES lpDev = (LPDEVNAMES)GlobalLock(hDev);
+ lpDev->wDriverOffset = sizeof(WORD)*4;
+ wxStrcpy((wxChar*)lpDev + lpDev->wDriverOffset, driverName);
+
+ lpDev->wDeviceOffset = (WORD)(lpDev->wDriverOffset + driverName.Length()+1);
+ wxStrcpy((wxChar*)lpDev + lpDev->wDeviceOffset, printerName);
+
+ lpDev->wOutputOffset = (WORD)(lpDev->wDeviceOffset + printerName.Length()+1);
+ wxStrcpy((wxChar*)lpDev + lpDev->wOutputOffset, portName);
+
+ lpDev->wDefault = 0;
+
+ GlobalUnlock(hDev);
+ }
+ return hDev;
+}
+