|
Have a dig at COM[^] section. There are quite a few articles , could help you.
|
|
|
|
|
vntFieldValue.vt =VT_VARIANT | VT_ARRAY;;
SAFEARRAY* psaOut;
psaOut =Segment->GetBlob(); // C# API return the byte() in the form of safearray
if(psaOut != 0)
{
SAFEARRAYBOUND aDim[1];
aDim[0].lLbound= 0;
aDim[0].cElements= psaOut->rgsabound->cElements;;
vntFieldValue.parray=SafeArrayCreate(VT_VARIANT,1,aDim);
SafeArrayCopyData(psaOut,vntFieldValue.parray);
}
pADORecset->Fields->GetItem(FLD_WBTRBSEG_SEGMENT)->PutValue(vntFieldValue);
The line in bold color throws an exception. Could you please help me in passing the variant safearraay to set the value for recorset parameter.
|
|
|
|
|
Have seen sample for using safearrays ?
There are quite a few on this site itself.
The bold line is having quite a few function calls, try to break it, and narrow down on function , throwing exception.
|
|
|
|
|
When I create an ATL project with appWizard in vs2005, the Dll generated by the code contains four export functions. They are :
DllCanUnloadNow PRIVATE
DllGetClassObject PRIVATE
DllRegisterServer PRIVATE
DllUnregisterServer PRIVATE
What are those functions for? And how to use them to implement the code? What's the differeces between this Dll and those normal ones(say win32 style dlls)? Seeking for help.
|
|
|
|
|
For detail information please read Gale Rogerson...
You will get all the basic updates about this...
shailesh
|
|
|
|
|
DllGetClassObject is how other code creates COM objects that are implemented in the DLL.
DllCanUnloadNow is called by COM to see whether the DLL can be unloaded from memory.
DllRegister/UnregisterServer are used in self-registration, where the DLL adds/removes the registry entries needed for it to be visible to COM.
Check out my Intro to COM[^] article for more details.
|
|
|
|
|
Hi,
I have created and maintain a VC++ .NET 2005 project that creates a dll for SQL server 2000/2005 extended stored proc.
For now it recomplies the source files(originally written in VC++ 6.0) but it required by me to use the existing COM dll written in VS6 from VC++ .NET 2005.
How can I call Com dll, written in VS 6.0, from VC++ .NET 2005?
Please feel free to ask any other info.
Thanks in advance for your help.
-Amit
|
|
|
|
|
It doesn't matter what compiler was used to create the DLL, you use the same APIs to call the COM server (CoCreateInstance() , etc)
|
|
|
|
|
I have ActiveX .ocx file registered,using "regsvr32 vid_NET.ocx"
I have another version of same ocx file and its GUID also same when i embedding it to my .Net application. I do it from editing <comreference block="" and="" guid="" of=".csproj" file.="" but="" that="" component="s behaviour is different. When i installed it to a fresh PC(newly installed XP) it is perfect.I want to embed it to my current project and run in same machine. What can i do for that?..<br mode=" hold"="" ><br="" mode="hold" >how="" can="" i="" remove="" all="" referance="" clear="" things.?="" <="" xml>"="">
|
|
|
|
|
Try regsvr -u vid_NET.ocx
and if this fails you could delete the dll and use RegCleaner
JO
|
|
|
|
|
I have a C# IE add-on and need to obtain the 'value' (shown in bold, ie., 1, 96, 192) from a html dropdown list in the web page being displayed by the browser. The abbreviated html page code is as follows:
1/16"=1'0"
1/8" = 1'-0"
Full Size/N.T.S.
In my browser add-on I have the following C# code:
public string ScaleFactor
{
get
{
HTMLInputElement elmListScale = (HTMLInputElement)_Document.all.item("listScale", null);
if (elmListScale != null)
{
return elmListScale.value.ToString();
}
else
{
return null;
}
}
}
then I have...
string scaleFactor = this.ScaleFactor;
When I run the VS2005 debugger on the above code, the debugger prompt disappears when it hits the line HTMLInputEelment elmListScale = ....
Any ideas on how to read the value from a dropdown list???
Warren
|
|
|
|
|
Hello everyone,
according to the way Explorer.exe works(it calls in-process COM server that enumerate folders and files and pass it back to Explorer), is it possible to modify the list of folders and files returned so that i can decide what folders can be visible and what folders can be hidden ?
please help me....
attilah57@yahoo.com
|
|
|
|
|
I am new, the c++ com dll component is being used "in process of the c++ exe", we work in VS2005/VC8.
I come across code similar to below. It does seem to give the expected result/value.
I am wondering how or why it can use CString instead of BSTR? What conditon will this snippets of code work? And where and when will it fail? Thank you.
inside declareinterface.h
...
static const GUID IID_IArmProperties =
{ 0x1b8eb07c, 0xcb4b, 0x4118, { 0xbd, 0x61, 0x54, 0xb8, 0x77, 0x30, 0xb8, 0x55 } };
DECLARE_INTERFACE_(IArmProperties, IUnknown)
{
...
STDMETHOD(DoSomething)(THIS_ CString csComment, THIS_ double *pdRetDbl, THIS_ MISCPARAM* mmpParam) PURE;
};
inside implement.h
#include "declareinterface.h"
...
class ATL_NO_VTABLE CArmPropertiesImp:
public IArmProperties
{
public:
CArmPropertiesImp(void);
virtual ~CArmPropertiesImp(void);
BEGIN_COM_MAP(CArmPropertiesImp)
COM_INTERFACE_ENTRY(IArmProperties)
END_COM_MAP()
...
STDMETHOD(DoSomething)(CString csComment,double *pdRetDbl,MISCPARAM* mmpParam);
};
where:
typedef struct _MISCPARAM
{
double dObject;
LPCWSTR lpszObject;
long* plRes;
} MISCPARAM;
inside implement.cpp
...
STDMETHODIMP CArmPropertiesImp::DoSomething(CString csComment,double *pdRetDbl,MISCPARAM* mmpParam)
{
m_memberdouble+=mmpParam->dObject;
m_membercstring+=csComment;
if(m_membercstring.IsEmpty())
*pdRetDbl=m_memberdouble+0.5;
else
*pdRetDbl=m_memberdouble+1.5;
return S_OK;
}
inside caller.cpp
...
MISCPARAM locparam={0};
locparam.dObject=1;
CString cslocalComment="Test";
double localdouble=0;
IArmProperties *piArm=NULL;
if(m_pIMaster->QueryInterface(IID_IArmProperties,(LPVOID*)&piArm)==S_OK)
if(piAlarm)
{
piArm->DoSomething(cslocalComments,&localdouble,&locparam);
}
if(localdouble==0)
DoTheFunction();
else if(localdouble<0)
DoOtherFunction();
else
DoSomeOtherFunction();
...
|
|
|
|
|
A COM interface may take any kind of data type as argument provided that:
1. The proxy/stub contains code that properly can marshal and transfer the entire object.
2. Both the server and the client supports the data type and are binary compatible.
In your case, unless there's a lot of code written, only clients written in C++ with support for the MFC framework can use this server.
In my opinion this is either a exceptional poor choice of interface design, or someone deliberately is trying to force client developers to use the MFC framework. I would bet my money on the former.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Hello, Everybody
I am a newbie at COM even though i have been programming for quite some time.
I started writing a Namespace Extension using Visual C++ and I have a question :
-is it possible to intercept windows explorer's calls to IShellFolder's methods ?(e.g: EnumObjects).
-is it possible to intercept specific COM method call ?
I want to replace the list of folders returned to explorer by a custom one.
Please, help .
attilah57@yahoo.com
|
|
|
|
|
Did you get anywhere with this problem? I am attempting something similar myself.
I believe you need to sink the events from DShellFolderViewEvents which I think requires a IFolderViewOC object but I do not know how to obtain one yet..
|
|
|
|
|
Hi,
I create ATL COM component in VS2005 in which I add function FunX(). I successfully create COM dll and able to use it in simple Windows Form application. when i call FunX() function in code of Customize Wizard application, then FunX() not called in Customized Wizard code.Is there any specific way to call COM function for Customize Wizard code.
Thanks
|
|
|
|
|
Look at the following code
<br />
Microsoft.Office.Interop.Excel.Application ExcelApp = new Microsoft.Office.Interop.Excel.Application();<br />
...<br />
ExcelApp.Quit();<br />
The Excel object is not release after 'Quit()' method(Excel is still in the background process list).I think it is because there is still a reference of the object.
I a windows application,this will be solved when I close the application. But I'm using these code in an asp.net application.Every time they execute,the background process list grows.
Is there any way to relase the object or Is there any code to read excel files without using Microsoft Excel?
|
|
|
|
|
|
Here is the code snippet I am working on:
.....
CoInitialize(NULL);
CComPtr<iadsuser> pUser;
HRESULT hr = GetUserObj( L"DOMAIN02", L"user1", &pUser );
CString ErrMsg = _com_error(hr).ErrorMessage();
if( FAILED( hr ))
{
ASSERT( FALSE );
return false;
}
// Last login
DATE LastLogin = 0.0;
hr = pUser->get_LastLogin( &LastLogin );
ASSERT( SUCCEEDED( hr ));
CString LastLoginTime = FormatDate( LastLogin );
// Last logoff
DATE LastLogoff = 0.0;
hr = pUser->get_LastLogoff( &LastLogoff ); // this fails
ErrMsg = _com_error(hr).ErrorMessage();
ASSERT( SUCCEEDED( hr ));
CString LastLogOffTime = FormatDate( LastLogoff );
pUser.Release();
pUser = NULL;
CoUninitialize();
...............
Call to get_LastLogin() succeeds and I get correct time. Call to get_LastLogoff() fails. ErrMsg contains "Unknown error 0x8000500D"
Any ideas why get_LastLogoff() fails?
This is what I am trying to do: we have application that tracks the time user was logged on to Novell network. We are now retiring Novell Server and I need to get login/logoff time from Windows Domain controller. If there is another API I can use please let me know.
|
|
|
|
|
|
Yes, I posted yesterday on your blog. Do you have any clue where to set/enable it in AD services? The only place I can think of is Domain Security settings but I couldn't find this option anywhere.
Does call to get_LastLogoff() actually work in your source code?
|
|
|
|
|
JoeSchmoe007 wrote: Does call to get_LastLogoff() actually work in your source code?
No it doesn't.
Does the link help?
Nibu babu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
The link is irrelevant. It has nothing to do with retrieving this information programmatically.
|
|
|
|
|
Hi ,
I am using vS2005 for creating COM component in which I want to execute an EXE when Client program call my function in COM. So is there any function in ATL class library which will execute EXE and check the status of EXE execution.
Thanks
|
|
|
|