Announcement

Collapse
No announcement yet.

Switching off DevModePerUser printer

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Switching off DevModePerUser printer

    I have a general question to windows OS handling with printers:
    My cad/cam software does generally not use printer driver data but reads instead hardware data directly from printers, because for cutting purposes and exact printing I have to consider the real capabilities of the hardware.
    So, the hardware data are used instead of the driver's data. When using a printer with cad, I only have to deny access to the "DevModePerUser" data an replace these data by hardware data, but not with an entry in registry.
    This method is running without problems so far.
    With to following code I simply delete the "DevModePerUser" of that printer in registry:
    Code:
    'Eintrag des UserMode-Druckers in "DevModePerUser" vor dem Drucken entfernen. (Delete User mode printer entry in Registry for the current printer)
    'Der Windows Usermode-Treiber erzeugt hier falsche Werte für Mcadd. (Comes in conflict with MechaniCAD values read from printer hardware.)
    'Nach dem Drucken setzt das Betriebssystem den UserMode-Eintrag zurück. (After print is done, the OS resets the user mode.)
    ReDim sValueArray(0) As String 'Arrays für "RegValueEnum" mit 0 indizieren
    ReDim dwRegTypeArray(0) As Dword
    ReDim sDataArray(0) As String
    sVal = RegGetVal(%HKEY_CURRENT_USER, "Software\I B D\MechaniCAD\Main\Print Settings", "Device") 'aktuellen Drucker auslesen (current cad printer)
    lRet = RegValueEnum(%HKEY_CURRENT_USER, "Printers\Settings", sValueArray(), dwValueCount, dwRegTypeArray(), sDataArray())
    For i = 0 To dwValueCount - 1
       If InStr(1, LCase$(sVal), LCase$(sValueArray(i))) Then
          lRet = RegDelVal(%HKEY_CURRENT_USER, "Printers\DevModePerUser", sValueArray(i)) 'aktuellen UserMode Drucker löschen (delete user mode printer entry of cad printer)	   
          Exit For
       End If
    Next i
    Dialog DoEvents
    Now the question:
    There never occured a bug until now by using the above routine.
    My software is user related, and i think i should consider user privileges to edit the registry. I'm not shure if i really have to do so. But I switched the conditions explicitely in registry and didn't find an access restriction. What do You think about it?
    Last edited by norbert doerre; 12 Dec 2008, 04:58 AM.
    Norbert Doerre
Working...
X