|
Hi Steve
I don't have a public site and codeproject's email does not supply an attachment facility. If you email me your email address I can send the code that way.
If not, my control can easily be recreated by starting new ATL project, adding acontrol, register for the windows messages WM_CHAR and WM_LBUTTONDOWN and overriding the following methods in the control's header.
STDMETHOD(TranslateAccelerator)(LPMSG pMsg)
{
return S_OK;
}
// IOleInPlaceObjectWindowless
//
STDMETHOD(OnWindowMessage)(UINT msg, WPARAM wParam, LPARAM lParam, LRESULT *plResult)
{
return S_OK;
}
Thanks again for your concern
Tom
|
|
|
|
|
ActiveX controls made by the ATL wizard already have an implementation of IOleInPlaceActiveObject::TranslateAccelerator inherited from the ATL class IOleInPlaceActiveObjectImpl ; but you're overriding it and returning S_OK . You're making two mistakes here:
1. You're not calling the base class so you're short circuiting all the code in ATL's implementation.
2. By returning S_OK you're telling the controls container (IE) not to process the message further.
Remove all IOleInPlaceActiveObject methods you've put in from your control; ATL implements this low level interface for you. If you want to pre-translate a message add a function with the following signature to your control.
BOOL PreTranslateAccelerator(LPMSG , HRESULT& )
If you don't handle a message in this function you should return FALSE .
A similar situation exists for the IOleInPlaceObjectWindowless inteface. The ATL wizard has already done the all the heavy lifting in the methods inherited from the ATL class IOleInPlaceObjectWindowlessImpl ; remove all the methods you've added from this interface (like OnWindowMessage ) and handle messages with message maps using the wizard like I explained a while ago.
Essentially your problem is you're trying to do too much: ATL handles many of the low level details for you but you’re cutting it off at the knees.
Good luck.
Steve
|
|
|
|
|
Hi Steve,
Thanks again, and your quite right, the overloaded functions will cause trouble for ATL but my aim was simply to watch using breakpoints for a function that gets entered. My problem is that none of these functions get entered at all, included the message handlers that the wizard created. It's as though I'm never getting focus.
With this in mind I'm now looking at ways to try to coax IE into paying attention. The functions GetMiscStatus and GetControlInfo seem mainly responsible in this area.
thank you again
tom
|
|
|
|
|
If you're going to do this to watch breakpoints get hit you should still cause the base class implementation.
Steve
|
|
|
|
|
Stephen Hewitt wrote: cause the base class implementation
Could you elaborate please.
tom
|
|
|
|
|
Take the following function you added for example:
STDMETHOD(TranslateAccelerator)(LPMSG pMsg)
{
return S_OK;
}
If you search ATL for this you'll find your control already inherits an implementation from IOleInPlaceActiveObjectImpl . Given this your function should look like this:
STDMETHOD(TranslateAccelerator)(LPMSG pMsg)
{
return IOleInPlaceActiveObjectImpl<CYourClassName>::TranslateAccelerator(pMsg);
}
Note that CYourClassName is the name of your class
Steve
|
|
|
|
|
Thanks Steve, I was clearly on the wrong line there.
I'm still not able to cause those functions to be entered though. With the main requirement of my control being that all keyboard events in IE be caught from the offset I may have to employ a subclassing solution I've written as a backup. I'm amazed at how uncooperative this ATL business can be. Great when it works though.
Tom
|
|
|
|
|
What exactly are you trying to do? I've never had any trouble handling keyboard events.
Steve
|
|
|
|
|
I'm working on a Web application using Java Servlets with an embedded ActiveX control to bridge the functionality gap.
The App is required to behave and look nothing like the normal IE GUI. Included in this makeover is the issue of controling the app through key combinations eg CTRL F for searching, F1 for help.
I've used JavaScript to block and redirect all the possible commands, except F1 and ALT Home. These two appear to resist even the most concerted efforts. as a result I'm forced to look to the ActiveX control to take me beyond the sand box.
The control will never have direct focus as it's got no window and only resides on the page for such tasks as printing etc.
Thanks again Steve
tom
|
|
|
|
|
Hi all,
Have you ever write the plugin to IE using BandObject (here [^])?
I have read the above article and try to change the original HTML page back from server. I use the code as below:
mshtml.HTMLDocumentClass doc = (HTMLDocumentClass)Explorer.Document;
doc.documentElement.innerHTML = ".........." //My HTML tags
Then the exception appear:
"Could not set the innerHTML property. Invalid target element for this operation."
Have you got any ideas about this exception?
Thanks in advance,
Hung
-- modified at 7:55 Thursday 25th May, 2006
|
|
|
|
|
Hello friends,
I want to get button info of a toolbar button attached to Internet explorer,
using sendmessage function as:
TBBUTTONINFO tbbi;
::SendMessage(hwndFFToolBar,TB_GETBUTTONINFO,(WPARAM)nId,(LPARAM)&tbbi);
nId is ID of toolbar button.
It is not working?
please reply.
|
|
|
|
|
|
I would like to change the look of the Frame window to something of my liking. For example, change the titlebar, system buttons, the color of the border of the frame and etc, etc. I did come across a few articles in Codeproject where the title bar has been customized, but that's only the title bar. I would also like to customize the border of the Frame Window and still have all the functionality of the default frame border.
Can anyone help me?
---
With best regards,
A Manchester United Fan
The Genius of a true fool is that he can mess up a foolproof plan!
|
|
|
|
|
now,i have the very problem!i found many stuff but can't resolve it!
i want to change the color of toolbar,or change the whole frame
|
|
|
|
|
I found an article on CP, "How to write a Super compact Super Fast C++ Dll for Visual Basic" which explains how to use ATL to create a DLL.
When I use the VS 2005 AppWizard to create an ATL DLL, it ends up creating a lot more files in the Solution Explorer than are present in the sample project from the article I mention. For example, after using the AppWizard I end up with the following in the Solution Explorer Treeview:
http://img130.imageshack.us/img130/5752/testatldllsolutionexplorer1hn.png[^]
whereas the sample project only has the following in the Solution Explorer Treeview:
http://img442.imageshack.us/img442/7792/tvb4jn.png[^]
I'm guessing the difference is probably because the sample file project was created in VC++ 6.
In the example project, the automatically created functions:
DllCanUnloadNow
DllGetClassObject
DllRegisterServer
DllUnregisterServer
have been commented out in tvb.cpp and the entries removed from tvb.def, but in the VS 2005 project they are not commented out and the entries are still in the .def file. The sample project also has the following line commented out in tvb.idl:
//import "ocidl.idl"
What does this line do, and what does the line import "oaidl.idl" do ?
All I want to do is create a DLL which exports my own functions. For example, AddTwoInts(int a, int b).
1) Of the automatically generated files from the VS 2005 ATL AppWizard, what can be safely deleted ?
2) Once that's done, do I only need to add the following to the end of ATL_Test_DLL.cpp
extern "C"
{
int__stdcall AddTwoInts( int a, int b )
{
return( a + b );
}
}
followed by adding the following to the end (ie. after the line with "EXPORTS") of ATL_Test_DLL.def
AddTwoInts
Do I need to do anything else ?
|
|
|
|
|
Hi all,
I have written a plugin to IE. Now I want when user press "Enter" key or click on "Go" button, my plugin will catch the URL on the Address Editbox. How can I do that?
Thanks,
Hung
|
|
|
|
|
|
Thanks Mike,
I have done successful.
Now I want my plugin can return the data for IE window to show on the IE window.
BeforeNavigate2()
{
//Code to redirect to my page and get the content back from the server
......................
//How can I show the content on the IE Window ???
}
Thanks in advance,
Hung
|
|
|
|
|
Hi,
In an ATL COM+ application how do I instantiate a well-behaved COM+ object marked as noncreatable?
I read that when instantiating COM+ applications the right way to do it is using the IObjectContext::CreateInstance rather than using CoCreateInstance. However neither is available when using noncreatalbe objects.
If I do it using CComPtr will the object be created in the current context and therefore be well behaved?
Thanks.
|
|
|
|
|
Hi Friends,
These days i am going through the nice artciles of the ATL Under Hood.
Can anyone of u please have a look over the Program no 28 in the following link http://www.thecodeproject.com/atl/atl_underthehood_2.asp[^]
and give me the reason for different outputs in different modes(Debug / Release).
Though some explaination is given i am unable to understand.
Thanks in advance.
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
|
hi friends,
i got Different Problem.
i created one Dll(win32 application). i create one project and put main().
#include "ini.hpp"
int main()
{
char *cp,*cp1;
Config Objcon("../","rrr.ini");
Section objsec = Objcon["server"];
cp=objsec["ip"];
cp1=objsec["port"];
cout<
|
|
|
|
|
bujji_bec wrote: char *cp,*cp1;
bujji_bec wrote: delete []cp; // this one giving problem
delete []cp1; // -----------do----------
Use
delete cp;<br />
delete cp1;
Maxwell Chen
|
|
|
|
|
i tried that one and also used Free also. i am Getting Same problem
b.raju
-- modified at 1:47 Monday 22nd May, 2006
|
|
|
|
|
bujji_bec wrote: int main()
{
char *cp,*cp1;
Config Objcon("../","rrr.ini");
Section objsec = Objcon["server"];
cp=objsec["ip"];
cp1=objsec["port"];
cout<<cp<<"\n"<<"cp1;
delete []cp;="" this="" one="" giving="" problem
delete="" []cp1;="" -----------do----------
}<="" blockquote="">
bujji_bec wrote: i am Getting Same problem
According to the code in the original post, Section::operator [] (LPCTSTR token) allocates some buffer internally. The implementation inside this operator matters how memory is released (by delete ).
Do you mind posting the body of Section::operator [] (LPCTSTR) ??
Maxwell Chen
|
|
|
|