Jump to content
Fivewin Brasil

PRNGETPORT()


yasmin

Recommended Posts

Bom dia pessoal, este comando me retorna o caminho da impressora que esta na rede tipo "\\maq_3\epson\lpt1", pois como uso FW192 eu não tenho esta funcão, caso não funcione na versão do fivewin que uso, qual funcao poderia substitui-la.

Marcelo

FW 1.92,Clipper 5.2D,WS

Link to comment
Share on other sites

eu uso esta, veja se te serve.

1) declaro uma variavel para saber qual o sistema operacional utilizaando o SystemInfo.

PUBLIC nSistema:=LEFT(oSystemInfo:WinVer(),12)

2) esta é a função que lê dentro do regedit que impressora está ou não instalada...

FUNCTION aPrinters()

LOCAL aPrinters:= {},oReg

LOCAL oKey,cBuffer:="",nId:=0,cName

IF LEFT(nSistema,10)=="Windows XP" .OR. LEFT(nSistema,12)=="Windows 2000"

oReg:=TReg32():New(HKEY_CURRENT_USER,"Software\Microsoft\Windows NT\CurrentVersion\Windows")

cName:=LEFT(oReg:Get("Device"),AT(",",oReg:Get("Device"))-1)

oReg:Close()

oReg:=TReg32():New(HKEY_LOCAL_MACHINE,"System\CurrentControlSet\Control\Print\Printers")

while RegEnumKeys(oReg:nHandle,nId++,@cBuffer )==0

oKey:=TReg32():New(HKEY_LOCAL_MACHINE,"System\CurrentControlSet\Control\Print\Printers\"+cBuffer)

aAdd(aPrinters,{oKey:Get("Name"),oKey:Get("Port"),cName==oKey:Get("Name")})

oKey:Close()

END

oReg:Close()

FOR i:=1 TO LEN(aPrinters)

IF aPrinters[i,3]

cPorta:=aPrinters[i,2]

cName:=aPrinters[i,1] ; EXIT

END

NEXT

ELSE

oReg:=TReg32():New(HKEY_LOCAL_MACHINE,"Config\0001\System\CurrentControlSet\Control\Print\Printers")

cName:=ALLTRIM(oReg:Get("Default"))

oReg:Close()

oReg:=TReg32():New(HKEY_LOCAL_MACHINE,"System\CurrentControlSet\Control\Print\Printers")

while RegEnumKeys(oReg:nHandle,nId++,@cBuffer )==0

oKey:=TReg32():New(HKEY_LOCAL_MACHINE,"System\CurrentControlSet\Control\Print\Printers\"+cBuffer)

aAdd(aPrinters,{oKey:Get("Name"),oKey:Get("Port"),cName==oKey:Get("Name")})

oKey:Close()

END

oReg:Close()

FOR i:=1 TO LEN(aPrinters)

IF aPrinters[i,3]

cPorta:=aPrinters[i,2]

cName:=aPrinters[i,1] ; EXIT

END

NEXT

END

IF(EMPTY(cName),cName:="Sem Impressora",)

RETURN(cName)

espero que ajude...

Um Grande Abraço

Alessandro F. Silvaid=blue>

E-mail :aferracini@terra.com.br

FW2.0d + CL53b + Blinker 7.0 + @Say @Get + CDX

MSN: ferracini_silva@hotmail.com

Ribeirão Preto/SP

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...