欢迎
游客
,
注册
|
登录
|
会员
|
界面
|
简洁版本
|
在线
|
帮助
商都网教育宝典宝库
商都网教育宝典宝库
计算机
软件开发
pb中使用winapi生成唯一的永不重复字符串(UUID)
本主题被查看555次, 共1个帖子, 1页, 当前为第
1
页 选择页数: 1 跳转到第
页
上一主题
下一主题
标题: pb中使用winapi生成唯一的永不重复字符串(UUID)
huahua
-[尕硴]
超级版主
UID: 71
来自:
精华:
130
积分: 14003
帖子: 12909
注册: 2007-10-22 17:59:00
状态:
离线
威望: 444.00
金钱: 3355.00 元
发短消息
用户资料
树型
回复
引用
只看楼主
2008-01-28 16:19
pb中使用winapi生成唯一的永不重复字符串(UUID)
1、定义结构及外部函数
global type uuid from structure
ulong data1
uint data2
uint data3
character data4[8]
end type
Function ulong UuidCreate(ref uuid lpUUID) LIBRARY "rpcrt4"
Function ulong UuidToString (ref uuid lpUUID, ref long lpUUIDString) LIBRARY "rpcrt4" Alias for "UuidToStringA"
Function ulong RpcStringFree(long lpUUIDString) LIBRARY "rpcrt4" Alias for "RpcStringFreeA"
2、函数主体
CONSTANT Long RPC_S_OK = 0
CONSTANT Long RPC_S_UUID_LOCAL_ONLY = 1824
Long ll_rtn
uuid u
ll_rtn = uuidcreate(u) //Create a new UUID
IF ll_rtn = RPC_S_OK OR ll_rtn = RPC_S_UUID_LOCAL_ONLY THEN
Long ll_pointer
String ls_uuid
ll_rtn = UuidToString(u,ll_pointer)
ls_uuid = Upper(String (ll_pointer,"Address")) //Convert it to a string
RpcStringFree(ll_pointer)//Remove the string from the memory
RETURN ls_uuid
ELSE
RETURN ""
END IF
注:发布时候可能需要rpcrt4.dll
附:另外一种生成guid的方法
oleObject PBObject
string ls_GUID
long ll_result
PBObject = CREATE oleObject
ll_result = PBObject.ConnectToNewObject &
("PowerBuilder.Application")
IF ll_result < 0 THEN
messagebox("","连接失败:与PowerBuilder.Application连接出错!")
Destroy PBObject
return ""
ELSE
ll_result = PBObject.GenerateGUID(REF ls_GUID)
END IF
Destroy PBObject
return Mid(ls_GUID,2,len(ls_GUID) - 2)
第二种方法在程序发布时候需要在客户端进行配置:
pbapl80.dll
pbaen80.tlb
rpcrt4.dll
修改注册表如下
Windows Registry Editor Version 5.00
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; PBAPPL.REG
;
; Registration information for PowerBuilder.Application.8
;
; All rights reserved. No portion of this material may be copied in any way
; without prior written consent from Powersoft Corporation.
;
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; Version independent ProgID entries
[HKEY_CLASSES_ROOT\PowerBuilder.Application]
@="PowerBuilder Automation"
[HKEY_CLASSES_ROOT\PowerBuilder.Application\CLSID]
@="{88880001-8888-1000-8000-080009AC61A9}"
[HKEY_CLASSES_ROOT\PowerBuilder.Application\CurVer]
@="PowerBuilder.Application.8"
[HKEY_CLASSES_ROOT\PowerBuilder.Application\NotInsertable]
@=""
; Version specific ProgID entries
[HKEY_CLASSES_ROOT\PowerBuilder.Application.8]
@="PowerBuilder 8.0 Automation"
[HKEY_CLASSES_ROOT\PowerBuilder.Application.8\CLSID]
@="{88880001-8888-1000-8000-080009AC61A9}"
[HKEY_CLASSES_ROOT\PowerBuilder.Application.8\NotInsertable]
@=""
; CLSID entries
[HKEY_CLASSES_ROOT\CLSID\{88880001-8888-1000-8000-080009AC61A9}]
@="PowerBuilder Automation"
[HKEY_CLASSES_ROOT\CLSID\{88880001-8888-1000-8000-080009AC61A9}\InProcServer32]
@="d:\\Program Files\\Sybase\\Shared\\PowerBuilder\\pbvm80.dll"
"ThreadingModel"="Apartment"
[HKEY_CLASSES_ROOT\CLSID\{88880001-8888-1000-8000-080009AC61A9}\NotInsertable]
@=""
[HKEY_CLASSES_ROOT\CLSID\{88880001-8888-1000-8000-080009AC61A9}\ProgID]
@="PowerBuilder.Application.8"
[HKEY_CLASSES_ROOT\CLSID\{88880001-8888-1000-8000-080009AC61A9}\Programmable]
@=""
[HKEY_CLASSES_ROOT\CLSID\{88880001-8888-1000-8000-080009AC61A9}\TypeLib]
@="{88880002-8888-1000-8000-080009AC61A9}"
[HKEY_CLASSES_ROOT\CLSID\{88880001-8888-1000-8000-080009AC61A9}\VersionIndependentProgID]
@="PowerBuilder.Application"
; Type library registration entries
[HKEY_CLASSES_ROOT\TypeLib\{88880002-8888-1000-8000-080009AC61A9}]
[HKEY_CLASSES_ROOT\TypeLib\{88880002-8888-1000-8000-080009AC61A9}\1.0]
@="PowerBuilder Automation Type Library"
[HKEY_CLASSES_ROOT\TypeLib\{88880002-8888-1000-8000-080009AC61A9}\1.0\0]
[HKEY_CLASSES_ROOT\TypeLib\{88880002-8888-1000-8000-080009AC61A9}\1.0\0\Win32]
@="d:\\Program Files\\Sybase\\Shared\\PowerBuilder\\PBAEN80.TLB"
[HKEY_CLASSES_ROOT\TypeLib\{88880002-8888-1000-8000-080009AC61A9}\1.0\9]
[HKEY_CLASSES_ROOT\TypeLib\{88880002-8888-1000-8000-080009AC61A9}\1.0\9\Win32]
@="d:\\Program Files\\Sybase\\Shared\\PowerBuilder\\PBAEN80.TLB"
#1
大
中
小
本主题被查看555次, 共1个帖子, 1页, 当前为第
1
页 选择页数: 1 跳转到第
页
论坛跳转...
胎教早教
准备怀孕
怀孕期
出生与分娩
婴儿期(0-1岁)
幼儿期(1-3岁)
学龄前(3-6岁)
中小学
课件
试题
中招
中招动态
招生快讯
相关政策
考试辅导
语文
数学
英语
物理
化学
生物
政治
历史
地理
家长交流
历年中招资料
满分作文
高考
高考动态
高考状元
历年试题
家长必读
志愿填报
心理减压
复习技巧
考生经验
备考辅导
高考大纲
历年分数线
高考常识
高考指南
语文
数学
外语
物理
化学
生物
历史
地理
政治
文综
理综
高考满分作文
家长
教师
读书
作文
郑州新东中学
学校动态
学生天地
高等教育
移民留学
成人高考
自学考试
考研
论文
外语
雅思
托福
四六级
实用英语
职称外语
公共英语(PETS)
商务英语
英语口语
小语种
英思力美语
在线留言
学校动态
课程
学生作业
英思力相册
学英语资料
计算机
办公应用
软件开发
平面动画设计
IT资格认证
等级考试
网络工程
初学者之路视频教程
计算机基础
Windows
Word2003
Execl2003
Powerpoint
Flash
Deamweaver
Fireworks
黑客基础
北大青鸟
青鸟新闻
开班信息
青鸟师资
在线问答
学员相关
技术文章
职业资格
企业培训师
资料库
历年试题
案例探讨
相关政策
财务会计
公务员考试
营养师
营养动态
职业前景
健康权威
学习指导
营养知识
健康食谱
心理咨询师
心理俱乐部
学习指导
花季少年
爱情婚姻
心理障碍
人在职场
职业前景
经典案例
导游
司法考试
建筑工程资格
外贸资格
医药资格考试
教师资格考试
电子商务师
人力资源师
资料库
历年试题
案例探讨
相关政策
技能培养
汽车驾驶
美容美发
美容
美发
化妆
整体形象设计
相关课程
人才信息
茶艺
调酒
厨师烹饪
手机维修
音乐乐器
舞蹈健身
企业管理
人力资源
市场营销
管理激励
管理书籍
管理视频
信诺专栏
职场招聘
招聘信息
职场沙龙
现在的时间是 2008-07-25 22:48:52
版权所有
商都网教育宝典
Powered by
Discuz!NT
1.0.6666 Copyright © 2001-2008
Comsenz Inc
.
Processed in 0.064 seconds