Login

Esqueci minha senha

Buscar
 
 

Resultados por :
 


Rechercher Busca avançada

Quem está conectado
5 usuários online :: Nenhum usuário registrado, Nenhum Invisível e 5 Visitantes :: 2 Motores de busca

Nenhum

[ Ver toda a lista ]


O recorde de usuários online foi de 71 em 19/7/2010, 11:47
Brasília
Estamos no Twitter
Nossa Comunidade
Nosso Grupo
Últimos assuntos
Top dos mais postadores
Marcos Guedes
 
hugo
 
alceu11
 
Julio
 
marcelofazan
 
mfelis
 
cabeludo
 
Tales Ruan
 
Nelson Arcas
 
marcio
 

Contagem Regressiva em tela de login

16/7/2010, 11:10 por Linghston

Ola amigos, esta é minha primeira participação neste forum e espero poder encontar aqui ajuda para ...

Comentários: 15

Gerador randomico de chave/senha VFP

28/7/2010, 10:44 por hugo

[Você precisa estar registrado e conectado para ver esta imagem.]

Creditos, codi...

Comentários: 22

Help do VFP 9 desapareceu

13/7/2010, 09:22 por hugo

Galera

tenho o visual foxpro instalado e o help funcionava legal

tenho tam...

Comentários: 26

Niver do Alceu

23/7/2010, 14:42 por Marcos Guedes

Aew, pessoal!!!
Para quem não sabe, dia 30/07 é niver do Alceu!!!

Só não irei diz...

Comentários: 32

Report com comandos de impressão @ SAY

30/7/2010, 10:49 por Julio

Novamente aqui, para esclarecer uma duvida.

Tenho um report que serve como formulario, ...

Comentários: 29

Estatísticas
Temos 926 usuários registrados
O último usuário registrado atende pelo nome de Maria Tognetti

Os nossos membros postaram um total de 8596 mensagens em 1239 assuntos

WSH para ler, gravar e excluir chaves do registro

Novo Tópico   Responder ao tópico

Ver o tópico anterior Ver o tópico seguinte Ir em baixo

Anexo WSH para ler, gravar e excluir chaves do registro

Mensagem por Marcos Guedes em 12/3/2010, 13:45

Código:
WSHShell = CreateObject("WScript.Shell")


