COM for eMbedded Visual C++ 3.0 ( Under Windows CE )

Environment: eMbedded Visual C++ 3.0, Windows 2000, Windows CE Emulator (Handheld PC Pro)

To Run this application we must have installed eMbedded Visual C++ 3.0

The Generation of the COM Server and the COM Client in embedded Visual C++ 3.0 is somewhat different than the Microsoft Visual C++ 6.0. It leads an error in the COM server while running the client. This Article resolves the error and achieves the Server functionality.

Generate the Server( CEServer.dll)

Generate the work space for the Server.

Step: 1

Step: 2

click finish.

Step 3:

Select Simple Object for the COM. Because we need simple COM object that supports in-proc server.

Click Next to select the interface name

Type Process in the field for short name. It automatically generates the Class name, Interface name etc as it was in Visual C++ 6.0.

Press OK. Now we have given the parameters how the COM object should be.

Build the Server dll. It builds successfully and does not give any error. We have generated the COM Server.

Generate the Client( CEClinet.exe)

Step 1:

Let the Client be a dialog based application,

The Design of the dialog is as shown in the figure.

Step 2:

Add the Server dll file path in stdafx.h file after #endif

#import "C:\\Program Files\\Windows CE Tools\\wce211\\MS HPC Pro
\\emulation\\hpcpro\\windows\\CEServer.dll" no_namespace

Note: In my system, the Windows CE Tools directory is in the Program Files. Try to modify according to your path.

Step 3:

Declare the pointer for the Process interface in the header file CEClientDlg.h,

CLSID clsid;
IProcess *m_pProcess;

Add the following lines in the OnInitDialog in CEClientDlg.cpp,

BOOL CCEClientDlg::OnInitDialog()
{
  CDialog::OnInitDialog();
  // TODO: Add extra initialization here
  HRESULT hr;
  hr = CLSIDFromProgID(OLESTR("CEServer.Process.1"),&clsid);
  if(FAILED(hr))
    MessageBox(NULL,_T("Prog id failed"), MB_OK);
  CoCreateInstance(clsid,
                   NULL,
                   CLSCTX_INPROC_SERVER,
                   __uuidof(IProcess),
                   (void**)&m_pProcess);

  if(m_pProcess == NULL)
    MessageBox(NULL,_T("interface pointer failed"), MB_OK);
  return TRUE; // return TRUE  unless you set the
               // focus to a control
}

Step 4:

Then call the function from the interface while the user clicks the button,
void CCEClientDlg::OnCallServer() 
{
  m_pProcess->Show();
}

Compile the Client Project. You will get some error in the server in the CEServer.tli file.

That is,  error C2065: '_com_issue_errorex' : 
  undeclared identifier.

This is the main difference while creating the COM in eMbedded Visual C++ 3.0. This error does not come in Microsoft Visual C++ 6.0. This article is mainly dedicated to solve this error and run the COM Client Successfully.

What to be done to resolve this problem
(The modification is in the CEServer.dll)

Add the definition or override the existing function.

Step 1:

Goto CEServer.idl file,

interface IProcess : IDispatch
{
   //Show function 
   //Add this function declaration here
   [id(2), helpstring("method _com_issue_errorex")] HRESULT
            _com_issue_errorex(HRESULT _hr1,
                               IUnknown  *pthis1,
                               const GUID  refiid1);
};

Step 2:

Goto Process.h file,

Add the declaration ,

STDMETHOD(_com_issue_errorex)(HRESULT _hr1,
            IUnknown  *pthis1,
            const GUID  refiid1);

Step 3:

Goto Process.cpp file,

Add the definition,

STDMETHODIMP CProcess::_com_issue_errorex(HRESULT _hr1,
            IUnknown  *pthis1,
            const GUID  refiid1)
{
  AFX_MANAGE_STATE(AfxGetStaticModuleState())

  // TODO: Add your implementation code here

  return S_OK;
}

Rebuild all.

Again come to the COM Client and rebuild the client application.

Downloads

