| 发表于:2007-05-14 10:03:33 楼主 |
如题 queryserviceconfig2在vb中能用吗 怎么用谢了 'bool 'winapi 'queryserviceconfig2a( ' sc_handle hservice, ' dword dwinfolevel, ' lpbyte lpbuffer, ' dword cbbufsize, ' lpdword pcbbytesneeded ' ); '#define service_config_description 1 '#define service_config_failure_actions 2 private declare function queryserviceconfig2 lib "advapi32.dll " _ alias "queryserviceconfig2a " _ (byval hservice as long, _ dwinfolevel as long, _ lpbuffer as byte, _ cbbufsize as long, _ pcbbytesneeded as long) as long const service_config_description = 1 const service_config_failure_actions = 2 private const sc_manager_connect = &h1 private const sc_manager_create_service = &h2 private const sc_manager_enumerate_service = &h4 private const sc_manager_lock = &h8 private const sc_manager_query_lock_status = &h10 private const sc_manager_modify_boot_config = &h20 private const read_control = &h20000 private const standard_rights_read = (read_control) private const standard_rights_write = (read_control) private const standard_rights_EXECute = (read_control) private const standard_rights_required = &hf0000 private const standard_rights_all = &h1f0000 private const sc_manager_all_access = (standard_rights_required or sc_manager_connect or sc_manager_create_service or sc_manager_enumerate_service or sc_manager_lock or sc_manager_query_lock_status or sc_manager_modify_boot_config) ' service object specific access type private const service_query_config = &h1 private const service_change_config = &h2 private const service_query_status = &h4 private const service_enumerate_dependents = &h8 private const service_start = &h10 private const service_stop = &h20 private const service_pause_continue = &h40 private const service_interrogate = &h80 private const service_user_defined_control = &h100 private const service_all_access = (standard_rights_required or service_query_config or service_change_config or service_query_status or service_enumerate_dependents or service_start or service_stop or service_pause_continue or service_interrogate or service_user_defined_control) private sub form_load() dim hscm as long, hsvc as long dim lret as long, lbytesneeded as long, lbytesneeded1 as long hscm = openscmanager(vbnullstring, vbnullstring, sc_manager_all_access) hsvc = openservice(hscm, "wmi ", service_all_access) redim config(0) as byte lret = queryserviceconfig2(hsvc, service_config_description, config(0), lbytesneeded, lbytesneeded1) '没一点反应 不知道该怎么用 closeservicehandle (hsvc) closeservicehandle (hscm) end sub |
|
|
|
|