*!* Create Registry Keys
Código:
WSHShell.Popup( "Create key HKCU\MyRegKey with value 'Top level key'")
WSHShell.RegWrite( "HKCU\MyRegKey\", "Top level key")
 
WSHShell.Popup( "Create key HKCU\MyRegKey\Entry with value 'Second level key'")
WSHShell.RegWrite( "HKCU\MyRegKey\Entry\", "Second level key")
 
WSHShell.Popup( "Set value HKCU\MyRegKey\Value to REG_SZ 1")
WSHShell.RegWrite ("HKCU\MyRegKey\Value", 1)
 
WSHShell.Popup( "Set value HKCU\MyRegKey\Entry to REG_DWORD 2")
WSHShell.RegWrite( "HKCU\MyRegKey\Entry", 2, "REG_DWORD")
 
WSHShell.Popup( "Set value HKCU\MyRegKey\Entry\Value1 to REG_BINARY 3")
WSHShell.RegWrite( "HKCU\MyRegKey\Entry\Value1", 3, "REG_BINARY")


*!* Read Registry Keys
Código:
lcValue1 = WSHShell.RegRead("HKCU\MyRegKey\")
WSHShell.Popup("Value of HKCU\MyRegKey: " + lcValue1)
 
lcValue2 = WSHShell.RegRead("HKCU\MyRegKey\Entry\")
WSHShell.Popup("Value of HKCU\MyRegKey\Entry\: " + lcValue2)
 
lcValue3 = WSHShell.RegRead("HKCU\MyRegKey\Value")
WSHShell.Popup("Value of HKCU\MyRegKey\Value: " + lcValue3)
 
lnValue1 = WSHShell.RegRead("HKCU\MyRegKey\Entry")
WSHShell.Popup("Value of HKCU\MyRegKey\Entry: " + ALLTRIM(STR(lnValue1)))
 
lnValue3 = WSHShell.RegRead("HKCU\MyRegKey\Entry\Value1")
WSHShell.Popup("Value of HKCU\MyRegKey\Entry\Value1: " + ALLTRIM(STR(lnValue3(1))))


*!* Delete Registry Keys
Código:
WSHShell.Popup( "Delete value HKCU\MyRegKey\Entry\Value1")
WSHShell.RegDelete( "HKCU\MyRegKey\Entry\Value1")
 
WSHShell.Popup ("Delete key HKCU\MyRegKey\Entry")
WSHShell.RegDelete( "HKCU\MyRegKey\Entry\")
 
WSHShell.Popup ("Delete key HKCU\MyRegKey")
WSHShell.RegDelete( "HKCU\MyRegKey\")


Fonte:
[Você precisa estar registrado e conectado para ver este link.]

_________________
Marcos Guedes - Programador e desenvolvedor Web.

Convidado, seja nosso seguidor no Twitter:
twitter.com/programacaobras

Marcos Guedes
Webmaster
Webmaster


Ver perfil do usuário

Voltar ao Topo Ir em baixo

Anexo Re: WSH para ler, gravar e excluir chaves do registro

Mensagem por hugo em 12/3/2010, 14:36

muito bom

_________________
A lingua é o chicote do corpo! Minhas feridas ainda doem!

hugo
Usuário 5 Estrelas
Usuário 5 Estrelas


Ver perfil do usuário

Voltar ao Topo Ir em baixo

Anexo Re: WSH para ler, gravar e excluir chaves do registro

Mensagem por djguina em 6/5/2010, 09:39

Uma dúvida...

E se eu não tiver a Chave de Registro? pra mim apresenta um erro... como perguntar pro meu sistema se existe essa chave?


Código:

OLE IDispatch exception code 0 from WshShell.RegRead: Raiz Inválida na chave de Registro "Minha chave"...

djguina
Começando a Participar
Começando a Participar


Ver perfil do usuário

Voltar ao Topo Ir em baixo

Anexo Re: WSH para ler, gravar e excluir chaves do registro

Mensagem por Marcos Guedes em 6/5/2010, 12:04

Veja se este código ajuda:
Código:
LOCAL lcversion
lcversion = "7.0"

PUBLIC goapp
goapp = CREATEOBJECT('capp')
MESSAGEBOX(goapp.readreg('HLM','Software\Microsoft\VisualFoxpro\' + lcversion +;
   '\Registration','ProductID'))
goapp = null

DEFINE CLASS capp AS CONTAINER

   *-- Reads the windows Registry.
   PROCEDURE readreg
      * Start of Code
      LPARAMETERS tckey,tcsubkey,tcvalue
      IF PCOUNT() = 2
         tcvalue = ""
      ENDIF

      * setup environment

      LOCAL nkey, csubkey, cvalue,  cvalueread

      #DEFINE hkey_users                  -2147483645
      #DEFINE hkey_local_machine          -2147483646
      #DEFINE hkey_current_user          -2147483647
      #DEFINE hkey_classes_root            -2147483648

      DO CASE
         CASE m.tckey == "HCR"
            nkey = hkey_classes_root
         CASE m.tckey == "HLM"
            nkey = hkey_local_machine
         CASE m.tckey = "HCU"
            nkey = hkey_current_user
         CASE m.tckey = "HCR"
            nkey = hkey_classes_root
         OTHERWISE
            nkey = m.tckey
      ENDCASE

      csubkey = m.tcsubkey
      cvalue  = m.tcvalue

      * example 1
      * nKey = HKEY_LOCAL_MACHINE
      * cSubKey = "Software\VfpRegTest"
      * cValue = "TestREG_SZ"

      * example 2
      * nKey = HKEY_CLASSES_ROOT
      * cSubKey = "Spin.SpinButton\CLSID"
      * cValue = ""


      * here is where we will actually read the registry
      cvalueread = THIS.readreg_sz(nkey, csubkey, cvalue)

      IF (EMPTY(cvalueread)) THEN
         cvalueread = "REGISTRY KEY NOT FOUND"
         * MESSAGEBOX("Function Not Successful.")  && testing only
      ELSE
         * MESSAGEBOX("Function Successful.    " + cValueRead)  && testing only
      ENDIF

      RETURN cvalueread
   ENDPROC


   *-- API's used by the ReadReg method.
   PROCEDURE readreg_sz
      * This function reads a REG_SZ value from the registry. If successful,
      * it will return the value read. If not successful, it will return an empty string.

      PARAMETERS  nkey, csubkey, cvalue
      * nKey The root key to open. It can be any of the constants defined below.
      *  #DEFINE HKEY_CLASSES_ROOT          -2147483648
      *  #DEFINE HKEY_CURRENT_USER          -2147483647
      *  #DEFINE HKEY_LOCAL_MACHINE          -2147483646
      *  #DEFINE HKEY_USERS                  -2147483645
      * cSubKey The SubKey to open.
      * cValue The value that is going to be read.

      * Constants that are needed for Registry functions
      #DEFINE reg_sz  1

      * WIN 32 API functions that are used
      DECLARE INTEGER RegOpenKey IN Win32API ;
         INTEGER nHKey, STRING @cSubKey, INTEGER @nResult
      DECLARE INTEGER RegQueryValueEx IN Win32API ;
         INTEGER nHKey, STRING lpszValueName, INTEGER dwReserved,;
         INTEGER @lpdwType, STRING @lpbData, INTEGER @lpcbData
      DECLARE INTEGER RegCloseKey IN Win32API INTEGER nHKey

      * Local variables used
      LOCAL nerrcode      && Error Code returned from Registry functions
      LOCAL nkeyhandle    && Handle to Key that is opened in the Registry
      LOCAL lpdwvaluetype && Type of Value that we are looking for
      LOCAL lpbvalue      && The data stored in the value
      LOCAL lpcbvaluesize && Size of the variable
      LOCAL lpdwreserved  && Reserved Must be 0

      * Initialize the variables
      nkeyhandle = 0
      lpdwreserved = 0
      lpdwvaluetype = reg_sz
      lpbvalue = ""

      nerrcode = regopenkey(nkey, csubkey, @nkeyhandle)
      * If the error code isn't 0, then the key doesn't exist or can't be opened.
      IF (nerrcode # 0) THEN
         RETURN ""
      ENDIF

      lpcbvaluesize = 1
      * Get the size of the data in the value
      nerrcode=regqueryvalueex(nkeyhandle, cvalue, lpdwreserved, @lpdwvaluetype, @lpbvalue, @lpcbvaluesize)

      * Make the buffer big enough
      lpbvalue = SPACE(lpcbvaluesize)
      nerrcode=regqueryvalueex(nkeyhandle, cvalue, lpdwreserved, @lpdwvaluetype, @lpbvalue, @lpcbvaluesize)

      =regclosekey(nkeyhandle)
      IF (nerrcode # 0) THEN
         RETURN ""
      ENDIF

      lpbvalue = LEFT(lpbvalue, lpcbvaluesize - 1)
      RETURN lpbvalue
   ENDPROC


ENDDEFINE

Fonte:
- [Você precisa estar registrado e conectado para ver este link.]

_________________
Marcos Guedes - Programador e desenvolvedor Web.

Convidado, seja nosso seguidor no Twitter:
twitter.com/programacaobras

Marcos Guedes
Webmaster
Webmaster


Ver perfil do usuário

Voltar ao Topo Ir em baixo

Ver o tópico anterior Ver o tópico seguinte Voltar ao Topo


Permissão deste fórum:
Você não pode responder aos tópicos neste fórum