2012-07-17 130 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目录中。

有没有人有任何建议?

回答