Página 1 de 1

GUID

MensagemEnviado: 09 Set 2008 10:42
por leandrosilva
Pessoal alguem sabe como faço para procurar uma GUID nos registros?

MensagemEnviado: 09 Set 2008 12:22
por joao
Primeira vez que vejo isso, mas vamos ver se posso lhe ajudar:

Da wikipedia:
A Globally Unique Identifier or GUID (pronounced /ˈguːɪd/ or /ˈgwɪd/) is a special type of identifier used in software applications in order to provide a reference number which is unique in any context (hence, "Globally"), for example, in defining the internal reference for a type of access point in a software application, or for creating unique keys in a database. While each generated GUID is not guaranteed to be unique, the total number of unique keys (2128 or 3.4×1038) is so large that the probability of the same number being generated twice is very small. For example, consider the observable universe, which contains about 5×1022 stars; every star could then have 6.8×1015 universally unique GUIDs.

The term GUID usually refers to Microsoft's implementation of the Universally Unique Identifier (UUID) standard. Many systems use the term GUID, however, including Oracle Database, MySQL, dBase, OpenView Operations, ISIS Papyrus, and Novell eDirectory. The GUID is also the basis of the GUID Partition Table, Intel's replacement for Master Boot Records under EFI.


Então eu entendi que você apenas precisa pegar uma chave do registro. Correto?

Se sim, vc provavelmente vai usar essa classe do windows:
http://msdn.microsoft.com/en-us/library/xka57xy4(VS.80).aspx

Ela é feita para acessar o registro! :)

Esse é um exemplo que eu achei:

Código: Selecionar todos
HKEY m_hKey; // create a HKEY
CRegKey key; // create a CRegKey
char *szValue; // pointer to receive the
DWORD *pdwCount; // to get the buffer length

CString keyVal = "defaultvalue";

if( key.Open(m_hKey, "HKEY_LOCAL_MACHINE\\Software\\GSAT\\QuotaMan", KEY_READ) == ERROR_SUCCESS) // open the key
{
  if(key.QueryValue( szValue, "keyVal", pdwCount )) // see if there is a value
  {
    keyVal=szValue; // if there is, set the variable
    Log( "Got keyVal = " + szValue ); // just a function to write output to a text file
  }
  key.Close();
}


Já que você quer achar um valor provavelmente vai precisar usar este método -->CRegKey::QueryStringValue

Não esqueça de adicionar as bibliotecas necessárias para linkar! Você pode achar isso provavelmente no MSDN.

[]'s

MensagemEnviado: 09 Set 2008 16:49
por leandrosilva
é que ainda não consegui encontrar uma forma de achar o numero da porta serial usada pelo dispositivo bluetooth e me parece que nesse GUID tem algumas informações

MensagemEnviado: 09 Set 2008 18:12
por joao
Mas eu lhe passei um código que teoricamente era para funcionar para achar a porta do bluetooth...
Não funcionou?
Qual erro você recebeu?

Acho que vc deveria ter continuado aquela discussão ao invéz de abrir uma nova...

De qualquer maneira, tenta pegar esse dado via registro e se funcionar, compartilha com o pessoal!

[]'s

MensagemEnviado: 09 Set 2008 20:02
por leandrosilva
eu compilei o codigo que vc me passou, ele recebe como parametro o endereço do bluetooth que quer achar a porta teoricamente é o que eu estou precisando só que quando eu executo com o endereço do meu bluetooth ele não acha nenhuma porta relacionada. Era para funcionar com qualquer aparelho bluetooth nem?
Via registro ainda não encontrei nenhuma pasta ou parametro padrão pra poder procurar, pois muda de um pc para outro.