Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Printer settings at run-time
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Gestionnaire de rapports & Rapports
Divers
Thread ID:
00189772
Message ID:
00189825
Vues:
12
>Hi Walter,
>
>I was going to respond on the original thread after doing some research, but thanks for posting this as a reminder for me.
>
>There's one alternative that Ed didn't mention. I'm not sure if it's going to do the job you want, and it will take some work.
>
>The DEVMODE structure that Ed mentioned is stored in the registry under HKEY_LOCAL_MACHINE\System\CurrentControlSet\control\Print\Printers\< Printer Name >. That last entry, of course, represents the printer name. Under that there's an entry named DefaultDevmode. What you could do is change the value and call SYS(3056) to force VFP to re-read the registry settings.
>
>The only problem that may exist here is reading and writing the key. The Registry.prg (Registry.vcx in 6.0) can read it, but is only set up to write string, and the value stored is in binary format. You'd either have to modify that program or find another utility to do it. I think that Rick Strahl has a registry utility posted in the files section here. Since I've never used it I can't say right away whether or not it can deal with binary keys. If it is Rick's work, I'd bet that it probably does. If it isn't, my apologies to the author for forgetting who posted it.
>

The Registry class in the FFC can't, but writing a binary key is not difficult at all. The following assumes that you've already opened the registry key with RegOpenKey() (the FFC class will do this quite adequately), and that the hkey returned from RegOpenKey() is in the numeric variable hKey. The name of the registry value to write is in the string variable cValueName, and the exact binary value to write is in the string cOutBuff:
DECLARE INTEGER RegSetValueEx IN Win32API ;
 INTEGER nKeyHandle, ;
 STRING  cValueName, ;
 INTEGER nReserved, ;
 INTEGER nType, ;
 STRING  cBuffer, ;
 INTEGER nBufferSize

#define REG_BINARY          3  && Free form binary
#define REG_OPTION_RESERVED 0  && Parameter is reserved

nResult = RegSetValueEx(hkey, ;
			cValueName, ;
			REG_OPTION_RESERVED, ;
			REG_BINARY, ;
			cOutBuff, ;
			LEN(cOutBuff) )
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform