| |||||||
| Smartphones This is the Microsoft General Public Smartphones Newsgroup. |
![]() |
| | LinkBack | Thread Tools |
| |||
| homescreen plugin program access type library? refering to helloplug example ,i wrote a weather plugin for homescreen by vc++ net on windows mobile 5.0 smartphone.and i want to access a .net component,Weatherlib.dll,based on windows mobile 5.0 smartphone,so i exposed Weatherlib.dll as a type library,Weatherlib.tlb. here is the code to access Weatherlib.tlb. but the method GetInfo() always returns "Com initialize failed", that is CoInitializeEx fails to initialize com. does it make,i mean,accessing a type library in my homescreen plugin program. thanks in advance. #include "objbase.h" #import "Weatherlib.tlb" using namespace Weatherlib; LPCTSTR GetInfo() { HRESULT hr=CoInitializeEx(NULL,COINIT_MULTITHREAD); LPCTSTR info; if(hr==S_OK) { Weatherlib::_Weather *weather; Weatherlib::_WeatherPtr p(__uuidof(Weatherlib::Weather)); weather=p; info=(LPCTSTR)(weather->GetInfo()); weather->Release(); CoUninitialize(); } else { info=L"Com initialize failed"; } return info; } ps:Weatherlib implementation by C# #region Using directives using System; using System.Text; using System.Runtime.InteropServices; #endregion namespace Weatherlib { [Guid("D6F88E95-8A27-4ae6-B6DE-0542A0FC7039")] [InterfaceType(ComInterfaceType.InterfaceIsIDispatc h)] public interface _Weather { [DispId(1)] string GetInfo(); } [Guid("13FE32AD-4BF8-495f-AB4D-6C61BD463EA4")] [ClassInterface(ClassInterfaceType.None)] public class Weather :_Weather { public Weather() { } public string GetInfo() { return "Testing ok"; } } } |
![]() |
| Bookmarks |
| Thread Tools | |
| |
Similar Threads | ||||
| Thread | Thread Starter | Forum | Replies | Last Post |
| Re: Cannot access explorer view of sharepoint doc library | Robert Aldwinckle | Windows Vista | 2 | 03-28-2007 08:15 PM |
| Associate a file type or protocol with a program | David | Windows Vista | 2 | 03-10-2007 09:00 AM |
| Cannot change program linked to file type | Doug | Windows XP | 6 | 03-07-2007 05:00 AM |
| File Manager type program for use with Vista please | kraut | Windows Vista | 5 | 03-05-2007 07:15 PM |
| file type: can;t get a program into the list | Osiris | Windows XP | 2 | 01-04-2007 06:31 AM |