Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.clipper.visual-objects > #6858 > unrolled thread
| Started by | Sherlock <sherlock@sherlock.com.au> |
|---|---|
| First post | 2014-05-18 16:43 -0700 |
| Last post | 2014-05-21 18:08 +0000 |
| Articles | 5 — 3 participants |
Back to article view | Back to comp.lang.clipper.visual-objects
cDeviceName _WINDEVMODE update printer name BYTE ARRAY Sherlock <sherlock@sherlock.com.au> - 2014-05-18 16:43 -0700
Re: cDeviceName _WINDEVMODE update printer name BYTE ARRAY "Urs Eggmann" <Urs.Eggmann@shinternet.ch> - 2014-05-19 12:26 +0200
Re: cDeviceName _WINDEVMODE update printer name BYTE ARRAY Sherlock <sherlock@sherlock.com.au> - 2014-05-19 07:04 -0700
Re: cDeviceName _WINDEVMODE update printer name BYTE ARRAY "Uwe Heyer" <uwe.heyer@aristik.de> - 2014-05-21 17:28 +0000
Re: cDeviceName _WINDEVMODE update printer name BYTE ARRAY "Uwe Heyer" <uwe.heyer@aristik.de> - 2014-05-21 18:08 +0000
| From | Sherlock <sherlock@sherlock.com.au> |
|---|---|
| Date | 2014-05-18 16:43 -0700 |
| Subject | cDeviceName _WINDEVMODE update printer name BYTE ARRAY |
| Message-ID | <314b509e-bd05-40ce-a0f3-3327e750f6b1@googlegroups.com> |
Hi LOCAL structDevMode AS _WINDEVMODE structDevMode := SELF:oPrinter:oPRNDev:GetDevMode() FOR xx := 1 TO CCHDEVICENAME cDeviceName += CHR(structDevMode.dmDevicename[xx]) NEXT // Lets say cDeviceName = "BullZIP printer" If I wanted to change the name to "HP printer" how would I convert/ write this printer name which is a string to BYTE ARRAY structDevMode.dmDevicename := ???? SELF:oPrinter:oPRNDev:UpdateDevMode() Thanks in advance.. Phil
[toc] | [next] | [standalone]
| From | "Urs Eggmann" <Urs.Eggmann@shinternet.ch> |
|---|---|
| Date | 2014-05-19 12:26 +0200 |
| Message-ID | <btu4jaF50jsU1@mid.individual.net> |
| In reply to | #6858 |
Hi Phil,
If the German comments are a problem, let me know, I'll translate.
On the homepge www.voug-bodensee.net under Downloads - Drucker.zip you can
find a demo App.
regards
Urs
METHOD FilePrinterSetup() CLASS AppShell
LOCAL structDevMode AS _WINDEVMODE
LOCAL nZaehler AS DWORD
LOCAL cDruckerName AS STRING
cDruckerName := goIniFile:GetString ("SETTINGS" , "DRUCKER")
// Der Name des Druckers wird aus der INI geholt. Ist der String leer oder
ungültig,
// wird im oPrintingDevice:SetUp() der Standarddrucker angeboten.
structDevMode := SELF:oPrintingDevice:GetDevMode() // Die Struktur DevMode
holen
// Das eigentliche Kernstück. Im ersten Element der Struktur DevMode wird
der Name "eingefüllt"
FOR nZaehler = 1 TO CCHDEVICENAME
structDevMode.dmDeviceName[nZaehler] := Asc( SubStr(cDruckerName , nZaehler
, 1 ) )
NEXT nZaehler
// Mit dieser modifizierten Struktur wird nun der SetUp-Dialog geöffnet.
IF SELF:oPrintingDevice:Setup()
goIniFile:WriteString("SETTINGS" , "DRUCKER" , SELF:oPrintingDevice:Device )
goIniFile:WriteInt("SETTINGS" , "PAPIERFACH" ,
structDevMode.dmDefaultSource )
goIniFile:WriteInt("SETTINGS" , "PAPIERFORMAT" , structDevMode.dmPaperSize )
ENDIF
RETURN NIL
"Sherlock" <sherlock@sherlock.com.au> schrieb im Newsbeitrag
news:314b509e-bd05-40ce-a0f3-3327e750f6b1@googlegroups.com...
> Hi
>
> LOCAL structDevMode AS _WINDEVMODE
>
> structDevMode := SELF:oPrinter:oPRNDev:GetDevMode()
> FOR xx := 1 TO CCHDEVICENAME
> cDeviceName += CHR(structDevMode.dmDevicename[xx])
> NEXT
> // Lets say cDeviceName = "BullZIP printer"
>
> If I wanted to change the name to "HP printer" how would I convert/ write
> this printer name which is a string to BYTE ARRAY
>
>
> structDevMode.dmDevicename := ????
>
>
> SELF:oPrinter:oPRNDev:UpdateDevMode()
>
>
> Thanks in advance..
>
> Phil
[toc] | [prev] | [next] | [standalone]
| From | Sherlock <sherlock@sherlock.com.au> |
|---|---|
| Date | 2014-05-19 07:04 -0700 |
| Message-ID | <adc42808-2870-4ee3-9123-079f361fe9c4@googlegroups.com> |
| In reply to | #6861 |
Urs Thanks German comments I am good with. When I left home at 18 I lived with German people in Australia for 3 years and have been to Germany. I know when I read it I used the CHR() to get the string and I through abotu the ASC() the opposite but I thought you might get the string and do some Multibtyte write or some.. so it the Substr() Asc and put back in the Strucure and dmDevicename. Ok I will give it a shot. Thanks Phil ==== Drucker = Printer FOR xx = 1 TO CCHDEVICENAME structDevMode.dmDeviceName[xx] := Asc( SubStr(cPrinterName,xx,1)) NEXT
[toc] | [prev] | [next] | [standalone]
| From | "Uwe Heyer" <uwe.heyer@aristik.de> |
|---|---|
| Date | 2014-05-21 17:28 +0000 |
| Subject | Re: cDeviceName _WINDEVMODE update printer name BYTE ARRAY |
| Message-ID | <bu4622Fe0gcU1@mid.individual.net> |
| In reply to | #6863 |
Hi Phil, you could try something like sPrinter := "HP LaserJet 2200" dwLen := SLen( sPrinter ) + 1 if dwLen <= CCHDEVICENAME // don't write behind EOT dmDeviceName[32] MemCopy( @structDevMode.dmDevicename[1], PSZ(_Cast, sPrinter), dwLen ) or MemCopy( @structDevMode.dmDevicename, PSZ(_Cast, sPrinter), dwLen ) (or some other casting) maybe above is something helpful, I may be wrong Ahoj -Uwe
[toc] | [prev] | [next] | [standalone]
| From | "Uwe Heyer" <uwe.heyer@aristik.de> |
|---|---|
| Date | 2014-05-21 18:08 +0000 |
| Subject | Re: cDeviceName _WINDEVMODE update printer name BYTE ARRAY |
| Message-ID | <bu48d8Feg54U1@mid.individual.net> |
| In reply to | #6881 |
PS.: you need the ptr for dmDeviceName[1]. In your case this ptr is equal (p)structDevMode because dmDeviceName is the first member. Maybe MemCopy( structDevMode.dmDeviceName, .. ) is legal syntax structDevMode.@dmDeviceName ?? For some reason I can't try this code by myself.
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.clipper.visual-objects
csiph-web