|
I start a WTL project in visual studio 2005, select "create as a COM Server", then after Wizard finish its job, I select "Add Class", "ATL Simple Object", but a exception dialog occurs, say"ATL classes can only be added MFC EXE and MFC DLL projects or projects with full ATL support". So I want to ask what happens about this? Is ATL 8.0 crazy? If I want to add a ATL COM Object, what can I do?
|
|
|
|
|
Hi,
I have written a plugin to IE successfully. Now I want my Plugin can get the Request and Response object when IE visit the page "http://myURL".
Thanks for your help,
Hung
|
|
|
|
|
I used a table named FDetails with 4 text fields and a datetime field named date in MSaccess
when insert values into table ising ado recordset obj I receive some syntax error
recordset->Open("INSERT INTO FDetails(name,path,duration,volume,date) VALUES('hello','location','duration','vol','12/12/2000')",connection.GetInterfacePtr(), ADODB::adOpenForwardOnly,ADODB::adLockReadOnly, ADODB::adCmdText);
any one know inserting date into table
|
|
|
|
|
'Date' is a reserved word in MS Access Try changing the column name 'Date' to 'Date1'
cheers.. Milton KB
|
|
|
|
|
inserting problem is over but now while retvieve the date I got no. of days form 1900 to till date &time in mill or micro sec.
how to get the time in mm/dd/yyyy hh:mm:ss format
|
|
|
|
|
use the Format function in the select statement:
eg:
select Format (#date1#, "Short Date") from ur_table //would return '17/04/2004'
select Format (#date1#, "Long Date") from ur_table //would return 'April 17, 2004'
select Format (#date1#, "yyyy/mm/dd") from ur_table //would return '2004/04/17'
go thru http://www.techonthenet.com/access/functions/date/format.php[^]
for more details.
cheers....Milton KB
|
|
|
|
|
|
Hi all,
I've got a windowless ActiveX control written in ATL. I've been asked to use it to capture a users key input with regards to the F1 button. The idea seemed easy, just use PreTranslateAccelerator. Unfortunately, nothing is coming through either that or any other of the handling functions I've tried. I'm assuming now I have to register with IE somehow to get them working.
Any help on the matter would be very helpful as I'm very new to the whole ATL setup.
Thanks.
Tom
|
|
|
|
|
How are you hosting the ActiveX control? IOleInPlaceActiveObject::TranslateAccelerator is called by the host's message loop: if you're done your own hosting the message pump may have been constructed incorrectly. IOleInPlaceObjectWindowless::OnWindowMessage is another method you may want to look at.
Steve
|
|
|
|
|
Thanks for the response Steve.
The control is embedded in and HTML OBJECT tag if that's what you mean by "hosting". Because it's a windowless control I fear my control may not have the same message pump functionality as a control with a window on which the message pump can be based.
When overriding a method such as IOleInPlaceActiveObject::TranslateAccelerator is there anything else apart from entering its decleration in the header and the implimetation in the cpp to address?
Thanks again
Tom
|
|
|
|
|
So are you hosting the web browser control or using IE? If you're hosting the web browser control there could still be problems with your message pump.
Steve
|
|
|
|
|
Stephen Hewitt wrote: are you hosting the web browser control or using IE?
Hi Steve,
I'm only using IE.
Tom
|
|
|
|
|
Here's how I handled a key (I'm using ATL with MSVC6 so you your mileage may vary):
First we need to add a handler for the key. Follow these steps:
1. Right click on the control class in ClassView;
2. Select "Add Windows Message Handles..." from the context menu;
3. Select the "WM_CHAR " message;
4. Press "Add and Edit".
This will add the handler and position you there in the editor. Note that so far this is the same procedure you'd follow with ATL to add a handler to any window; ATL hides the difference so you don't have to worry about the fact that your control is windowless.
Already this will create a control that can handle a key stroke although it may not seem so at first. If you load it up in IE and press a key nothing happens: this is because it isn't UI-active and hasn't got focus. If you press tab then press a key you'll notice the key stroke gets handled – if not repeat. Eventually you’ll hit the right control and it will process the keystroke. The problem is clicking on the control doesn't activate it as expected. To rectify this you can add a mouse click handler and call SetControlFocus(TRUE); (inherited from CComControlBase ) in the handler .
Hope this helps.
Steve
|
|
|
|
|
Thanks Steve
That seems a great solution. I'll report back with my progress.
Thanks again
Tom
|
|
|
|
|
|
Unfortunately not.
I've tried using Accelerators and overriding all the ATL event methods but for some reason apart from the start up stuff like InPlaceActivate and IOleObject_SetClientSite nothing gets called. It certainly seems that my control is not on IE's list of event receivers.
thanks for your concern
Tom
|
|
|
|
|
When using the method I gave make sure that IOleInPlaceActiveObject::TranslateAccelerator returns S_FALSE (if you've implemented it) so it doesn't swallow the event.
Steve
|
|
|
|
|
Unfortunately, my my overridden IOleInPlaceActiveObject::TranslateAccelerator isn't being called at all. Neither are any other methods in my control, except during the control's initialisation and shutdown. I tried calling m_spInPlaceSite->SetCapture(TRUE); to get things going and I've tried Accelerators. I may have to resort to implimenting a keyboard hook, seems a bit like over kill though.
Tom
|
|
|
|
|
I made a control before I posted my original suggestion and all worked fine in IE. There is obviously something fishy with your control. Using a hook might work but its ugly as it ignores the root problem. Can you post your control's source somewhere?
Steve
|
|
|
|
|
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
|
|
|
|