Download demo project (COM CE Server) - 30 Kb
Download demo project (COM CE Client) - 40 Kb

IT Offers

Comments

  • Isabel Marant Sneakers

    Posted by CrengarnexSap on 03/28/2013 02:02pm

    Hong Kong Celebrities in [url=http://austinandrew.co.uk/General/isabelmarant.aspx]Isabel Marant Sneaker Wedges sale[/url] Spotted – Kelly Chen, Florinda Ho and Hillary Tsui looking knowledgeable in Isabel Marant pieces from the Spring/Summer 2012 collection. We also spotted Joey Yung at the levee IT threw in the service of Isabel while she was in borough at Zuma mould week. Isabel Marant Opens Third Hong Kong Aggregate on Ice House Thoroughfare, Coming to Burgh on May 19 Read on how YOU can take first prize in a chance to upon Isabel in Hong Kong! The modish, and third in Hong Kong, Isabel Marant store on Ice Dwelling-place High road in Pre-eminent covers an neighbourhood of 570sq.ft. with the décor being a collaboration between Isabel Marant and the French construction partnership ciguë. To at the principal chance of the recent Ice Building Passage store, the set from France has expressly designed a brace of Asian little edition risqu‚ tie-dye sneakers, merely handy at Isabel Marant Paris, Hong Kong and Beijing. Go steady with our gallery of the remodelled stow away in this world and how you can connect us at an exclusive cocktail welcome on Isabel at Zuma on May 19. And we’re same impassioned to forth a spot for the benefit of a particular of our Butterboom readers and their old china to couple us for a cocktail party with Isabel Marant at Zuma on Saturday May 19 in the evening. You’ll be talented to come across her and take photos with her and learn more forth her plans here in Hong Kong. All you have to do is answer this subject in the comments inferior: “What year did Isabel Marant sling her [url=http://future-select.co.uk/General/isabelsneaker.aspx]where can i find isabel marant sneakers[/url]? Any true hound should recognize this and we’ll randomly pick complete victor with the censure conform to at noontide on Thursday, May 17th and email them directly. Western girl's authentic and fresh and insubordination: Isabel Marant 2012 qiu dong If it weren't an eye to Isabel Marant on the purpose of the 2012 qiu dong is based color with darker tones, at first glance, leak b feign a person believe this is designed for be born and summer cool: the embroidered neckline like greek tablecloth, off-white bud silk, silk skirt flare skirt is placed, and nine minutes of pants is decorated with a gold interweave tricky and soft. But gradually, the unscathed series will appear more elements of qiu dong: the conjunction of swart and pessimistic blue, rivet elements, cortex and oversize plea jacket... Isabel Marant plot with a view this period, with ageless country female in the western Coordinated States as the thesis, the clean and fresh and rebellious, r and provocative so along with the gender nature. Along with the gender colour with obstinate stormy and striking, disposed to be more in the streets is wearing Isabel Marant mark consistent characteristics. Conference models this season makeup is sent along with the gender nature. Each select of get-up, at any conditions be adept to wear them in the density in the street, and the split between also can match other style stretch is tasted. Designer Isabel Marant curtain christen at the purpose, it illustrates the tees: the latest embroidery phnom penh another avenue recreational style of pants collocation, rather peculiar T dream of, also along with the gender you sooner a be wearing it.

    Reply
  • How to solve OCX inclusion problem in WinCE Emulator

    Posted by Legacy on 06/06/2003 12:00am

    Originally posted by: Gowrisankar

    Hi,
    
    I am using eMbedded VC++4.0.
    I have written an application which uses an OCX file.
    I added the OCX component into the application and
    it built successfully.

    But when I start debugging the application,
    when I create the OCX component at run-time,
    I am getting the following error message.

    "CoCreateInstance of the OLE Control {GUID} failed.
    >>> Result Code: 0x80040154
    >>> Is the control is properly registered?"

    I have registered the OCX control properly and verified the registry entries.
    But still then I am not able to create the OCX component when I try to execute the application
    in CE Emulator which is provided with EVC 4.0.

    I have tested my application in an other platform of our own CE platform.
    But under CE Emulator it is functioning well.

    And I just want to know onething, Is OCX controls work under Emulator?

    please suggest any solution for this problem.

    Reply
  • with Events?

    Posted by Legacy on 01/09/2003 12:00am

    Originally posted by: Ellis LI

    I can't create a ATl object with events. Can help?

    Reply
  • How to make COM server run in Emulator?

    Posted by Legacy on 05/08/2002 12:00am

    Originally posted by: HuuQuynh


    Dir B. Manivannan,

    I am a beginner. So I do not know how to make a DLL, as COM server, run in Emulator! I think I must modify some Registry keys. But I do not know how. I have a example in shell programming, writing a IME for Palm size PC or Pocket PC, compiled by EVC 3.0, compiled complete, download complete, and EVC registered DLL completed too! But how to make DLL (IME) run in emulator?

    Thank you very much!

    Best regards,
    HuuQuynh

    Reply
  • How to register the COM dll on PPC?

    Posted by Legacy on 04/12/2002 12:00am

    Originally posted by: BJ Lee

    On desktop and HPC, we just use regsvr32.exe for registering COM dlls.
    But we don't have that on PPC, how to register ?

    Reply
  • Query --How to call API calls in X86 target

    Posted by Legacy on 02/11/2002 12:00am

    Originally posted by: Maria Jothi

    Hello Sir,

    I want to build an application and test it in the x86 target.
    I added an API call for my requirement.


    If i include a API call Hwxconfig and itz neccessary header file in as :
    STDMETHODIMP CProcess::Show()
    {
    // TODO: Add your implementation code here
    MessageBox(NULL,_T("From Server"),_T("COM Server"),MB_OK);

    HwxConfig();
    return S_OK;
    }


    I'm getting the following error ::::

    Linking...
    Process.obj : error LNK2019: unresolved external symbol _HwxConfig referenced in function "public: virtual long __cdecl CProcess::Show(void)" (?Show@CProcess@@UAAJXZ)
    X86Dbg/CEServer.dll : fatal error LNK1120: 1 unresolved externals
    Error executing link.exe.

    How to avoid this error ??

    Awaiting for the favourable reply.

    Thanks
    Maria

    • same err

      Posted by minaldahiya on 04/12/2004 10:15pm

      I am getting the same error. Could you solve this issue or not?

      Reply
    Reply
  • Server dll file path-> How to make it default for all machines

    Posted by Legacy on 02/08/2002 12:00am

    Originally posted by: Maria Jothi


    Hello sir,

    How to specify the server dll file path in stdafx.h file.

    #import "\\windows\\CEServer.dll" no_namespace

    instead of

    #import "C:\\Program Files\\Windows CE Tools\\wce211\\MS HPC Pro\\emulation\\hpcpro\\windows\\CEServer.dll" no_namespace

    so the coding line will be default for all machines irrespective of the installation directory.

    #import "\\windows\\CEServer.dll" no_namespace is giving error . How to modify it as per the requirement ??

    Thanks
    Maria

    Reply
  • Persistent Storage in Windows CE

    Posted by Legacy on 12/21/2001 12:00am

    Originally posted by: S.P.Raj

    HI,
    
    

    I m working in Windows CE Persistent Storage. I am using Hard Disk/DOM(DiskOnMdule)as Storage Media.
    My Target board is x86 Mother Board.

    I need tn know how to implement Persistent Storage in Wndows CE.

    Please Provide me Reference.

    Thanks,
    S. P. Raj

    Reply
  • Pocket Internet Explorer

    Posted by Legacy on 12/07/2001 12:00am

    Originally posted by: Bruno

    Hello,

    thank you for your article. I just have a question. I would like to control Pocket Internet Explorer through COM.
    Is it possible???
    If yes, How and Where can i get source code?

    Thank you in advance, it's important

    Bruno

    Reply
Leave a Comment
  • Your email address will not be published. All fields are required.

Go Deeper

Most Popular Programming Stories

More for Developers

Latest Developer Headlines

RSS Feeds