|
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?
|
|
|
|
|
Stored procedure is "the right way" to accomplish these kind of tasks, but... I'm sorry to say that Access does not have support for Stored Procedures You have to use MSSQL or similar DBMSs
/WW
|
|
|
|
|
Hello everyone,
Well I m a novice into this JACOB API. I downloaded
the software which acts as a bridge b/w Java and COM.
Its downloaded from the website -
http://users.rcn.com/danadler/jacob/
Can anyone lend me a helping hand please?
But the main problem is that there is no
API DOCUMENTATION of JACOB to b precise apart frm MSDK
for Java/ Sun SDK for Java.
So if i want to know vich functions have to b used
and all how am I goin to find it out.
Can anyone please help me reg. this.
Also I downloaded this for I wanna call and use
functions of a COM dll viz. Win Media Player's DRM
API.
Its windows platform based. I wanna use that in java.
Anyone who has worked on that ? To give a brief intro
abt tht its basically a Digital rights manager for
securing streaming media in a B2B framework. I wanna
do tht urgently so please i request anyone to come out
with a helping hand for how to use JACOB and that API.
I wud b very grateful.
Thanking You,
Shamant - Java Developer.
|
|
|
|
|
Hello everyone,
I'm trying to access the activex parent object and am having some troubles. I would like my ATL control invoke the navigate() function of it's container (assuming the container is IE) so that the plugin causes IE to POST some data back to the server. I am having trouble finding any documentation on if this is even possible. Here is some code I have that doesn't seem to work:
HRESULT hr;
CLSID clsid; // Class ID of the object.
LPUNKNOWN punk = NULL; // Unknown of the object.
IWebBrowserApp* ppvObject = NULL; // interface to the object
hr = CLSIDFromString(L"Shell.Explorer.2", &clsid);
// Create an instance of the object and ask for its
// IDispatch interface.
hr = CoCreateInstance(clsid, NULL, CLSCTX_SERVER, IID_IUnknown, (void **)punk);
if (SUCCEEDED(hr)) {
hr = punk->QueryInterface(IID_IWebBrowserApp, (void**)&ppvObject);
if (SUCCEEDED(hr)) {
// Create POST Data to be sent out to the server
BSTR bstrURL = NULL, bstrHeaders = NULL;
VARIANT vFlags = {0},
vTargetFrameName = {0},
vPostData = {0},
vHeaders = {0};
bstrURL = SysAllocString(L"http://www.microsoft.com");
if (!bstrURL)
{//TODO: error handling
}
bstrHeaders = SysAllocString(L"Content-Type: application/x-www-form-urlencoded\r\n");
if (!bstrHeaders)
{ //TODO: error handling
}
V_VT(&vHeaders) = VT_BSTR;
V_BSTR(&vHeaders) = bstrHeaders;
hr = GetPostData(&vPostData);
//Send data out to the server
hr = ppvObject->Navigate(bstrURL, &vFlags, &vTargetFrameName, &vPostData, &vHeaders);
ppvObject->Release();
}
punk->Release();
}
}
HRESULT GetPostData(LPVARIANT pvPostData); // do some stuff to the data
Any Ideas what I'm doing wrong? This is probably going to open a random web connection, not the parent window. I think there has to be an easier way. and one that works!
thanks.
UPDATE: should I use AtlAxGetHost()??? If so, then how do i get the HWND?
|
|
|
|
|
I'm replying to myself so that if anyone else is trying to do this they won't go crazy like me. Here's what you need to do: (error checking omited)
IOleContainer* pContainer;
IServiceProvider* pService;
IWebBrowser2* pBrowser;
HRESULT hr;
hr = m_spClientSite->GetContainer(&pContainer);
hr = pContainer->QueryInterface(IID_IServiceProvider,(void**)&pService);
hr = pService->QueryService(SID_SWebBrowserApp, IID_IWebBrowser2, (void**)&pBrowser);
Now... does anyone know how to make this work in Netscape using the npmozax.dll plugin?
-pos
|
|
|
|
|
How can an ATL in-proccess be client ,in a nother word how it can call another
Acticex Dll and wich is the best function can do that
|
|
|
|
|
MyActiveX::CallOther()
{
CoCreateInstance(YourActiveX);
// Not proper code, but you get the idea
}
|
|
|
|
|
Hi,
Could I use a smart pointer instead of CoCreateInstance(...)??
|
|
|
|
|
Yes, and you could also read a book or other documentation.
|
|
|
|
|
I develop application in VC++ I need to use com dll in another com dll,is it possible??
Thnks
|
|
|
|
|
Of course. If your module supports a dual interface add a header file created by MIDL compiler to the project and you can use the powerful of vtable. If your COM module implements only IDispatch you have to generate a class derived from COleDispatchDriver ( by ClassWizard).
|
|
|
|