[Top Page][All Pages][Recent Changes]

Edit History:Diff

Changes of UUID生成 since 2015/09/11 21:41:21 JST

  • + added lines
  • - deleted lines

Return to the edit history

  ** UUIDとは
  世界に一つだけの値です。ほとんど被ることのない文字列です。
  
  win32apiのRpcrt4.dllを使用しています。
  Windows2000以降で動作します。
  
  ** uuid.hsp
  {{{
  #ifndef __UUID__
  #define __UUID__
  
  #uselib "Rpcrt4.dll"
  #func global UuidCreate "UuidCreate" sptr
  #func global UuidToString "UuidToStringA" sptr, sptr
  #func global RpcStringFree "RpcStringFreeA" sptr
  
  #module uuid
  
  #defcfunc uuid_new
  
+ 	sdim guid,   4+2+2+1*8
- 	sdim uuid,   4+2+2+1*8
  	sdim string, 39
  	
  	result = 0
  
+ 	UuidCreate   varptr(guid)
+ 	UuidToString varptr(guid), varptr(result)
- 	UuidCreate   varptr(uuid)
- 	UuidToString varptr(uuid), varptr(result)
  	
  	dupptr orig, result, 39, 2
  	
  	repeat 39
  	
  		poke string, cnt, peek(orig, cnt)
  	
  	loop
  	
  	RpcStringFree varptr(result)
  	
  return string
  
  #global
  
  #endif
  
  // サンプル
  mes uuid_new()
  }}}
+ 
+ ** 更新履歴
+ 2015/9/12 名前の衝突を修正