|
hi,
I am not familiar with COM objects,we are trying to run a process that will replicate data from notes database to SQL database,this is developed using COM objects by the person who is not available now.
We have a process called replicaNotesToSQL.exe running in the process list of tast manager and this process is suppose to populate SQL tables with Notes data,This worked fine,until we turned the process off and tried to resatart it,replication is nomore done,but we can see the exe running in the process list.
I have no idea if this is a problem with COM,but the applciation is developed using COM objects.
All we have is a project file in visual studio developed using C#(replicaNoteToSQL.sln) and output file folder with 2 output files(ReplicaNotesToSQL.exe and ReplicaNotesToSQl.config)
when you run the ReplicaNotesToSQl.exe the replication should take place and SQL tables has to be populated.
If you want to see the code i can send you the code,when I debug the Code there are no errors and no warnings.
Thanks in advace.
|
|
|
|
|
how selective loading BHO in Chtmlview environment
wqewqqeweqwrwerewrwe
|
|
|
|
|
Please don't cross-post, it's considered rude and won't help you get an answer to your question any faster. The original message is here[^].
Scott.
—In just two days, tomorrow will be yesterday.
—Hey, hey, hey. Don't be mean. We don't have to be mean because, remember, no matter where you go, there you are. - Buckaroo Banzai
[ Forum Guidelines] [ Articles] [ Blog]
|
|
|
|
|
Hello dear COM experts,
While trying to compile a VC++ 6.0 project with VC++ 7.1, I have got the following error :
d:\TESTINGONLY\dbstudio\DSIFormat.h(58) : error C2664: '_com_ptr_t<_IIID>::_com_ptr_t(int)' : cannot convert parameter 1 from 'ATL::CComPtr<T>' to 'int'
with
[
_IIID=_com_IIID<StdFormat::IStdDataFormatDisp,& _GUID_6c51b910_900b_11d0_9484_00a0c91110ed>
]
and
[
T=StdFormat::IStdDataFormatDisp
]
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
This error is caused by the following instanciation
CComPtr<StdFormat::IStdDataFormatDisp> m_fmtBinary;
StdFormat::IStdDataFormatDisp is located in a .tlh file.
I am a newbee with COM and I guess it is an interface generated by the compiler.
Here is its definition
struct __declspec(uuid("6c51b910-900b-11d0-9484-00a0c91110ed"))
IStdDataFormatDisp : IDataFormatDisp
{
//
// Property data
//
__declspec(property(get=GetType,put=PutType))
enum FormatType Type;
__declspec(property(get=GetFormat,put=PutFormat))
_bstr_t Format;
}
It derives from
struct __declspec(uuid("e675f3f0-91b5-11d0-9484-00a0c91110ed"))
IDataFormatDisp : IDispatch
{};
IDataFormatDisp does nothing so I wonder why not deriving IStdDataFormatDisp direcly from IDispatch
Indeed the project works fine with visual c++ 6.0.
I thank you very much for your help.
|
|
|
|
|
.tlh files are generated by the compiler when it encounters a #import directive. The exact behaviour of what the compiler does depends on the options to that directive.
The compiler has a COM support library which already supplies smart pointers, so use of ATL's CComPtr is unnecessary. See the definitions of _com_ptr_t . If you don't want the compiler to generate smart pointer wrappers, specify no_smart_pointers in the #import directive.
I would generally try to avoid reusing the .tlh file from a previous compilation session, particularly when moving between compilers. The underlying compiler support classes may have changed. That's probably what's happened here.
DoEvents: Generating unexpected recursion since 1991
|
|
|
|
|
Hi All,
I am using the VC++ Single Doc Template for Building an MFC Application with supports OLE Compound Document as FULL SERVER.
When the user drops a file generated by my application into MSWORD, I want to insert the file in MSWORD showing the file path.
for eg. Assume the MFC App, saves a document in the location c:\folder\ as "fileondisk.xht". If I drag the file from desktop and drop it on MS-WORD, the file should be embedded in MS-WORD and print the name of the dragged file as "c:\folder\fileondisk.xht" in the embedded region.
Can some one please help me in getting the path of the file name dropped on MS-Word. I can show some hard-coded text in the embedded region, but I need to display the actual path of the file name on the disk.
Thanks
Sunil
|
|
|
|
|
at the risk of being pelted with fruit / eggs or worse...
What is this L"" notation? It isn't particularly easy to find with a search engine (Here or at google), as I suppose this[^]
isn't what I'm looking for..
I'm also looking for a solid COM reference (book, website, wiki, whatever) if you happen to have any favorites that you'd like to share.
|
|
|
|
|
|
Thanks. I couldn't find that #define in any of the code, but that makes so much sense now
|
|
|
|
|
Assuming I understand what you're referring to, you put L in front of a string in C++ to signify that it should be a Unicode string (using wide-characters). T is often used instead, as this is has the same effect if the code is being compiled with Unicode (i.e. _UNICODE is #defined . In fact, it is #defined as L), and otherwise has no effect (the preprocessor strips it out).
Can't help with the COM reference I'm afraid, except what's on this site and in the MSDN documentation.
|
|
|
|
|
It is nothing COM specific. Just used to indicate wide character strings.
This[^] articel should give you some idea.
Prasad
MS MVP - VC++
|
|
|
|
|
|
HI All,
I had to use regex in one of my validation files.I got this one particular file regexp.cpp from google which I used it in my program.I have mentioned the contents of the file and the header file and also the list of errors I am receiving for this below.
//This is the header file regexp.h
#ifndef _REGEXP_H_
#define _REGEXP_H_
#include <afxdisp.h> // MFC Automation classes
class RegExp
{
public:
// IRegExp2 wrapper class
class IRegExp2 : public COleDispatchDriver
{
public:
IRegExp2() {}
IRegExp2(LPDISPATCH pDispatch) : COleDispatchDriver(pDispatch) {}
IRegExp2(const IRegExp2& dispatchSrc) : COleDispatchDriver(dispatchSrc) {}
void SetPattern(LPCTSTR lpszNewValue);
void SetIgnoreCase(BOOL bNewValue);
BOOL Test(LPCTSTR sourceString);
};
public:
RegExp();
~RegExp();
public:
void IgnoreCase( BOOL bIgnore );
void compile( LPCTSTR pattern );
BOOL iptest( LPCTSTR input );
LPCTSTR input;
protected:
IRegExp2 m_IRegExp;
};
#endif
//THis is the regex.cpp file
#include "regexp.h"
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
// IRegExp2 operations
void RegExp::IRegExp2::SetPattern(LPCTSTR lpszNewValue)
{
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x2711, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
lpszNewValue);
}
void RegExp::IRegExp2::SetIgnoreCase(BOOL bNewValue)
{
static BYTE parms[] =
VTS_BOOL;
InvokeHelper(0x2712, DISPATCH_PROPERTYPUT, VT_EMPTY, NULL, parms,
bNewValue);
}
BOOL RegExp::IRegExp2::Test(LPCTSTR sourceString)
{
BOOL result;
static BYTE parms[] =
VTS_BSTR;
InvokeHelper(0x2715, DISPATCH_METHOD, VT_BOOL, (void*)&result, parms,
sourceString);
return result;
}
// RegExp class
RegExp::RegExp()
{
CoInitialize(NULL);
m_IRegExp.CreateDispatch( _T("VBScript.RegExp") );
}
RegExp::~RegExp()
{
m_IRegExp.ReleaseDispatch();
}
//The list of errors I am getting on trying to build the DLL
--------------------Configuration: NameExt - Win32 Debug--------------------
Creating Type Library...
Processing C:\mj\cognac2\CS\CelerraCifsMgmt\Common\vcmgmt30a.idl
vcmgmt30a.idl
Processing ..\..\Common\vcmgmt30a.acf
vcmgmt30a.acf
Creating Type Library...
Processing C:\mj\cognac2\CS\CelerraCifsMgmt\Common\vcmgmt20.idl
vcmgmt20.idl
Processing ..\..\Common\vcmgmt20.acf
vcmgmt20.acf
Compiling resources...
Compiling...
About.cpp
AntiVirus.Cpp
AntiVirusNode.cpp
c:\program files\microsoft visual studio\vc98\include\utility(23) : warning C4786: '??0?$pair@Viterator@?$_Tree@Vtstring@@U?$pair@$$CBVtstring@@V1@@std@@U_Kfn@?$map@Vtstring@@V1@U?$less@Vtstring@@@std@@V?$allocator@Vtstring@@@3@@3@U?$less@Vtstring@@
@3@V?$allocator@Vtstring@@@3@@std@@_N@std@@QAE@ABViterator@?$_Tree@Vtstring@@U?$pair@$$CBVtstring@@V1@@std@@U_Kfn@?$map@Vtstring@@V1@U?$less@Vtstring@@@std@@V?$allocator@Vtstring@@@3@@3@U?$less@Vtstring@@@3@V?$allocator@Vtstring@@@3@@1@AB_N@Z' : ide
ntifier was truncated to '255' characters in the browser information
c:\program files\microsoft visual studio\vc98\include\map(93) : see reference to class template instantiation 'std::pair<class std::_Tree<class tstring,struct std::pair<class tstring const ,class tstring>,struct std::map<class tstring,class
tstring,struct std::less<class tstring>,class std::allocator<class tstring> >::_Kfn,struct std::less<class tstring>,class std::allocator<class tstring> >::iterator,bool>' being compiled
c:\program files\microsoft visual studio\vc98\include\map(93) : while compiling class-template member function 'class tstring &__thiscall std::map<class tstring,class tstring,struct std::less<class tstring>,class std::allocator<class tstring
> >::operator [](const class tstring &)'
BaseSnap.cpp
comp.cpp
dataobj.cpp
delebase.cpp
errorstr.cpp
GetTextualSid.cpp
mmccrack.cpp
NotifyHandler.cpp
Registry.cpp
tstrrsrc.cpp
vcCommand.cpp
vcCommand20.cpp
vcCommand30a.cpp
Generating Code...
c:\program files\microsoft visual studio\vc98\include\utility(21) : warning C4786: 'std::pair<std::_Tree<tstring,std::pair<tstring const ,tstring>,std::map<tstring,tstring,std::less<tstring>,std::allocator<tstring> >::_Kfn,std::less<tstring>,std::al
locator<tstring> >::iterator,bool>::pair<std::_Tree<tstring,std::pair<tstring const ,tstring>,std::map<tstring,tstring,std::less<tstring>,std::allocator<tstring> >::_Kfn,std::less<tstring>,std::allocator<tstring> >::iterator,bool>' : identifier was
truncated to '255' characters in the debug information
Compiling...
vcmgmt20_c.c
vcmgmt30a_c.c
Generating Code...
Compiling...
VcParams.cpp
regexp.cpp
Generating Code...
Linking...
uafxcwd.lib(dllmodul.obj) : error LNK2005: _DllMain@12 already defined in BaseSnap.obj
uafxcwd.lib(afxmem.obj) : error LNK2005: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in LIBCMTD.lib(new.obj)
uafxcwd.lib(afxmem.obj) : error LNK2005: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in LIBCMTD.lib(dbgdel.obj)
uafxcwd.lib(dllmodul.obj) : warning LNK4006: _DllMain@12 already defined in BaseSnap.obj; second definition ignored
uafxcwd.lib(afxmem.obj) : warning LNK4006: "void * __cdecl operator new(unsigned int)" (??2@YAPAXI@Z) already defined in LIBCMTD.lib(new.obj); second definition ignored
uafxcwd.lib(afxmem.obj) : warning LNK4006: "void __cdecl operator delete(void *)" (??3@YAXPAX@Z) already defined in LIBCMTD.lib(dbgdel.obj); second definition ignored Creating library Debug/AntiVirus.lib and object Debug/AntiVirus.exp
Debug/AntiVirus.dll : fatal error LNK1169: one or more multiply defined symbols found<
Error executing link.exe.
AntiVirus.dll - 4 error(s), 5 warning(s)
I am creating a MFC DLL based project and am using VC++ 6.0.I am using COleDispatchDriver for the implementation of regex methods.So I guess that the problem has arose because of my calling COleDispatchDriver while I am building this MFC based DLL project.I cannot upgrade to any higher versions either for Visual studio or SDK.
My code works fine until I add these two files.One of my sorce files does have a DLLMain defined it.And the other one,according to theerrors I get comes from uafxcwd.lib which is called somehow(I dont know how).
So to solve this problem, in the project settings I tried adding the uafxcwd.lib in the ignore libraries option inside the link tab.But that resulted in increasing the number of errors to 7 and it showed that somehow COleDispatchDriver is related to this uafxcwd.lib.
Can you help me resolve these errors?
|
|
|
|
|
Try following this[^] KB article on MSDN .
Prasad
MS MVP - VC++
|
|
|
|
|
|
I have code that implements drag & drop for a ShowPicturesOnArrival event. The code works fine under Windows XP but fails under Vista with an:
Invalid FORMATETC structure
error. For completeness, the relevant Registry keys I've added are below. Items preceeded by a "v" are values for the above key, not subkeys.
HKEY_CLASSES_ROOT
MyApp
shell
open
DropTarget
v CLSID [REG_SZ] = {My-GUID}
HKEY_LOCAL_MACHINE
SOFTWARE
Classes
CLSID
{My-GUID}
v (default) [REG_SZ] MyApp
InprocServer32
v (default) [REG_SZ] = C:\path\to\My.dll
v ThreadingModel [REG_SZ] = Apartment
Microsoft
Windows
CurrentVersion
Explorer
AutoplayHandlers
EventHandlers
ShowPicturesOnArrival
v MyApp [REG_SZ]
Handlers
MyApp
v Action [REG_SZ] = "Copy pictures ..."
v DefaultIcon [REG_SZ] = C:\path\to\MyApp.exe,0
v InvokeProgID [REG_SZ] = MyApp
v InvokeVerb [REG_SZ] = open
v Provider [REG_SZ] = MyApp's name
My code follows. (Yes, I know it's a lot to look through, but any help much
appreciated. The failure occurs where the comment containing "fails" below
is.) First, I have a utility reference-counting class:
class LC_DLLRefCount {
public:
static ULONG get() {
return m_refCount;
}
protected:
LC_DLLRefCount() { ++m_refCount; }
~LC_DLLRefCount() { --m_refCount; }
private:
static ULONG volatile m_refCount;
};
ULONG volatile LC_DLLRefCount::m_refCount;
Next, my IClassFactory implementation:
class LC_ClassFactory : public IClassFactory, public LC_DLLRefCount {
public:
LC_ClassFactory() : m_refCount( 0 ) { }
ULONG STDMETHODCALLTYPE AddRef() {
return ++m_refCount;
}
ULONG STDMETHODCALLTYPE Release() {
ULONG const remaining = --m_refCount;
if ( !remaining )
delete this;
return remaining;
}
HRESULT STDMETHODCALLTYPE CreateInstance( IUnknown*, REFIID,
LPVOID* );
HRESULT STDMETHODCALLTYPE LockServer( BOOL );
HRESULT STDMETHODCALLTYPE QueryInterface( REFIID, LPVOID* );
private:
ULONG volatile m_refCount;
};
HRESULT STDMETHODCALLTYPE LC_ClassFactory::CreateInstance
( IUnknown *pUnkOuter, REFIID iid, LPVOID *ppv )
{
if ( ::IsBadWritePtr( ppv, sizeof( LPVOID ) ) )
return E_POINTER;
if ( pUnkOuter )
return CLASS_E_NOAGGREGATION;
*ppv = NULL;
LC_AutoplayHandler *const handler = new LC_AutoplayHandler();
if ( !handler )
return E_OUTOFMEMORY;
HRESULT result = handler->QueryInterface( iid, ppv );
if ( FAILED( result ) )
delete handler;
return result;
}
HRESULT STDMETHODCALLTYPE LC_ClassFactory::LockServer( BOOL lock ) {
if ( lock )
++m_refCount;
else
--m_refCount;
return S_OK;
}
HRESULT STDMETHODCALLTYPE LC_ClassFactory::QueryInterface
( REFIID iid, LPVOID *ppv )
{
if ( ::IsBadWritePtr( ppv, sizeof( LPVOID ) ) )
return E_POINTER;
if ( ::IsEqualIID( iid, IID_IUnknown ) )
*ppv = dynamic_cast<IUnknown*>( this );
else if ( ::IsEqualIID( iid, IID_IClassFactory ) )
*ppv = dynamic_cast<IClassFactory*>( this );
else {
*ppv = NULL;
return E_NOINTERFACE;
}
AddRef();
return S_OK;
}
Next, my IDropTarget implementation:
class LC_AutoplayHandler : public IDropTarget, public LC_DLLRefCount {
public:
LC_AutoplayHandler() : m_refCount( 0 ) { }
ULONG STDMETHODCALLTYPE AddRef() {
return ++m_refCount;
}
ULONG STDMETHODCALLTYPE Release() {
ULONG const remaining = --m_refCount;
if ( !remaining )
delete this;
return remaining;
}
HRESULT STDMETHODCALLTYPE QueryInterface( REFIID, LPVOID* );
HRESULT STDMETHODCALLTYPE Drop( LPDATAOBJECT, DWORD, POINTL,
PDWORD );
HRESULT STDMETHODCALLTYPE DragEnter( LPDATAOBJECT, DWORD, POINTL,
PDWORD );
HRESULT STDMETHODCALLTYPE DragLeave();
HRESULT STDMETHODCALLTYPE DragOver( DWORD, POINTL, PDWORD );
private:
ULONG volatile m_refCount;
};
HRESULT STDMETHODCALLTYPE LC_AutoplayHandler::DragEnter
( LPDATAOBJECT, DWORD, POINTL, PDWORD pEffect )
{
*pEffect = DROPEFFECT_COPY;
return S_OK;
}
HRESULT STDMETHODCALLTYPE LC_AutoplayHandler::DragLeave() {
return S_OK;
}
HRESULT STDMETHODCALLTYPE LC_AutoplayHandler::DragOver
( DWORD, POINTL, PDWORD pEffect )
{
*pEffect = DROPEFFECT_COPY;
return S_OK;
}
HRESULT STDMETHODCALLTYPE LC_AutoplayHandler::Drop
( LPDATAOBJECT pDO, DWORD, POINTL, PDWORD )
{
UINT autoplayShellIDLists = ::RegisterClipboardFormat(
TEXT("Autoplay Enumerated IDList Array")
);
if ( !autoplayShellIDLists )
return ::GetLastError();
FORMATETC formatEtc = {
autoplayShellIDLists, NULL, DVASPECT_CONTENT, -1,
TYMED_HGLOBAL
};
STGMEDIUM medium = { 0 };
HRESULT result = pDO->GetData( &formatEtc, &medium );
if ( FAILED( result ) )
return result;
::ReleaseStgMedium( &medium );
return result;
}
HRESULT STDMETHODCALLTYPE LC_AutoplayHandler::QueryInterface
( REFIID iid, LPVOID *ppv )
{
if ( ::IsBadWritePtr( ppv, sizeof( LPVOID ) ) )
return E_POINTER;
if ( ::IsEqualIID( iid, IID_IUnknown ) )
*ppv = dynamic_cast<IUnknown*>( this );
else if ( ::IsEqualIID( iid, IID_IDropTarget ) )
*ppv = dynamic_cast<IDropTarget*>( this );
else {
*ppv = NULL;
return E_NOINTERFACE;
}
AddRef();
return S_OK;
}
Finally, my Dll* functions implementation:
#define LC_DLL_EXPORT(T) extern "C" __declspec(dllexport) T __stdcall
LC_DLL_EXPORT(HRESULT) DllCanUnloadNow() {
bool const canUnload = LC_DLLRefCount::get() == 0;
return canUnload ? S_OK : S_FALSE;
}
LC_DLL_EXPORT(HRESULT) DllGetClassObject( REFCLSID clsid, REFIID iid,
LPVOID *ppv ) {
if ( !::IsEqualCLSID( clsid, LC_AP_GUID ) )
return CLASS_E_CLASSNOTAVAILABLE;
if ( ::IsBadWritePtr( ppv, sizeof( LPVOID ) ) )
return E_POINTER;
*ppv = NULL;
LC_ClassFactory *const factory = new LC_ClassFactory();
if ( !factory )
return E_OUTOFMEMORY;
factory->AddRef();
HRESULT result = factory->QueryInterface( iid, ppv );
factory->Release();
return result;
}
Are there any mistakes in the above code but it just happens to work in XP but not Vista? How can this be made to work in Vista? Thanks.
- Paul
|
|
|
|
|
|
Please notice:
This is the C omponent O bject M odel forum (Not the serial communication one).
pra84veen wrote: the moment when i connect to the module
What module are you talking about?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
|
|
|
|
|
Hi,
instead of IViewObject i am using IViewObject2 for printing my activex control. But i am able to see a black image instead of my control. This is my code.
void CPrintControlView::PrintControlUsingScreen(CWnd *pWnd, CDC* pDC, CPrintInfo* pInfo)
{
// get the IUnknown pointer for the chart object (note, don't release this one per MSDN)
LPUNKNOWN pUnk = pWnd->GetControlUnknown();
if (!pUnk)
{
AfxMessageBox(_T("Not an ActiveX Control"));
return;
}
// get a reference to the drawing rectangle
CRect &rcPage = pInfo->m_rectDraw;
// maximize the image based on our drawing area, but keep the aspect ratio unchanged
CRect rect;
pWnd->GetClientRect(&rect);
float grph_xyratio = (float) rect.Width() / (float) rect.Height();
float page_xyratio = (float) rcPage.Width() / (float) rcPage.Height();
// determine the limiting dimension
float width, height;
if (grph_xyratio > page_xyratio)
{
// the x dimension is the limiting factor
width = (float) rcPage.Width();
height = rcPage.Width() / grph_xyratio;
}
else
{
// the y dimension is the limiting factor
height = (float) rcPage.Height();
width = rcPage.Height() * grph_xyratio;
}
// build the rectangle to print in
RECTL rectPrn;
rectPrn.top = 0;
rectPrn.left = 0;
rectPrn.right = rect.Width() - 1;
rectPrn.bottom = rect.Height() - 1;
// get the dc of the current display
CDC dc;
HDC hdc = ::GetDC(m_hWnd);
dc.Attach(hdc);
// offscreen memory and bitmap support
CDC dcMem;
CBitmap bmpMem;
CBitmap *oldbm = NULL;
LPVOID lpvBits = NULL;
// save the device context
pDC->SaveDC();
// do the drawing
HRESULT hRes = S_OK;
try
{
// create a memory device context for offscreen drawing
if (!dcMem.CreateCompatibleDC(&dc))
_com_issue_error(HRESULT_FROM_WIN32(::GetLastError()));
if (!bmpMem.CreateCompatibleBitmap(&dc, rect.Width(), rect.Height()))
_com_issue_error(HRESULT_FROM_WIN32(::GetLastError()));
oldbm = dcMem.SelectObject(&bmpMem);
IViewObject* temp = NULL;
hRes = pUnk->QueryInterface(IID_IViewObject2, (void **) &temp);
if (FAILED(hRes)) _com_issue_error(hRes);
// draw the object into our screen device context
hRes = temp->Draw(DVASPECT_CONTENT, //DOCPRINT,
-1, NULL, NULL,dcMem ,
((CMetaFileDC*)pDC)->m_hDC, //hdcMem,
&rectPrn,NULL, NULL, 0);
if (FAILED(hRes)) _com_issue_error(hRes);
// delesect the device dependent bitmap from the offscreen device context (must be out when GetDIBits is called)
dcMem.SelectObject(oldbm);
// get the header structure for a device independent bitmap (DIB) setup with the biggest possible palette
BITMAPINFO *bmi = (BITMAPINFO *) _alloca(sizeof(BITMAPINFOHEADER) + 256 * sizeof(RGBQUAD));
memset(&bmi->bmiHeader, 0, sizeof(BITMAPINFOHEADER));
bmi->bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
// query for the bitmap information (NULL does a query)
int scanLineCount = GetDIBits(dcMem, bmpMem, 0, rect.Height(), NULL, bmi, DIB_RGB_COLORS);
if (!scanLineCount)
_com_issue_error(HRESULT_FROM_WIN32(::GetLastError()));
// allocate memory for the bitmap bits
lpvBits = new char[bmi->bmiHeader.biSizeImage];
if (!lpvBits)
_com_issue_error(HRESULT_FROM_WIN32(ERROR_OUTOFMEMORY));
// convert the device dependent bitmap to the DIB
// (See knowledge base article Q195830 for details)
scanLineCount = GetDIBits(dcMem, bmpMem, 0, rect.Height(), lpvBits, bmi, DIB_RGB_COLORS);
if (!scanLineCount)
_com_issue_error(HRESULT_FROM_WIN32(::GetLastError()));
// transfer the device independent bitmap to our printer device context
if (GDI_ERROR == StretchDIBits(pDC->m_hDC, rcPage.left, rcPage.top, (int) width, (int) height, 0, 0, rect.Width(), rect.Height(), lpvBits, bmi, DIB_RGB_COLORS, SRCCOPY))
_com_issue_error(HRESULT_FROM_WIN32(::GetLastError()));
}
catch (_com_error & e)
{
ErrorMessage(e.Error(), (LPCTSTR) e.Description());
}
}
What should i do
Regards
|
|
|
|
|
i,
I am able to print mschar control with IViewObject. But I am not able to print my activex control. HRESULT is returning zero but i am not able to see anything on the screen. Should i need to make any changes to my activex control so that it can print
Regards
|
|
|
|
|
i fixed the problem. i did not set the setmapmode in the activex control. after setting the setmap mode to himetric i am able to print the activex control. but it is printing with blackbackground. can anybody tell me the problem
|
|
|
|
|
I am printing activex controls. I was not able to print them. Last week i posted the problem in com forum. I found the solution. we have 4 legacy activex controls. out of them i am able to print two of them. One is raising one of the parameter is incorrect and another is printing with black background image. This is my problem. can any one tell where i have to look in the activex control code
|
|
|
|
|
Hi everyone,
I am using Microsoft Comm control ActiveX control in My program.I am not getting How to use that in proper way.Isearched in net i am not getting on VC++.
when i inserted com control into my program Two files are added they are mscomm.cpp and mscomm.h.I dont know the events of mscomm.In vb we have events like
commEvRecv and send.But i am not getting like that events in VC++ please tell me How To do that..I am in tension.Please help me.please give me some VC++ examples or articles in VC++.
Please...
Thanks in Advance,
Savitri.
|
|
|
|
|
Click here ->[^]
its an ATL tutorial and very helpful for you.
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
i have a com component exe. the methods exhibited by it are called thru javascript.
when the object is created, the exe is started and methods are called and then exe is exited. this works fine. but sometime the exe does not exit and remains in memory and the webpage calling it hangs.
is there any solution to this problem? is there a method by which i can terminate exe or destroy the object created?
some light on this is highly appreciated
|
|
|
|
|