|
Our applicatiosn hosts the WebBrowser control. I need to catch the onclick event on a web page from our application.I am able to catch the onclick event except for frames in my handler in the event sink. When I click on a frame in a webpage, I am not able to get the onClick event to be handled in my code. Can anyone tell me why it is behaving this way?
|
|
|
|
|
Each frame hosts it's own document. You'll have to advise each document by enumerating all the frames and getting the documents for each (remembering to clean them up later).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Thank you very much. It really helped.
|
|
|
|
|
I have developled a SDI application using MFC (VC++ 6.0) which may be launched with an ini file as a parameter or directly from the executable.
If the ini file is provided this is read to ascertain a number of parameters, including details for a sockets connection which creates a telnet type user interface, processed via OnOpenDocument.
If no ini file is provided the program derives this from the name of the executable, processed via OnNewDocument which then calls OnOpenDocument passing in the correct file as though read from the command line.
I am now trying to invoke the Automation, which I requested when I created the original program via the wizard, so I can drive it from a script, but am having some difficulties.
From VBA I want to be able to either
create the application then via an automation function pass in the address of the ini file and process as though I had launched it from a shortcut
or
pass in the ini file with the original CreateObject.
I am getting a number of errors when I follow the normal documentation which I think means that I am going through the startup process multiple times.
Does anyone know of a diagram of the process followed when an object is created via Automation or have any hints which may put me on the correct path.
I had expected it to behave like Word or Excel where you CreateObject the application then Open a "Document" but that doesn't seem to be the process which the wizard has created in my application.
Sara
|
|
|
|
|
Checking that box mostly just includes the right headers. The MFC class wizard does have things to help you add automation support to classes (I think it is the "Automation" tab, but it's been a while since I've used any MFC).
As far as starting an application, it is usuall in the form of "ProductName.Application", like new Word.Application or CreateObject("Word.Application") . This finds the ProgID in the registry which finds (perhaps first, a version-dependent ProgID) a CLSID which is used to start the server (either out-of-proc, or in-proc and optionally remote, if supported). The exe is started in these cases.
Word, Excel, and other Office buddies are entirely different beasts from MFC apps. While similar in apparent concept, they are definitely not. They're automation servers will automatically open a new or existing document. To do the same, you're going to have to make sure that when your applicaiton is launched for automation (takes the automatically defined /automation command-line parameter) you'll have to take your application through the steps.
I know this is very specific, but it wasn't a very specific question. This is roughly the process that is followed and I hope I could give you some pointers about how to complete automation in your application (i.e., it isn't done completely for free).
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
How can I manipulate BSTR typed string in ATL3COM?
Can I convert it to some manipulateable String type?
If yes in which?
Kindly guide me.
Kind Regards
Atif
Watch Your Thoughts for they will become your actions.
Watch Your Actions for they will become your habits.
Watch Your Habits for they will become your beliefs.
Watch Your Beliefs for they will determine your destiny.
|
|
|
|
|
Anything that can deal with UNICODE (such as CString, from WTL3.1 or MFC), or any of the wide character functions can handle a BSTR, but to change the BSTR you will effectively need to SysFreeString the old one and SysAllocString the new one, unless you're doing something trivial like making it upper/lowercase.
It's managed, in that there's a length prefix, but other than that, it appears to the developer to be a WCHAR block.
Steve S
|
|
|
|
|
|
We've currently got a Visual Basic coded ActiveX DLL that implements ISMTPOnArrival::OnArrival to intercept messages as they arrive -- we have a website that lets users send/receive emails so they're added to an SQL DB within this DLL.
However, over the past few months we've had severe performance problems as load has increased. We're in the process of re-examining the code to determine what can be done to speed things up.
One of the things I found mentioned that because of VB6's threading requests had to be serialised and queued before being fulfilled by the Mail Sink object that was housed by the SMTP service.
Consequently, one option is to re-write (the essentially simple code) as a Visual C++ ATL project and all it to support MTA and be free threaded, being careful about being thread-aware.
The Mail Sink DLL uses other ActiveX COM DLLs to access the DB as per usual DNA architecture. If I were to re-code the mail sink using Visual C++ and support multi-threaded request fulfilment, will this be supported by making subsequent calls to the various other COM DLLs that will be STA/Apartment threaded?
I've probably not made myself especially clear, but I'd really appreciate your thoughts.
Thanks,
Paul
--
Paul
"Put the key of despair into the lock of apathy. Turn the knob of mediocrity slowly and open the gates of despondency - welcome to a day in the average office."
- David Brent, from "The Office"
MS Messenger: paul@oobaloo.co.uk
Download my PGP public key
|
|
|
|
|
We are developing a C# application using .Net AsyncCallback delegates. The application currently executes, as expected,
using these asynchronous methods. Once this application is converted to a COM+ component (i.e. a .NET serviced component)
the program ceases to execute properly and 'hangs' without asynchronously executing the callback delegates.
Any help with .Net asynchronous programming under COM+ would be grealty appreciated. Thanks. Rick
|
|
|
|
|
Hi,
I try to print some HTML from a NT service, using IHTMLDocument2 and Print Template. I manage to load some html in the document, but printing is somewhat freezing. I think the problem is the
lpTarget->Exec(NULL, OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, &var, NULL)
return without waiting for the job to complete (i know that), but then my service go back in the message loop, waiting for connection/message. I tried to put the IHTMLDoc2 and print function in a separated thread but the pb is the same.
can i really print directly from IHTMLDocument2 (without WebBrowser ctrl) ??
i don t want to have any window (i want a service), does printing need a window?
thx
modified 17-Jun-21 21:01pm.
|
|
|
|
|
I'm a novice in C++ and is working on a ATL/COM UNICODE component in VC++ .NET 2003.
I have a need to store Text strings in a 2D Array of some kind inside the component. It should be possible to add and remove complete rows in it (always a fixed number of columns). No need for sorting. It seems like most people recommend an STL Vector of CStrings, but what about the new collection classes in ATL 7 like CAtlArray. Can they be used for my 2D purposes of text strings?
One of the 2D arrays will be passed to and from another COM component. What is the best format to do that in? It will always be made from C++, never VB or something else.
Can someone with more knowledge than me please take the time to explain this for me.
|
|
|
|
|
For passing a 2D array of strings via a COM object, in ATL 7 its best to use a CComSafeArray, which can support what ever dimensions you choose. There is an article on CP that uses it to create a 2D Safe array, that should be fine for passing BSTR's.
"Je pense, donc je mange." - Rene Descartes 1689 - Just before his mother put his tea on the table.
Shameless Plug - Distributed Database Transactions in .NET using COM+
|
|
|
|
|
Hi,
I'm building a secure web browser in MFC. My project is based on the CHTMLView wrapper.
Currently, my problem is that for exemple when you open a pdf file on the internet, you can directly open it in ie. I mean, ie will launch a pdf viewer component. And in this pdf viewer, you'll be able to do everything you want, for exemple saving the pdf file.
So, I'd like to find a way to get control over this component in order, for exemple, to unable the user to save the pdf doc. The problem is that as soon as the component is launched, all windows messages are mapped to this component and not to the CHTMLView object anymore. Furthermore, I didn't find any messages (if only there is one) that is send to CHTMLView to "tell" it that a component such as a pdf viewer will now be opened inside it.
Is anyone knowing how to do such a thing ?
thanks
Ed
|
|
|
|
|
I'm about to begin an IE toolbar that I would like to make use of the IPersistStream implemenation instead of the registry. While I can store various values in statics, some of those property changes to one instance of the toolbar should be immediately reflected in the other instances (if any).
What is the best way to do this? Should the toolbar have sinks to its own connection points? If this was the case, wouldn't the points have to be implemented statically? Is this even possible (or, if possible, is just a BAD idea).
Ideas? TIA
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
First off, I'm a real COM neophyte....that said.....
Situation:
I have a win32 dll which exports approx 100 functions. These functions use data structures (some with upwards of 50 data fields) passed in/out of the function calls.
All the structures have intrinsic types for fields (char*, doubles, ints bools) etc. There are no linked lists, pointer to other structures, unions etc in the structures that are passed.
Requirement:
I have to "wrap" this dll into a COM/ActiveX object so that the entire functionality of this dll is "visible" as a COM object. But, I really don't have a real good idea where to start with this. Do I:
1. Convert all structures to MIDL equivalents? (is there a tool for this?)
2. Create an ATL object to contain the dll and simply forward all calls to the DLL?
3. How does one convert large structured data through this kinds of mechanism?
Please advise, and thank you in advance...
Just trying to keep the forces of entropy at bay
|
|
|
|
|
Well this is not really an answer but a question.
Why are you in need of wrapping this dll?
Yes, I have done this. No, I didn't enjoy it.
My preference is to rescope the entire project
and hey just do away with the old dll if possible.
If its not possible then I create a COM object
that calls the other dll.
Basically all calls on the old dll would be new methods on
the COM object.
I think you may be pushing the boundaries on the structure
sizes but I am not entirely sure. If you have no requirements
to use IDispatch then I would create a custom interface
and just pass in the structures or pointers of structures
as the case may be.
You will need to look at each structure on a case by case basis
to see if it is okay. You can pass the char* if you know the
size.
This is a big topic. I feel an article coming on.
Mike "Cop" Pulice
mike@puliceworx.com
|
|
|
|
|
In one of the parameters of this method, we can specify the size of the window(height and width can be specified). Can anyone let me know how I can retrieve/get the size of the window?
|
|
|
|
|
In order to do that, you have to QI for the IWebBrowser2 interface, but I don't think you can get that from IHTMLWindow2 (not saying you can't, just that I don't remember if you can). You could possibly QI window.external , which returns an IDispatch . The host control (in this case, the Internet Explorer client executable) supplies an IDispatch that is used to resolve the window.external reference, but it doesn't necessarily mean that it is an instance of the IWebBrowser2 implemenation. You'll just have to try a couple of these things out.
One you get the IWebBrowser2 interface, the width and height properties are there.
Why this isn't accessible from the window object, I don't know. It allows you get move and resize the window, or even set its location, but you can't get the current width and height! Weird.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Hi
I've written a COM+ application in C# there are methods that have parameters of the type System.Collections.Hashtable and I am trying to create a unmanaged CPP wrapper for those method. I used #import with TLB file and TLI and TLH files created automatically have in those methods parameters of the following type:
struct _Hashtable*
and I am stuck here!
Does anyone have any idea what to do with that?
Thanks in advance!
Jajco
|
|
|
|
|
Code Sample:-
ATL Class
class CAtl : public IA, Public IB
{
---------
--------
virtual functions -- overridden of IA and IB
}
class MyClass : public CAtl
{
virtual methods again overridden
}
DEFINE_GUID(CLSID_MyClass, {---GUID---})
My Problem:
I have written a class (CAtl) which is deriving some COM interfaces (IA and IB).
I have written one more class (MyClass) which is derived from CAtl class.
I have overridden those virtual function of Interfaces in both of my classes (in CAtl and also in MyClass).
I defined a new GUID for MyClass class.
Now i have to create Object of my class (CAtl) using CocreateInstance. which is not working .....
it is saying that CLSID is undefined..what shud i do to register my class and create its object.
Output file is a .lib
Please help me out
thanx
Now i want to create "Myclass" object using CoCreateInstance and error is comming that GUID is undefined. How should i create its obj?
|
|
|
|
|
One more point to add:
Imp point is that CLSID_MyClass in defined in the registry under HKEY_CLASSES_ROOT\CLSID\{--GUID--}.
Even I created the Lib of MyClass class and I am able use it on other machine after registering it.
|
|
|
|
|
Hi,
I am updating the innerHTML of a page element to show a progress, the progress string inside the DIV element only updates when I move the mouse over the IE window. if it's idle it does not update.
Does anyone know a problem to this solution.
Thanks
Ceri
|
|
|
|
|
Ceri wrote:
Does anyone know a problem to this solution.
Where is the MSHTML Com Object. Is it an app of yours or are you doing something in IE? A code snippet might help.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
It's a C++ MFC app that I am developing in. Basicly the loop snippet looks something like this;
pElem is a pointer to an IHTMLElement
iProg is an integer that contains a progress
bsText is a formated BSTR that contains the string to put in the innerHTML
[code]
do
{
iProg = GetCurrentProgress();
... //string formating to put number into BSTR. e.g. "10%"
pElem->put_innerHTML(bsText);
}while(iProg != 100)
[/code]
The code works except that the display only updates when I move the mouse over the embedded IE control
|
|
|
|