• <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>
  • pb中使用winapi生成唯一的永不重復字符串(UUID)

    發表于:2007-05-25來源:作者:點擊數: 標簽:winapi永不唯一重復生成
    1、定義結構及外部函數 global type uuid from structure ulongdata1 uintdata2 uintdata3 characterdata4[8] end type Function ulong UuidCreate(ref uuid lpUUID) LIBRARY rpcrt4 Function ulong UuidToString (ref uuid lpUUID, ref long lpUUIDString)

    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("","連接失?。号cPowerBuilder.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"


    原文轉自:http://www.kjueaiud.com

    老湿亚洲永久精品ww47香蕉图片_日韩欧美中文字幕北美法律_国产AV永久无码天堂影院_久久婷婷综合色丁香五月

  • <ruby id="5koa6"></ruby>
    <ruby id="5koa6"><option id="5koa6"><thead id="5koa6"></thead></option></ruby>

    <progress id="5koa6"></progress>

  • <strong id="5koa6"></strong>