您的位置:程序门 -> vb ->



各位快帮我看看,这个api函数的使用是不是参数错了?regqueryvalueex(hkey, keyvalue, 0&, reg_sz, byval vbnullstring, sizeofdata) , regopenkeyex可得0!


[收藏此页] [打印本页]选择字色:背景色:字体:[][][]


各位快帮我看看,这个api函数的使用是不是参数错了?regqueryvalueex(hkey, keyvalue, 0&, reg_sz, byval vbnullstring, sizeofdata) , regopenkeyex可得0!
发表于:2008-01-16 10:48:10 楼主
const   reg_sz   =   1
 
  const   read_control   =   &h20000

  const   standard_rights_read   =   (read_control)

  const   standard_rights_write   =   (read_control)

  const   key_query_value   =   &h1

  const   key_set_value   =   &h2

  const   key_create_sub_key   =   &h4

  const   key_enumerate_sub_keys   =   &h8

const   key_notify   =   &h10

  const   key_create_link   =   &h20

const   synchronize   =   &h100000

  const   standard_rights_all   =   &h1f0000

  const   key_read   =   ((standard_rights_read   or   key_query_value   or   key_enumerate_sub_keys   or   key_notify)   and   (not   synchronize))


  private   declare   function   regopenkeyex   lib   "advapi32.dll"   alias   "regopenkeyexa"   (byval   hkey   as   long,   byval   lpsubkey   as   string,   byval   uloptions   as   long,   byval   samdesired   as   long,   phkresult   as   long)   as   long
  private   declare   function   regqueryvalueex   lib   "advapi32.dll"   alias   "regqueryvalueexa"   (byval   hkey   as   long,   byval   lpvaluename   as   string,   byval   lpreserved   as   long,   lptype   as   long,   lpdata   as   any,   lpcbdata   as   long)   as   long
  private   declare   function   regclosekey   lib   "advapi32.dll"   (byval   hkey   as   long)   as   long
private   declare   function   regopenkey   lib   "advapi32.dll"   alias   "regopenkeya"   (byval   hkey   as   long,   byval   lpsubkey   as   string,   phkresult   as   long)   as   long
 

const   hkey_local_machine   =   &h80000002   'primary   key
sub   main()

        debug.print   softinstall("quest   sql   optimizer   for   oracle")
end   sub        

'return   1   signed   the   software   is   installed.
function   softinstall(keyvalue   as   string)   as   integer
  dim   hkey   as   long   'primary   key   handle

  dim   lpdata   as   string   'the   query   value
  lpdata   =   space(256)
  const   sizeofdata   as   long   =   255   'value's   lenth
  const   regstr_path   as   string   =   "software\quest   software"
      debug.print   regopenkeyex(hkey_local_machine,   regstr_path,   0&,   key_read,   hkey)
      if   regopenkeyex(hkey_local_machine,   regstr_path_uninstall,   0&,   key_read,   hkey)   =   error_success   then
              debug.print   regqueryvalueex(hkey,   keyvalue,   0&,   reg_sz,   byval   vbnullstring,   sizeofdata)   =   error_success
                  if   regqueryvalueex(hkey,   keyvalue,   0&,   reg_sz,   byval   lpdata,   sizeofdata)   =   error_success   then
                        debug.print   lpdata
                        softinstall   =   1
                  else
                        softinstall   =   0
                  end   if

                regclosekey   (hkey)   'free   primary   key
    end   if

end   function
发表于:2008-01-16 14:11:011楼 得分:0
已解决
发表于:2008-01-16 14:32:192楼 得分:0
呵呵
~


快速检索

最新资讯
热门点击