Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / NewStats: 3,148,611 members, 7,801,776 topics. Date: Thursday, 18 April 2024 at 10:39 PM |
Nairaland Forum / Science/Technology / Programming / Creating Com With C++ (3397 Views)
Why You Should Start Programming With C. / Finger Print Application With C# / Creating An Open-source Java Web Service (2) (3) (4)
Creating Com With C++ by webmonkey(m): 2:49pm On May 21, 2009 |
How could one create a COM to interface to systems using C++ or C#? |
Re: Creating Com With C++ by nolongTing: 3:26pm On May 21, 2009 |
Do you mean that you want to call a .NET Component from COM? If thats the case you need a COM callable wrapper (CCW). A CCW is generated by the CLR when a .NET component is called from a COM client. [ COM client ]------IDispatch ---------------->{CCW}------------------>[ .NET ] And to call a COM object from the .NET environment you need a Runtime Callable Wrapper (RCW). Check out how to implement it on MSDN. |
Re: Creating Com With C++ by webmonkey(m): 5:14pm On May 21, 2009 |
I am integrating Banking application with a DM (Document Manager). The Banking solution has API that it exposes to any DM ready for interface. I am using Hummingbird DM as a core solution for DM. The DM also exposes API for integrating to any solution that will implement, 1. Attach 2. Scan 3. Delete 4. View 5. Deattach To integrate this solution I will need to create a COM (Component Object Model) that the Banking application will interface with and call these API. Also the DM will interface with this COM. My problem is how do I write a COM object using .NET, C++ or C#? |
Re: Creating Com With C++ by Kobojunkie: 10:32pm On May 21, 2009 |
Re: Creating Com With C++ by nolongTing: 8:31am On May 23, 2009 |
Do you mean that you want to call a .NET Component from COM? If thats the case you need a COM callable wrapper (CCW). A CCW is generated by the CLR when a .NET component is called from a COM client. [ COM client ]------IDispatch ---------------->{CCW}------------------>[ .NET ] And to call a COM object from the .NET environment you need a Runtime Callable Wrapper (RCW). Check out how to implement it on Codeproject. http://www.codeproject.com/KB/COM/nettocom.aspx |
Re: Creating Com With C++ by Kobojunkie: 12:28pm On May 23, 2009 |
@Poster, I remember posting this a couple of days ago This page tells you how to start you off http://www.csharphelp.com/archives/archive281.html |
Re: Creating Com With C++ by webmonkey(m): 11:45am On May 25, 2009 |
Thanks for everyone who contributed somehow to this thread. However, I am still struggling do this project. I am implementing TI Plus to interface a Opentext DM server The user guide technical implementation says that to interface TI Plus and DM you will need to create a COM. The routine implementation is done on the DM side. TI Plus does not implement any code for 1. Scan 2. Attach 3. Detached 4. View I need to create a COM to interface TI Plus and OpenText (document Imaging) such that via the web portal of the client user interface, the client can view documents, attach and detached document. I have never created a COM object before. My problems are; 1. What IDE do I use? 2. I would like to use C#/J++ 3. How do I register the COM so that TI Plus and OpenText DM can interface in a window environment? 4. Have anyone do similar project before? |
Re: Creating Com With C++ by Kobojunkie: 4:55pm On May 26, 2009 |
webmonkey: 1. You can use any IDE you want. I use Visual Studio and Eclipse depending on what I need to develop for ( Visual Studio can be used for all .NET Languages ( Python, Ruby, Perl) etc and Eclipse can be used for most all Java related coding ( Java) 2. I would not use J++ considering it is already been dropped by MS. C#, VB.NET, C++, Or even Java would do the trick 3. You need to read up on COM + to understand what they really are. If you read the article at the link I showed you, you would find the information you need 4. I have developed some COM/COM+ applications myself, so If you like, we can work on figuring this out together as I am in the mood to brush up my COM+ skills and discover the new tools out there now. |
Re: Creating Com With C++ by webmonkey(m): 6:33pm On Jun 19, 2009 |
I have created an OCX file called DOCSERVERSHELL.DocServerShellCtrl and have registered it with regsvr32 \\192.168.1.7\DMInterface\release\DocServerShell.ocx The signature of the file is give below // DocServerShellCtl.cpp : Implementation of the CDocServerShellCtrl ActiveX Control class. #include "stdafx.h" #include "DocServerShell.h" #include "DocServerShellCtl.h" #include "DocServerShellPpg.h" #ifdef _DEBUG #define new DEBUG_NEW #undef THIS_FILE static char THIS_FILE[] = __FILE__; #endif IMPLEMENT_DYNCREATE(CDocServerShellCtrl, COleControl) ///////////////////////////////////////////////////////////////////////////// // Message map BEGIN_MESSAGE_MAP(CDocServerShellCtrl, COleControl) //{{AFX_MSG_MAP(CDocServerShellCtrl) // NOTE - ClassWizard will add and remove message map entries // DO NOT EDIT what you see in these blocks of generated code ! //}}AFX_MSG_MAP ON_OLEVERB(AFX_IDS_VERB_PROPERTIES, OnProperties) END_MESSAGE_MAP() ///////////////////////////////////////////////////////////////////////////// // Dispatch map BEGIN_DISPATCH_MAP(CDocServerShellCtrl, COleControl) //{{AFX_DISPATCH_MAP(CDocServerShellCtrl) DISP_FUNCTION(CDocServerShellCtrl, "View", View, VT_BOOL, VTS_BSTR VTS_BSTR VTS_BSTR VTS_PBSTR) DISP_FUNCTION(CDocServerShellCtrl, "AttachTo", AttachTo, VT_BOOL, VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR VTS_PBSTR) DISP_FUNCTION(CDocServerShellCtrl, "AttachComplete", AttachComplete, VT_BOOL, VTS_BSTR VTS_PBSTR VTS_PI4) DISP_FUNCTION(CDocServerShellCtrl, "IsAvailable", IsAvailable, VT_BOOL, VTS_NONE) DISP_FUNCTION(CDocServerShellCtrl, "EnhancedAttachTo", EnhancedAttachTo, VT_BOOL, VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR VTS_PBSTR) DISP_FUNCTION(CDocServerShellCtrl, "AttachTimeout", AttachTimeout, VT_BOOL, VTS_BSTR) DISP_FUNCTION(CDocServerShellCtrl, "Scan", Scan, VT_BOOL, VTS_BSTR VTS_BSTR VTS_BSTR VTS_BSTR VTS_PBSTR) DISP_FUNCTION(CDocServerShellCtrl, "ScanComplete", ScanComplete, VT_BOOL, VTS_BSTR VTS_PBSTR VTS_PI4) DISP_FUNCTION(CDocServerShellCtrl, "ScanTimeout", ScanTimeout, VT_BOOL, VTS_BSTR) DISP_FUNCTION(CDocServerShellCtrl, "Print", Print, VT_BOOL, VTS_BSTR VTS_BSTR VTS_BSTR VTS_PBSTR) DISP_FUNCTION(CDocServerShellCtrl, "Delete", Delete, VT_BOOL, VTS_BSTR) DISP_FUNCTION(CDocServerShellCtrl, "Detach", Detach, VT_BOOL, VTS_BSTR) DISP_FUNCTION(CDocServerShellCtrl, "SetName", SetName, VT_BOOL, VTS_BSTR VTS_BSTR) DISP_FUNCTION(CDocServerShellCtrl, "SetDescription", SetDescription, VT_BOOL, VTS_BSTR VTS_BSTR) DISP_FUNCTION(CDocServerShellCtrl, "GetName", GetName, VT_BOOL, VTS_BSTR VTS_PBSTR) DISP_FUNCTION(CDocServerShellCtrl, "GetDescription", GetDescription, VT_BOOL, VTS_BSTR VTS_PBSTR) //}}AFX_DISPATCH_MAP DISP_FUNCTION_ID(CDocServerShellCtrl, "AboutBox", DISPID_ABOUTBOX, AboutBox, VT_EMPTY, VTS_NONE) END_DISPATCH_MAP() ///////////////////////////////////////////////////////////////////////////// // Event map BEGIN_EVENT_MAP(CDocServerShellCtrl, COleControl) //{{AFX_EVENT_MAP(CDocServerShellCtrl) // NOTE - ClassWizard will add and remove event map entries // DO NOT EDIT what you see in these blocks of generated code ! //}}AFX_EVENT_MAP END_EVENT_MAP() ///////////////////////////////////////////////////////////////////////////// // Property pages // TODO: Add more property pages as needed. Remember to increase the count! BEGIN_PROPPAGEIDS(CDocServerShellCtrl, 1) PROPPAGEID(CDocServerShellPropPage::guid) END_PROPPAGEIDS(CDocServerShellCtrl) ///////////////////////////////////////////////////////////////////////////// // Initialize class factory and guid IMPLEMENT_OLECREATE_EX(CDocServerShellCtrl, "DOCSERVERSHELL.DocServerShellCtrl", 0xa0d0e503, 0xa210, 0x4ea7, 0x88, 0xf1, 0xfd, 0x86, 0x53, 0xe1, 0xef, 0x6d) ///////////////////////////////////////////////////////////////////////////// // Type library ID and version IMPLEMENT_OLETYPELIB(CDocServerShellCtrl, _tlid, _wVerMajor, _wVerMinor) ///////////////////////////////////////////////////////////////////////////// // Interface IDs const IID BASED_CODE IID_DDocServerShell = { 0xa3b41962, 0x8687, 0x4805, { 0x90, 0xff, 0x7c, 0xd8, 0x2b, 0xe9, 0x8, 0xa3 } }; const IID BASED_CODE IID_DDocServerShellEvents = { 0x3a99f6e1, 0xef93, 0x4221, { 0x91, 0xca, 0x57, 0xe5, 0x1a, 0xea, 0xf7, 0xf3 } }; ///////////////////////////////////////////////////////////////////////////// // Control type information static const DWORD BASED_CODE _dwDocServerShellOleMisc = OLEMISC_INVISIBLEATRUNTIME | OLEMISC_SETCLIENTSITEFIRST | OLEMISC_INSIDEOUT | OLEMISC_CANTLINKINSIDE | OLEMISC_RECOMPOSEONRESIZE; IMPLEMENT_OLECTLTYPE(CDocServerShellCtrl, IDS_DOCSERVERSHELL, _dwDocServerShellOleMisc) ///////////////////////////////////////////////////////////////////////////// // CDocServerShellCtrl::CDocServerShellCtrlFactory::UpdateRegistry - // Adds or removes system registry entries for CDocServerShellCtrl BOOL CDocServerShellCtrl::CDocServerShellCtrlFactory::UpdateRegistry(BOOL bRegister) { // TODO: Verify that your control follows apartment-model threading rules. // Refer to MFC TechNote 64 for more information. // If your control does not conform to the apartment-model rules, then // you must modify the code below, changing the 6th parameter from // afxRegApartmentThreading to 0. if (bRegister) return AfxOleRegisterControlClass( AfxGetInstanceHandle(), m_clsid, m_lpszProgID, IDS_DOCSERVERSHELL, IDB_DOCSERVERSHELL, afxRegApartmentThreading, _dwDocServerShellOleMisc, _tlid, _wVerMajor, _wVerMinor); else return AfxOleUnregisterClass(m_clsid, m_lpszProgID); } ///////////////////////////////////////////////////////////////////////////// // CDocServerShellCtrl::CDocServerShellCtrl - Constructor CDocServerShellCtrl::CDocServerShellCtrl() { InitializeIIDs(&IID_DDocServerShell, &IID_DDocServerShellEvents); // TODO: Initialize your control's instance data here. } ///////////////////////////////////////////////////////////////////////////// // CDocServerShellCtrl::~CDocServerShellCtrl - Destructor CDocServerShellCtrl::~CDocServerShellCtrl() { // TODO: Cleanup your control's instance data here. } ///////////////////////////////////////////////////////////////////////////// // CDocServerShellCtrl::OnDraw - Drawing function void CDocServerShellCtrl::OnDraw( CDC* pdc, const CRect& rcBounds, const CRect& rcInvalid) { // TODO: Replace the following code with your own drawing code. pdc->FillRect(rcBounds, CBrush::FromHandle((HBRUSH)GetStockObject(WHITE_BRUSH))); pdc->Ellipse(rcBounds); } ///////////////////////////////////////////////////////////////////////////// // CDocServerShellCtrl::DoPropExchange - Persistence support void CDocServerShellCtrl::DoPropExchange(CPropExchange* pPX) { ExchangeVersion(pPX, MAKELONG(_wVerMinor, _wVerMajor)); COleControl::DoPropExchange(pPX); // TODO: Call PX_ functions for each persistent custom property. } ///////////////////////////////////////////////////////////////////////////// // CDocServerShellCtrl::OnResetState - Reset control to default state void CDocServerShellCtrl::OnResetState() { COleControl::OnResetState(); // Resets defaults found in DoPropExchange // TODO: Reset any other control state here. } ///////////////////////////////////////////////////////////////////////////// // CDocServerShellCtrl::AboutBox - Display an "About" box to the user void CDocServerShellCtrl::AboutBox() { CDialog dlgAbout(IDD_ABOUTBOX_DOCSERVERSHELL); dlgAbout.DoModal(); } ///////////////////////////////////////////////////////////////////////////// // CSayAsWordsITCtrl::GetControlFlags - // Flags to customize MFC's implementation of ActiveX controls. // // For information on using these flags, please see MFC technical note // #nnn, "Optimizing an ActiveX Control". DWORD CDocServerShellCtrl::GetControlFlags() { DWORD dwFlags = COleControl::GetControlFlags(); // The control can activate without creating a window. // TODO: when writing the control's message handlers, avoid using // the m_hWnd member variable without first checking that its // value is non-NULL. dwFlags |= windowlessActivate; return dwFlags; } ///////////////////////////////////////////////////////////////////////////// // CDocServerShellCtrl message handlers BOOL CDocServerShellCtrl::View(LPCTSTR docId, LPCTSTR windowTitle, LPCTSTR MisysSessionId, BSTR FAR* imageServerWebpageUrl) { //*imageServerWebpageUrl = ::SysAllocString(L"http://imageServer_View_url"); //pobject = _Server.CreateObject("PCDClient.PCDDocObject" /* PCDGetDoc objGetDoc = wew PCDGetDoc(); objGetDoc.SetDST strDST objGetDoc.AddSearchCrriteria "TARGET_LIBRARY", strLib objGetDoc.AddSearchCriteria "DOCUMENT_NUMBER", strDocNum objGetDoc.AddSearchCriteria "VERSION_ID", strVersionID objGetDoc.Excute if objGetDoc.ErrNumber <> 0 Then= objGet 'Error occured End if Dim lngRowCount As Long Dim strFileName As String lngRowCount = objGetDoc.GetRowFound if objGetDoc.ErrNumber <> 0 'Error occured End if if lngRowCount <> 1 Then 'Possible Error. Only 1 file expect. Else objGetDoc.SetRow(1) strFilename = objGetDoc.GetPropertyValue(PATH) MsgBox "The name of the document is: " strFilename EndIf */ return TRUE; } BOOL CDocServerShellCtrl::AttachTo(LPCTSTR name, LPCTSTR description, LPCTSTR windowTitle, LPCTSTR MisysSessionId, BSTR FAR* imageServerWebpageUrl) { *imageServerWebpageUrl = ::SysAllocString(L"http://imageServer_AttachTo_url"); return TRUE; } BOOL CDocServerShellCtrl::AttachComplete(LPCTSTR MisysSessionId, BSTR FAR* docId, long FAR* attachStatus) { enum AttachStatus { NotComplete = 0, Complete = 1, Error = 2, }; *attachStatus = Complete; *docId = ::SysAllocString(L"returned_attached_docid_1234" return TRUE; } BOOL CDocServerShellCtrl::IsAvailable() { return TRUE; } BOOL CDocServerShellCtrl::EnhancedAttachTo(LPCTSTR name, LPCTSTR description, LPCTSTR windowTitle, LPCTSTR MisysSessionId, LPCTSTR xmlSearchCriteria, BSTR FAR* imageServerWebpageUrl) { *imageServerWebpageUrl = ::SysAllocString(L"http://imageServer_EnhancedAttachTo_url"); return TRUE; } BOOL CDocServerShellCtrl::AttachTimeout(LPCTSTR MisysSessionId) { return TRUE; } BOOL CDocServerShellCtrl::Scan(LPCTSTR name, LPCTSTR description, LPCTSTR windowTitle, LPCTSTR MisysSessionId, BSTR FAR* imageServerWebpageUrl) { *imageServerWebpageUrl = ::SysAllocString(L"http://localhost.com"); return TRUE; } BOOL CDocServerShellCtrl::ScanComplete(LPCTSTR MisysSessoinId, BSTR FAR* docId, long FAR* scanStatus) { enum ScanStatus { NotComplete = 0, Complete = 1, Error = 2, }; *scanStatus = Complete; *docId = ::SysAllocString(L"returned_scanned_docid_1234" return TRUE; } BOOL CDocServerShellCtrl::ScanTimeout(LPCTSTR MisysSessionId) { return TRUE; } BOOL CDocServerShellCtrl::Print(LPCTSTR docId, LPCTSTR windowTitle, LPCTSTR MisysSessionId, BSTR FAR* imageServerWebpageUrl) { *imageServerWebpageUrl = ::SysAllocString(L"http://localhost"); return TRUE; } BOOL CDocServerShellCtrl::Delete(LPCTSTR docId) { PCDDocObject.Delete(); return TRUE; } BOOL CDocServerShellCtrl::Detach(LPCTSTR docId) { return TRUE; } BOOL CDocServerShellCtrl::SetName(LPCTSTR docId, LPCTSTR name) { return TRUE; } BOOL CDocServerShellCtrl::SetDescription(LPCTSTR docId, LPCTSTR description) { return TRUE; } BOOL CDocServerShellCtrl::GetName(LPCTSTR docId, BSTR FAR* name) { *name = ::SysAllocString(L"name value for document" return TRUE; } BOOL CDocServerShellCtrl::GetDescription(LPCTSTR docId, BSTR FAR* description) { *description = ::SysAllocString(L"description value for document" return TRUE; } Now I need to implement the signature code using C++. I don't mind the VB on the View signature. Any similar solution out there? |
(1) (Reply)
Unit Testing / Python Django Android... / Please What Are The Benefits Of Learning Php And Mysql. Please I Need Advice
(Go Up)
Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health religion celebs tv-movies music-radio literature webmasters programming techmarket Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10) Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 38 |