Click here to get back home

homescreen plugin program access type library?

 HomeNewsGroups | Search | About
 microsoft.public.smartphone    Post an article   get this group's latest topics as an RSS feed add this group's latest topics to your My MSN content add this group's latest topics to your My Yahoo content
Subject Author Date
homescreen plugin program access type library? cola 05-13-2007
Posted by cola on May 13, 2007, 9:39 pm
Please log in for more thread options
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.InterfaceIsIDispatch)]
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";
}
}
}



Similar ThreadsPosted
How do i add my program to Information Type in ActiveSync? April 4, 2006, 2:48 am
Pausing program execution and program focus April 6, 2006, 12:22 pm
Better Calendar Plugin January 19, 2008, 8:01 am
Plugin for Pocket Outlook ... March 18, 2008, 1:00 am
Active X plugin for Pocket PC2003 SE July 6, 2005, 6:35 pm
Cant Type characters December 1, 2005, 12:40 pm
What type of device? April 6, 2006, 2:12 pm
Accessing a C++ library in a C file February 3, 2006, 11:42 am
How to modify the Getting Started Plugin in windows mobile standard? March 5, 2008, 12:11 am
How to modify the Getting Started Plugin in windows mobile standard? March 5, 2008, 12:12 am

Our other projects:

Art Dolls, Fairies and Mermaids - Sunnyfaces.net

Roy's Linux, Programming and Search Engines messages

1-Script XML SitemapXML Sitemap