|
You don't need this line:
vHeaders.ChangeType(VT_BSTR|VT_BYREF);
because you're using the CComVariant ctor that makes it a string. (And BTW the type is VT_BSTR not VT_BSTR|VT_BYREF ).
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--=
NO CARRIER
|
|
|
|
|
Thanks Michael, i should have seen that ... unfortunately using just VT_BSTR (which i began with before i got desperate and just started experimenting) doesn't solve the problem.
Is there a way to determine what field of the struct to load when the documentation just says Variant *??? Or is the data type not really my problem?
|
|
|
|
|
I am implementing a namespace extension and I need to be able to determine what item is selected in the tree view (left hand pane in explorer) which is an IShellFolder implementation.
I can get the selection notification in the listview (right hand pane) in my implementation of IShellView via the IShellView's WndProc callback, but I can find no such mechanism in the IShellFolder.
Is there another interface in addition to IShellFolder that I need to implement in order to get this info or am I just missing something more obvious?
Many thanks!
Mike Hartway
|
|
|
|
|
Hi! everybody:
I'm developing a ActiveX control which is a windowless, If I find something special in my class, I want to SendMessage to this ctrl and let it do something , but I can not get the window handle of this ctrl, so this ctrl also can not get this message.(I have tried AfxGetMainWnd, it doesn't work)
Does anyone has similar experience? Plesae give me some ideas, I'll appreciate
your help.
Ray
|
|
|
|
|
ray_li wrote:
I have tried AfxGetMainWnd, it doesn't work
If your control is windowless there is no window handle so AfxGetMainWnd will not work...
John
|
|
|
|
|
Why use SendMessage??? Won't a regular COM method be sufficient, and easier??
If you you need to use SendMessage, make it a window control and check off the : "invisible at runtime" option
|
|
|
|
|
Is MSMQ merged with COM+?
COM+ = COM + MTS + MSMQ
or
COM+ = COM + MTS
|
|
|
|
|
COM+ contains a superset of the functionality of MTS. In the case of MSMQ, the concepts and implementation are considerably different in COM+ than in the original MSMQ. In the original, all objects had to know that they were supporting MSMQ, and had to agree message formats etc. In COM+, use of asynchronous calls is more of less invisible to the client.
Get hold of a copy of COM and .NET Component Services by Juval Lowy. It's available online at http://safari.oreilly.com too.
|
|
|
|
|
I'm using Word Automation (using C++ here) as an out of proc exe to Find and Replace text within documents. When I create an instance of Word I would prefer to keep that instance open and then open, search/replace, close and repeat until I am finished with all documents and then quit the word application instance.
I have this working but I have an odd (or maybe it is a common) problem. When I close the document, Word becomes visible. Here's how I am closeing the document.
void CMSWord9Automation::CloseDoc()
{
try
{
if(m_pOpenDoc)
{
m_pWord->Documents->Close(
&_variant_t(Word::wdDoNotSaveChanges),
&_variant_t(vtMissing),
&_variant_t(VARIANT_FALSE));
m_pOpenDoc.Release();
}
}
catch(_com_error& ComError)
{
DumpComError(ComError);
}
}
I'm looking for any information on how to stop Word from displaying when I close the opened document.
Thanks,
Dave Dak Lozar Loeser
When access is allowed to a member, it said to be accessible. Otherwise, it is inaccessible. - MSDN:C# Programmer's Reference
|
|
|
|
|
How can I take an instantiated Word document object and open it in a container item? I'm using COleClientItem::CreateFromFile, but if the document has a password it opens the word application, and I don't want that to happen.
So, I'd like to take my Word::_DocumentPtr that is already open and move it into my container item. Any ideas?
If that's not possible, how should I open the document without the password? I have tried opening it using Word.Application and then setting the password and saving, but the password doesn't seem to be set to "" when I open it again. Here's what I'm doing now:
BOOL CDocContainerCntrItem::Create(LPCTSTR lpszPath)
{
USES_CONVERSION;
<br> <br>
BOOL bRetVal = FALSE;
SCODE sc = 0;
<br> <br>
m_dwItemNumber = GetNewItemNumber();
GetItemStorage();
<br> <br>
AfxOleGetMessageFilter()->EnableNotRespondingDialog(FALSE);
<br> <br>
LPOLECLIENTSITE lpClientSite = GetClientSite();
<br> <br>
if (strcmp(lpszPath, "") != 0)
{
Word::_ApplicationPtr app;
HRESULT hr = app.CreateInstance("Word.Application");
<br> <br>
if (SUCCEEDED(hr))
{
if (app != 0)
{
COleVariant vtOptional((long) DISP_E_PARAMNOTFOUND, VT_ERROR);
COleVariant vtFileToOpen(lpszPath);
COleVariant vtPwd("MYPASS");
COleVariant vtPwdNew("");
<br> <br>
Word::_DocumentPtr doc = app->Documents->Open(vtFileToOpen, vtOptional,
vtOptional, vtOptional, vtPwd);
<br> <br>
doc->put_Password(_bstr_t(""));
doc->Password = L"";
<br> <br>
if (SUCCEEDED(doc->SaveAs(vtFileToOpen, vtOptional, vtOptional, vtPwdNew)))
{
doc->put_Saved(VARIANT_TRUE);
doc->Close();
}
doc = NULL;
<br> <br>
bRetVal = CreateFromFile(lpszPath);
}
}
<br> <br>
app = NULL;
}
else
{
CLSID clsid;
CLSIDFromProgID(L"Word.Document", &clsid);
bRetVal = CreateNewItem(clsid);
}
<br> <br>
return bRetVal;
}
Any help is greatly appreciated!
Jason Henderson I bleed orange.
|
|
|
|
|
Hello all
What I am trying to do is implement a function in an ATL COM server that returns an array of objects. I need to be able to use these objects from VB. My searches on the net turned up lots of references to using SAFEARRAY(VARIANT), but very little sample code. Ideally, I'd love a link to some code that declares a method like
GetObjects([in,out] SAFEARRAY(VARIANT) *ppObjects)
and shows both the implementation in C++ (including creating and populating the SAFEARRAY with IUnknown-derived object pointers) and some calling code, either in VB or C#.
Thanks all
Ian
|
|
|
|
|
There are some good examples here at CodeProject. Look under the beginner section.
http://www.codeproject.com/com/
Kuphryn
|
|
|
|
|
Hi Ian,
You can create a safe array of variants and then put the array in the variant and pass to the client.
Like :
SAFEARRAY *pSA =NULL;
SAFEARRAYBOUND sabound;
sabound.cElements = nCount; //Array size.
sabound.lLbound = 0;
pSA = SafeArrayCreate(VT_VARIANT, 1, sabound);
long nIterator = 0;
//in a loop put the values.
hr = SafeArrayPutElement(pSA, nIterator, (void *)&vaPutValue);
VARIANT vaResult;
VariantInit(&vaResult);
V_VT(&vaResult) = VT_ARRAY | VT_VARIANT;
V_ARRAY(&vaResult) = pSA;
return vaResult;
At client side, you can write it like:
Dim vaDocList as Variant
vaDocList = m_pClass.GetArray() 'm_pClass is the reference to co-class.
get bounds like
nUBound = UBound(vaDocList)
nLBound = LBound(vaDocList)
in a loop get values in the variables as per ur requirement.
i feel it will help you.
sandy
Last night i realized, i was seeing a dream in my dream.
|
|
|
|
|
Thanks very much for that, just what I was after
|
|
|
|
|
How to prevent binding a Type library to a ATL Attributed DLL ?
need help
ty
tal halfon
|
|
|
|
|
I want to write a Internet Explorer embeded Text editor for a government document transfer system. I want it embed in to IE, just like those online virus scan...ETC. when you first use it, a dialog box popup asking you whether or not the program is allowed to run. I bet it was probably a activeX control (ocx)?, right?(curret me, I am wrong )
but I don't know how. It must ba a lot different from writing win32 application.(i am new to ie plugin )
can anybody tell me where I can find some documents regarding this?
And is it a really a activeX control?
even a link or a book name will help!
thanks in advance!
xushenxin
keep fighting and you will win!
|
|
|
|
|
try to use atl com, create a internet browse object
for more detail ,plz check the msdn.
|
|
|
|
|
OK ,I'll check it out, thanks!: )
xushenxin
keep fighting and you will win!
|
|
|
|
|
try to use atl com, create an internet browse object
for more detail ,plz check the msdn.
|
|
|
|
|
Hello:
My first post so apologies if I've put this in the wrong place or broken some (n)etiquette.
I'm using a grid control .ocx file from inside an MFC app; all C++, built under VC++ 6.0. It has worked fine since
1999 but now is starting to cause problems on Win2000 machines (shows up in all service packs). The identical code works fine under Win98, so I'm guessing it's an upgrade issue.
All the dialogs I try to launch via the ocx fail with the following error message in Visual C++ 6.0 (cut and pasted from the Debug window):
CoCreateInstance of OLE control {A8C3B720-0B5A-101B-B22E-00AA0037B2FC}
failed.
>>> Result code: 0x80040154
>>> Is the control is properly registered?
Warning: CreateDlgControls failed during dialog init.
The control is registered properly via regsvr32 before running the app.
The above error message appears on the call to:
hWnd = ::CreateDialogIndirect(hInst, lpDialogTemplate,
pParentWnd->GetSafeHwnd(), AfxDlgProc);
in CWnd::CreateDlgIndirect(), called from CDialog::DoModal() in the usual way.
The behavior seen in release versions is that no dialog appears in response to user action (menu choice, etc).
I know next to nothing about COM/ActiveX/OLE objects, so if there's either a quick fix, or an explanation why this would happen (so I can stop the wild goose chase), I'd appreciate it.
The original supplier of this commercial ocx can't supply an update.
I hope this is enough info; it's all I can share.
Thanks,
-Chuck.
C J Charbonneau
Ottawa, Canada
|
|
|
|
|
I'm implementing a web navigator application and I'm currently working on the history items. Does anybody know how I can get the URL pointed to starting from the item pidl ?
Thanks in advance,
Yarp
http://www.senosoft.com/
|
|
|
|
|
Does anyone have any idea how long COM/VB6(classic) will be supported. Will .Net dump COM in the next generations of operating systems.
Paul Roullier
Senior Developer
|
|
|
|
|
Whilst there is still a Win32 API there will be COM support. COM is used in too many legacy systems for Microsoft to pull support. Backwards compatability has only been one of MS's greatest strengths.
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
Hi,
Can any one help me how to change the display name of components.
Like in ODL file, the syntax is:
[uuid(.......), version(1.0)]
library MyComponentLibrary
{
.......
In this case the display name of my component is "MyComponentLibrary" but i want to change it to
"iZ imaging Toolkit 2004 R1.0".
Please reply me soon if you have any suggestions.
rgds,
Rana
Dosti ke bhi kuch andaaj hote hai,
jagti ankho main bhi kuch khwab hote hai,
jaroori nahi ki gum may hi aansu nikle,
muskurati ankho main bhi sailaab hote hai...
|
|
|
|
|
Use the [helpstring] keyword.
[uuid(.......), version(1.0),
helpstring("iZ imaging Toolkit 2004 R1.0")
]
library MyComponentLibrary
...
With best wishes,
Vita
|
|
|
|