|
Maybe the helper classes CComVariant & _variant_ can help you ? I don't know if I understand your question correct ? Is this an answer to your question ?
-Nick-
|
|
|
|
|
This piece of code works when i instantiate an object as 'inproc':
MULTI_QI qi[2] = {0};
qi[0].pIID = &IID_IAgentCore;
qi[1].pIID = &IID_IConnectionPointContainer;
hr = CoCreateInstanceEx(
CLSID_AgentCore, NULL,
server_type, pServerInfo,
2, qi);
IConnectionPointContainerPtr pCPC_AgentCore;
...
pCPC_AgentCore = (IConnectionPointContainer*)qi[1].pItf;
...
hr = pCPC_AgentCore->FindConnectionPoint(IID__IAgentCoreEventsFlat, &m_pCoreEvents);
if ( SUCCEEDED( hr ) )
{
hr = m_pCoreEvents->Advise(GetUnknown(), &m_CoreCookie);
if ( FAILED( hr ) )
throw hr;
}
else
throw hr;
but when the object AgentCore is on the remote computer Advise() failes with 'Access denied' error. Note that object is created and other method calls were successful. So i dont think it is a security problem...
IAgentCoreEventsFlat is an ordinary interface inherited from IUnknown. I'm launching a DLL with the help of DLLHOST.EXE on remote machine.
Please help!
Thanks.
|
|
|
|
|
The only way we got this to work was to set the default security in DCOMCNFG to NONE. It appears that the operating system only allows you set up security on calls to the server/service, so they will work, and not from the server to the client which will fail with an Access denied error.
|
|
|
|
|
See COM Security Article by Jeff Prosise at
http://www.codeguru.com/activex/COMSecurity1.html
Especially the section worded
Power COM Programming Tip
Well Worth a read
|
|
|
|
|
I am developping a COM DLL project using VC++ ,I need to use some VB ActiveX dll functions in my project,one of these function take an enum type lets called 'SomeEnum' as a parameter so when declare the same enum type in the VC++ and pass it to a vb function I have got an error like this:
"cannot convert parameter 1 from 'enum MyC++Class::SomeEnum to 'enum VBClass::SomeEnum ".
please Can any body help me?!
|
|
|
|
|
Hi,
My component is just a simple ATL component,which supports outgoing interfaces.Component is interacting with Host which is situated on other machine ,whenever message comes from the host to my component ,my component will fire event which must be trapped by front end ,which is web page , scripting language is VB script.
Like in VB i have withevents to trap evets from component ,how should i do it in VBscript? Do i need to change the component for that?
If anyone can suggest it will be helpfull to me.
Thank u
|
|
|
|
|
Hi, I've been having a hard time deciding which methods to use in C++ to access COM objects when performance is an issue. When I don't care about performance I use a ClassWizard generated MFC class that uses CString istead of those annoying BSTRs!, but when I care about performance I see the following options:
1. Straight C++ which is not very readable
2. #import -> SmartPointers
3. ATL's CComPtr
...
What are the performance hits by not choosing #1?
What are the tradeoffs between 2 and 3?
And finally, how much does IDispatch support hurt C++ performance (for the sake of exposing access to scripting languages)? Do real-world developers ever use IDispatch for testing in VB and then use an IUnknown for a VC++ client for the sake of performance?
Thanks!
Mach5 Enterprises, LLC. http://www.mach5.com/
"Web Intelligence for the New Economy"
|
|
|
|
|
What is the different between Windows COM Service and Windows device Driver?
Can Windows Device Driver call Windows COM Service or Local COM Server?
Thank you very much,
BD
|
|
|
|
|
I have an ATL project that acts as a plugin to a 3rd party application. The first method (as seen in oleview) works fine . The 2nd and subsequent methods never get called
Any suggestions?
Thanks
|
|
|
|
|
Ok, last time i answered my own question: http://www.codeproject.com/script/comments/forums.asp?forumid=1648&exp=0&select=45309#xx45309xx
(I'm still waiting for some guru to tell me if there is a way to do that in Netscape)
Lets see if I beat you all to it this time:
I just created the ATL dialog based control using the VC Wizard. I added an edit field using the dialog editor and now I want my program to set the text in it. I get an ASSERT when I make a call to GetDlgItem(IDC_EDIT). What is the correct way to do this.
I see lots of tutorials showing how to open a new dialog from ATL but none on how to access the controls you drop on the dialog that the ATL project is derived from using the wizard.
Thanks in advance to anyone who can help.
-pos
|
|
|
|
|
The approach I've used is to gt the controls interface, and access it through that. You might try something like the following. Call CWindow::GetDlgControl(...), which will give you an interface to the control. Query for the specific interface you're interested in. Register for any events the control fires that you are interested in. You'll have to #import the type lib for the control somewhere, so the interfaces will be available to you. Once you have the interface, use it like any other COM object. Be sure to release everything and unadvise when you're done with it.
Good luck!
HRESULT Connect(T* pParent)
{
HRESULT hr;
// Get the control's interface
m_pParent = pParent;
hr = m_pParent->GetDlgControl(ControlID, IID_IUnknown, (void**)&m_pUnkCtrl);
if(FAILED(hr)) return hr;
// TEST Section
HEdit::_DHEditDouble* pHEdit;
hr = m_pUnkCtrl->QueryInterface(HEdit::DIID__DHEditDouble, (void**)&pHEdit);
if(SUCCEEDED(hr))
{
pHEdit->Release();
}
// Advise the control
hr = IDispEventSimpleImpl<1, ATLHEditWrapper, &HEdit::DIID__DHEditDoubleEvents>::DispEventAdvise(m_pUnkCtrl);
return hr;
}
|
|
|
|
|
Hi, I'm calling an MFC/ATL COM dll from inside IE using javascript and using the "OBJECT" tag. If my MFC code ASSERTs I can't seem to do anything other than rebooting to unlock that DLL (i.e. I can't fix a bug and recompile). Is there any way to force Win98 to release the COM dll? If I call the object from a VC++ exe and "Abort" the ASSERT everything works fine, but IE seems to hold the DLL even after I ABORT|RETRY|IGNORE. Thanks!
Mach5 Enterprises, LLC. http://www.mach5.com/
"Web Intelligence for the New Economy"
|
|
|
|
|
How do i put map in DISPPARAMS structure
i tried
typedef std::map<char*,int>commandMap;
commandMap cmdMap;
VARIANT vars[1];
VariantInit(&vars [0]);
vars[0].vt=VT_BYREF;
vars[0].byref=static_cast<void*>(cmdMap);
what is the mistake in this ?
parag
|
|
|
|
|
I have been asked to inhance performance for some project written in VB,actually this project contain many sub projects (ActiveX dlls)one of these dll need to be a multithreded so it convert some part of it to COM dll C++ I did not want to convert allthis dll so I tried to use it in my VC so I tried to put it in a separate VB Activex dll to use it in my VC project,
the problem is when I tried to import a VB dll in my VC project like this:
#import "VBDLL.dll"
#import "another.dll"
I have got many errors in the "VBDLL.tlh" it seems that the compiler can not recognize for some objects in it,and when I swap the import dll like this:
#import "another.dll"
#import "VBDLL.dll"
the errors will become less than before.
Can anybody help me.
|
|
|
|
|
You can use the following VB Script to create a project:
Set objMSDEV = WScript.CreateObject("msdev.application")
objMSDEV.addproject "test","c:\myapp",TRUE
objMSDEV.ActiveProject.AddFile "test.cpp"objMSDEV.QuitWScript.Echo "Done"
From this I have determined that the following C++ code should also generate a project:
#include "stdafx.h"
#include <stdio.h>
#include <atlbase.h>
extern CComModule _Module;
#include <atlcom.h>
#include <initguid.h>
#include <comdef.h>
#include <ObjModel\appauto.h>
#include <ObjModel\appdefs.h>
#include <ObjModel\appguid.h>
#include <ObjModel\bldauto.h>
#include <ObjModel\bldguid.h>
#include <ObjModel\blddefs.h>
#include <ObjModel\textauto.h>
#include <ObjModel\textguid.h>
#include <ObjModel\textdefs.h>
#include <ObjModel\dbgauto.h>
#include <ObjModel\dbgguid.h>
#include <ObjModel\dbgdefs.h>
IApplication *pApp;
int main(int argc, char* argv[])
{
HRESULT hr = CoInitialize(NULL);
if(FAILED(hr))
{
printf("Failed to initialize the COM libraries\n");
return FALSE;
}
hr = CoCreateInstance(CLSID_Application, NULL, CLSCTX_LOCAL_SERVER, IID_IApplication, (void**)&pApp);
if(FAILED(hr))
{
printf("Failed to create an instance of MSDEV\n");
CoUninitialize();
}
CComBSTR bProjectName("project");
CComBSTR bPath("c:\\myproject");
CComBSTR bType("Application");
VARIANT_BOOL bCreateDirs=VARIANT_FALSE;
pApp->AddProject(bProjectName,bPath,bType,bCreateDirs);
pApp->Quit();
pApp=NULL;
CoUninitialize();
return 0;
}
The problem is the call to add the project generates the following error:
Debug Error!
Program: test.exe
Module:
File: i386\chkesp.c
Line: 42
The value of ESP was not properly saved accross a function call.
This is usually a result of calling a function declared with one
calling convention with a function pointer declared with a different
calling convention.
Can any body tell me what I am doing wrong?
Thanks for any help you can provide.
Steve.
|
|
|
|
|
If the anybody, who know's how I can extend the context-menu ( right mouse click over a link) from the IE5 with a functions of my own EXE/DLL Library ?
( i.e like the WebWasher)
...yks
|
|
|
|
|
Did you check msdn.microsoft.com for IE context menu? There are several articles on customizing IE.
|
|
|
|
|
You should look at IDocHostUIHandler, this is the "official" way to extend IE, like controlling the context menu.
|
|
|
|
|
Dear all
How can I get the MAC-address(physical address) from a host computer?
Thanks
|
|
|
|
|
Hi!
I am trying to write a COM exe server which hosts an activeX component. In other words, the client invokes methods in the COM exe which invokes methods on the activeX component.
I am using an ATL composite control for this. There are examples where this has been done, but the composite control is always invoked through an html page.
This is what I have done so far:
a. Create a new ATL COM app using the Appwizard and selected .exe option
b. Inserted a new ATL object (Composite control)
c. This gives me dialog box support into which I can add activeX components and other gui features.
d. The above was done since there is no MFC support present, so I cannot e.g create a dialog box, add the activeX component and then call DoModal() for this dialog in some other method.
So the problem is how to invoke the above dialog box?
thanks in advance
ab.
|
|
|
|
|
I really need help
Im working on a databaseinterface, witch will provide procedures with some parameters for the developer using C++.
The interface purpose will be to INSERT and UPDATE data to a MSDE database.
The client application should link to a dll file and then the have an function like this:
Newtest(Carnumber, Driver, Time, ..........)
The COM interface will then communicate with the MSDE database.
Im using ATL wizard Consumer to read tables and then making SQL questions with including Parameters.
The ATL Consumer Wizard can only Read one tabel, i want to make SQL questions to many diffrent tabels in the database how will i do that?
The consumer function produce a class i want a COM interface, how will i do this?
Help
|
|
|
|
|
You will have to manually add the other tables.
It should be easy to figure out by looking at the code provided by the wizard. The columns in the map are bound to the order in the SQL query.
BEGIN_COLUMN_MAP(CAccessor)
COLUMN_ENTRY(1, m_field1)
COLUMN_ENTRY(2, m_field2)
END_COLUMN_MAP()
SELECT column1, column2 FROM MyTable
JOIN MyTable2 ON ...
If you are unsure of parameters, etc., it maybe better to create a seperate consumer object and cut & paste what you need into one.
|
|
|
|
|
Thanks but
Aint there some smarter way to connect an application to a database. It must be some way that i can read the hole database into a COM object and then making some interface and every interface will have one funktion with SQL. I have trouble to find this sort off information on the webb.
|
|
|
|
|
Why don't you make a stored procedure? It will solve your problems, work with the wizards and increase performance of your application.
/WW
|
|
|
|
|
You mean that I should make the stored procedures in Access and then let the Wizard take care of it?
|
|
|
|