Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 2084
  • Last Modified:

COM - based ActiveSync notification?

Hello

I am trying to develop a desktop app which will connect to PDA (Pocket PC).
My app must get notified befor initializing RAPI. On microsoft web site I found....

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceactsy/html/ceconcom-basednotification.asp

I understand everything but when I try to compile it I get LINK errors:

PDA.obj : error LNK2001: unresolved external symbol _CLSID_DccMan
DPDA.obj : error LNK2001: unresolved external symbol _IID_IDccMan
MySinkObject.obj : error LNK2001: unresolved external symbol _IID_IDccManSink
Debug/DPDA.exe : fatal error LNK1120: 3 unresolved externals

This looks like the linker must have a lib?? But I cannot find it anywhere ...

I don't know what to do... I have tried everything

I am using Visual Studio 6.0 and MFC...

Thnx for your help..

best regards
0
LukaKrop
Asked:
LukaKrop
  • 10
  • 8
1 Solution
 
Mikal613Commented:
There all in Rapi.dll  but the link you referred to is for CE.NET 4.2
0
 
LukaKropAuthor Commented:
I know that the link is fo .NET but the same functions are also for not .NET framework...

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/wceconct/html/_wcesdk_Notification_Procedures.asp

I have also tried with rapi.dll (including lib) but same effect...
0
 
Mikal613Commented:
can you post that snippet of code where you got the errors?
0
Receive 1:1 tech help

Solve your biggest tech problems alongside global tech experts with 1:1 help.

 
LukaKropAuthor Commented:
OK first my derived code from IDccManSink class

class CMySinkObject : public IDccManSink  
{
public:
      CMySinkObject();
      ~CMySinkObject();
// IUnknown methods:
   STDMETHODIMP_(DWORD) AddRef(void);
   STDMETHODIMP QueryInterface(REFIID riid, void ** ppv);
   STDMETHODIMP_(DWORD) Release(void);
      // IDccManSink methods;
   STDMETHODIMP OnLogAnswered(void);
   STDMETHODIMP OnLogActive(void);
   STDMETHODIMP OnLogDisconnection(void);
   STDMETHODIMP OnLogError(void);
   STDMETHODIMP OnLogInactive(void);
   STDMETHODIMP OnLogIpAddr(DWORD dwIpAddr);
   STDMETHODIMP OnLogListen(void);
   STDMETHODIMP OnLogTerminated(void);
private:
   DWORD m_dwRefCount;
};

and implementation

#include "stdafx.h"
#include "DPDA.h"
#include "MySinkObject.h"

#ifdef _DEBUG
#undef THIS_FILE
static char THIS_FILE[]=__FILE__;
#define new DEBUG_NEW
#endif

//////////////////////////////////////////////////////////////////////
// Construction/Destruction
//////////////////////////////////////////////////////////////////////

CMySinkObject::CMySinkObject()
{

}

CMySinkObject::~CMySinkObject()
{
      
}

STDMETHODIMP CMySinkObject::OnLogAnswered(void)
{
      AfxMessageBox(_T("OnLogAnswered"));
      return NOERROR;
}

STDMETHODIMP CMySinkObject::OnLogActive(void)
{
      AfxMessageBox(_T("OnLogActive"));
      return NOERROR;
}

STDMETHODIMP CMySinkObject::OnLogDisconnection(void)
{
      AfxMessageBox(_T("OnLogDisconnection"));
      return NOERROR;
}

STDMETHODIMP CMySinkObject::OnLogError(void)
{
      AfxMessageBox(_T("OnLogError"));
      return NOERROR;
}

STDMETHODIMP CMySinkObject::OnLogInactive(void)
{
      AfxMessageBox(_T("OnLogInactive"));
      return NOERROR;
}

STDMETHODIMP CMySinkObject::OnLogIpAddr(DWORD dwIpAddr)
{
      AfxMessageBox(_T("OnLogIpAddr"));
      return NOERROR;
}

STDMETHODIMP CMySinkObject::OnLogListen(void)
{
      AfxMessageBox(_T("OnLogListen"));
      return NOERROR;
}      

STDMETHODIMP CMySinkObject::OnLogTerminated(void)
{
      AfxMessageBox(_T("OnLogTerminated"));
      return NOERROR;
}


