More ... | UUID生成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 string, 39
result = 0
UuidCreate varptr(guid)
UuidToString varptr(guid), 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 名前の衝突を修正 |