2012-07-17 96 views
3

我有一個用於Windows Mobile 6 ARMV4I的Visual Studio 2008 C++項目,我想註冊一個UPnP服務。如何註冊UPnP服務

我使用Windows CE 6 SDK中的Microsoft示例作爲UPnP服務的實現。 WINCE600 \ PUBLIC \ SERVERS \ SDK \ SAMPLES \ UPNP \ DEVICE

不幸的是,RegisterRunningDevice調用失敗,錯誤E_HANDLE。

#include "upnpdevice_i.c" 
#import "upnpdevice.dll" named_guids 

int main() 
{ 
    ::CoInitializeEx(NULL, COINIT_MULTITHREADED); 

    using namespace UPnPHostLib; 
    IUPnPDeviceControlPtr device_ctrl(CLSID_Device); 
    IUPnPRegistrarPtr registrar(CLSID_UPnPRegistrar); 

    bstr_t device_descr = /* contents of the device.xml file from the sample */ 

    // throws a _com_error exception where hr = E_HANDLE 
    bstr_t device_id = registrar->RegisterRunningDevice(device_descr, 
     device_ctrl, 
     L"foo", 
     L"/windows/upnp", 
     0); 

    /* ... */ 

    ::CoUninitialize(); 
    return 0; 
} 

我在我的網頁搜索過程中看到其他人提到這個錯誤,但我沒有看到任何結果。

  • 我已經註冊
  • 我已經安裝了 「可選的Windows Mobile服務器組件」 upnpctrl,upnphost和httpd設置upnpdevice.dll。
  • 可執行文件,upnpdevice.dll,device.xml和service.xml文件全部位於/windows/upnp目錄中。

有沒有人有任何建議?

回答