+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 ) * sizeof(wxChar) );
+ LPDEVNAMES lpDev = (LPDEVNAMES)GlobalLock(hDev);
+ lpDev->wDriverOffset = sizeof(WORD)*4;
+ wxStrcpy((wxChar*)((char*)lpDev + lpDev->wDriverOffset ), driverName);
+
+ lpDev->wDeviceOffset = (WORD)( lpDev->wDriverOffset +
+ sizeof(wxChar) * ( driverName.Length() + 1 ) );
+ wxStrcpy((wxChar*)((char*)lpDev + lpDev->wDeviceOffset ), printerName);
+
+ lpDev->wOutputOffset = (WORD)( lpDev->wDeviceOffset +
+ sizeof(wxChar) * ( printerName.Length() + 1 ) );
+ wxStrcpy((wxChar*)((char*) lpDev + lpDev->wOutputOffset ), portName);
+
+ lpDev->wDefault = 0;
+
+ GlobalUnlock(hDev);
+ }
+
+ return hDev;
+}
+