STDMETHODIMP_(DWORD) CMySinkObject::AddRef(void)
{
  return ++m_dwRefCount;

}
STDMETHODIMP CMySinkObject::QueryInterface(REFIID riid, void ** ppv)
{
    if( IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_IDccManSink))
    {
        *ppv = (IDccManSink *)this;
    }
    else
    {
        *ppv = NULL;
        return E_NOINTERFACE;
    }

    AddRef();
    return S_OK;
}
STDMETHODIMP_(DWORD) CMySinkObject::Release(void)
{
    ULONG   ul = m_dwRefCount;

    if (!--m_dwRefCount)
        delete this;

    return ul;
}

in App derived class I added variable members:

DWORD m_hrDccMan;
IDccMan* pDccMan;
HRESULT hr;
CMySinkObject m_mySkin;


in application I add to InitInstance() code:

hr = CoCreateInstance(CLSID_DccMan, NULL, CLSCTX_INPROC_SERVER, IID_IDccMan, (LPVOID*) &pDccMan);
pDccMan->Advise((CMySinkObject*)&m_mySkin, &m_hrDccMan);

and in ExitInstance I added:

pDccMan->Unadvise(m_hrDccMan);

when I compile I get this error linker:

Linking...
DPDA.obj : error LNK2001: unresolved external symbol _CLSID_DccMan
DPDA.obj : error LNK2001: unresolved external symbol _IID_IDccMan
MySinkObject.obj : error LNK2001: unresolved external symbol _IID_IDccManSink
Debug/DPDA.exe : fatal error LNK1120: 3 unresolved externals
Error executing link.exe.

DPDA.exe - 4 error(s), 0 warning(s)

0
 
Mikal613Commented:
http://www.mvps.org/vcfaq/lang/5.htm

Basically you have too add the library also

.lib
0
 
LukaKropAuthor Commented:
yes probably

but I cannot find .lib file for this OLE
0
 
Mikal613Commented:
Sorry

http://support.microsoft.com/default.aspx?scid=%2Fservicedesks%2Fbin%2Fkbsearch.asp%3FArticle%3D299891

Building Modules That Use RAPI
The Rapi.h header file and Rapi.lib library file are available for use in compiling and linking desktop code to use RAPI. The header file and library files for use with RAPI functions are found in the following folder in a typical installation:

C:\Windows CE Tools\wce300\MS Pocket PC\support\ActiveSync\Inc
C:\Windows CE Tools\wce300\MS Pocket PC\support\ActiveSync\Lib
To compile the device-side DLL, you can use the same Rapi.h file mentioned earlier. There is no RAPI library file necessary to create the device DLL.

NOTE: RAPI.dll is not redistributable. It is installed when ActiveSync is installed on the desktop host computer.
0
 
LukaKropAuthor Commented:
I have linked already RAPI but I don't think that this is the case because I cannot find IDccMan interface in RAPI...
0
 
Mikal613Commented:
http://www.opennetcf.org

i bet its there

Use there Framework
0
 
Mikal613Commented:
did you link these

??
Header: Dccole.h.
Link Library: Ole32.lib, Uuid.lib
0
 
LukaKropAuthor Commented:
I have already found this but I still have Visual Studio 6.0 with MFC and this one is .NET... I think I am not able to use it...
0
 
LukaKropAuthor Commented:
Yes I have link those and same effect
0
 
Mikal613Commented:
vb6??

I think your gonna need a .net language its based on the framework
0
 
LukaKropAuthor Commented:
Ok I have found solution, on MFC form told me a guy
thanks anyway for your help
I will give you all the points

only one question if you know
do you know which would be the best solution (hardware) to be able to scan bar codes with my HP IPAQ.
Is solution from SOCKET ok?

best regards
0
 
Mikal613Commented:
not really
0
 
Mikal613Commented:
what was the solution?
0
 
LukaKropAuthor Commented:
I have written an database application in C++. User can print invoices and packet lists etc...
I was thinking that for input the user could use some sort of bar code scanner

which one would be th best for this task?
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 10
  • 8
Tackle projects and never again get stuck behind a technical roadblock.
Join Now