|
Hey all,
I'm using the ATL on Windows Mobile 5/6. I have a non-modal dialog which derives from CStdDialogImpl and CMessageFilter (to call IsDialogMessage in PreTranslateMessage). In the OnFinalMessage handler i do a "delete this;" So far so good.
Once my dialog is up and the user decides to exit the application, my non-modal dialog eventually receives a WM_DESTROY, as expected. The child windows of that dialog are also supposed to get the WM_DESTROY msg. However, this fails since the OnFinalMessage handler has already been called (which in turn did a "delete this;") without the DialogProc in CDialogImplBase ever returning from WM_DESTROY (which would have triggered the WM_DESTROY msg being sent to my child windows?). So I end up with an assert saying that "Object deleted before window was destroyed". Which is true since "delete this;" has already been performed.
Am I overlooking something? It seems to me as there is no way to get this properly working on Windows CE, ever. (In the ATL sources a WM_NCDESTROY is simulated since Windows CE does not support that, but it's just a call to SendMessage, which results in a nested msg that won't trigger anything useful) A delete this; in OnFinalMessage just isn't going to work on Windows CE. Anybody else experiencing the same problem? Or perhaps a solution?
Edit:
I can see how this works on non-CE versions of Windows since on those versions the WM_NCDESTROY msg is not simulated by a call to SendMessage in ATL. So the child windows have time to process their WM_DESTROY msgs before the objects are being destructed by "delete this;" But not on CE, wM_NCDESTROY is just going to be a nested message that isn't going to be of any value to me.
|
|
|
|
|
Hi,
I would like to put a TrackBar in a menu (WTL), something like Vista Explorer does to change views.
I wonder if this is a new Vista menu property, or if there is a trick.
If a trick I suppose the control is created over the Popup menu, but how do I do this ?
Any idea ? Anybody knows ?
Thanks,
Yarp
http://www.senosoft.com/
|
|
|
|
|
I'm trying to create a borderless MDI child window. I've tried setting the initial window traits without sucess:
typedef CWinTraits <WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_MDICHILD> CFTraits;
class CChildFrame : public CMDIChildWindowImpl<CChildFrame, CMDIWindow, CFTraits>
I've also tried setting / removing various styles just after the create call:
int CChildFrame::OnCreate( LPCREATESTRUCT lpCreateStruct )
{
m_hWndClient = m_view.Create(m_hWnd, rcDefault, NULL);
DWORD dwStyle, dwExStyle;
dwStyle = ::GetWindowLong( m_hWndClient, GWL_STYLE);
dwExStyle = ::GetWindowLong( m_hWndClient, GWL_EXSTYLE);
::SetWindowLong( m_hWndClient, GWL_STYLE, dwStyle & ~WS_BORDER );
return 1;
}
I've not had any success - can anyone point me in the right direction?
thanks
|
|
|
|
|
Is the built-in ATL window traits class CMDIChildWinTraits
typedef'ed as:
CWinTraits<WS_OVERLAPPEDWINDOW | WS_CHILD | WS_VISIBLE | WS_CLIPCHILDREN | WS_CLIPSIBLINGS, WS_EX_MDICHILD>
for MDI child windows the one you need? Or if not be using CWinTraitsOR to modify this?
|
|
|
|
|
I'm trying to add my header in all requests using next method.
And I have two problems:
When I call Refresh() method (by pressing F5, etc) there is no DISPID_BEFORENAVIGATE event, so Myheader is not added
Referer header is lost if Myheader was successfully added
HRESULT __stdcall DWebBrowserEventsImpl::Invoke(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS
__RPC_FAR *pDispParams, VARIANT __RPC_FAR *pVarResult, EXCEPINFO __RPC_FAR *pExcepInfo, UINT __RPC_FAR *puArgErr)
{
.......
switch (dispIdMember)
{
case DISPID_BEFORENAVIGATE:
{
std::wstring strUrl( _bstr_t(pDispParams->rgvarg[5].bstrVal) );
if (_wcsicmp(&strUrl.at(strUrl.size() - 12), _T("navcancl.htm")) == 0)
{
m_cpParent->Stop();
*pDispParams->rgvarg[0].pboolVal = VARIANT_TRUE;
}
else
if (!m_cpParent->GetHeaderAdded())
{
m_cpParent->Stop();
*pDispParams->rgvarg[0].pboolVal = VARIANT_TRUE;
m_cpParent->NavigateWCustomHeader(_bstr_t(pDispParams->rgvarg[5].bstrVal),
L"Myheader: header\r\n", &pDispParams->rgvarg[4], &pDispParams->rgvarg[3],
pDispParams->rgvarg[2].pvarVal, pDispParams->rgvarg[1]);
}
else
{
m_cpParent->SetHeaderAdded(false);
VARIANT_BOOL bCancel = VARIANT_FALSE;
BeforeNavigate(_bstr_t(pDispParams->rgvarg[5].bstrVal),
0,
pDispParams->rgvarg[3].bstrVal,
pDispParams->rgvarg[2].pvarVal,
pDispParams->rgvarg[1].bstrVal,
pDispParams->rgvarg[0].pboolVal);
if (bCancel == VARIANT_TRUE)
res = E_INVALIDARG;
}
}
break;
}
......
}
modified on Wednesday, April 21, 2010 6:20 PM
|
|
|
|
|
Does your event handler ever get called? I assume you've hooked it up (using connection points)? Simply having the function isn't enough, you have to tell IE to call it.
Steve
|
|
|
|
|
Could you explain this more detail? I implemented DWebBrowserEvents class and as I thought DWebBrowserEventsImpl::Invoke is called on every user action (but when Refresh called, there is no DISPID_BEFORENAVIGATE dispIdMember)
class DWebBrowserEventsImpl : public DWebBrowserEvents
{
STDMETHOD(QueryInterface)(REFIID riid, LPVOID* ppv);
STDMETHOD_(ULONG, AddRef)();
STDMETHOD_(ULONG, Release)();
STDMETHOD(GetTypeInfoCount)(UINT* pctinfo);
STDMETHOD(GetTypeInfo)(UINT iTInfo, LCID lcid, ITypeInfo** ppTInfo);
STDMETHOD(GetIDsOfNames)(REFIID riid, LPOLESTR* rgszNames, UINT cNames, LCID lcid, DISPID* rgDispId);
STDMETHOD(Invoke)(DISPID dispIdMember, REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS __RPC_FAR *pDispParams,
VARIANT __RPC_FAR *pVarResult, EXCEPINFO __RPC_FAR *pExcepInfo, UINT __RPC_FAR *puArgErr);
HRESULT BeforeNavigate(_bstr_t URL, long Flags, _bstr_t TargetFrameName, VARIANT * PostData, _bstr_t Headers, VARIANT_BOOL * Cancel);
HRESULT DownloadBegin();
CWebBrowserView *m_cpParent;
public:
void SetParent(CWebBrowserView *pParent)
{
m_cpParent = pParent;
}
};
class CUIHandler:
public IOleCommandTarget,
public IDocHostUIHandler
{
public:
CUIHandler():
m_spDefaultOleCommandTarget(NULL),
m_pDefaultUIHandler(NULL)
{
}
void Clear()
{
if (m_spDefaultOleCommandTarget)
{
m_spDefaultOleCommandTarget->Release();
m_spDefaultOleCommandTarget = NULL;
}
if (m_pDefaultUIHandler)
{
m_pDefaultUIHandler->Release();
m_pDefaultUIHandler = NULL;
}
}
....................................................................
IOleCommandTarget *m_spDefaultOleCommandTarget;
IDocHostUIHandler *m_pDefaultUIHandler;
};
|
|
|
|
|
arbittorr wrote: Could you explain this more detail? [I assume you've hooked it up (using connection points)?]
I think Stephen is asking have you passed an interface pointer to your DWebBrowserEventsImpl object to IE? Usually done using an Advise method such as DispEventAdvise (...)
|
|
|
|
|
Yes I have passed an interface pointer. So, problem is still here. Maybe Refresh () method doesn't invoke DISPID_BEFORENAVIGATE at all?
class CWebBrowserView : public CAxDialogImpl<CWebBrowserView>
{
protected:
DWebBrowserEventsImpl m_events;
LPCONNECTIONPOINT m_pCP;
SHDocVw::IWebBrowser2 *m_pWebBrowser;
....
m_events.SetParent(this);
HRESULT hr = GetDlgControl(IDC_EXPLORER1, __uuidof(SHDocVw::IWebBrowser2), (void**) & m_pWebBrowser);
hr = m_pWebBrowser->QueryInterface(IID_IOleInPlaceActiveObject, (void**) & m_pIOIPAO);
if (m_pWebBrowser) {
LPCONNECTIONPOINTCONTAINER pCPC = NULL;
m_pWebBrowser->QueryInterface(IID_IConnectionPointContainer, (LPVOID*)&pCPC);
pCPC->FindConnectionPoint(__uuidof(SHDocVw::DWebBrowserEventsPtr), &m_pCP);
pCPC->Release();
m_pCP->Advise((LPUNKNOWN)&m_events, &m_dwCPCookie);
}
.........
|
|
|
|
|
Sorry, I don't know about DISPID_BEFORENAVIGATE. All I can suggest is to write a dummy object to connect to that sources the event to prove if the problem is in your client code or, as you say, perhaps DISPID_BEFORENAVIGATE doesn't get invoked by Refresh.
|
|
|
|
|
Hi,
I'am new to WTL, I want to make an ActiveX control for applications.. Since I am use VC2008 express in personal and I set up the environment for using WTL/ATL, which is now working, there is no ATL app wizard for making ActiveX controls. What should I do now?
And I do love WTL, it's beautiful, is it possible to make ActiveX controls by WTL? How?
Thanks a lot!
|-|3llo Wo|2ld
|
|
|
|
|
In my experience ATL is the one you really need for COM or ActiveX. I've not used (or got) V2008 Express so can't really comment on what you can do with it. In theory you may be able to do without the AtiveX Wizard but it could require a lot of painstaking work on your part, though in saying that I'm assuming your Express version supplies all the header files and so on you would need if you took that approach.
|
|
|
|
|
Thanks a lot. Yes, I've got all the headers and libs that needed to build ATL/WTL projects, what I want to know is how to set up a project quickly... If there is no convenient way to auto generate an ActiveX project, I'm afraid I have to do this painstaking work...
|-|3llo Wo|2ld
|
|
|
|
|
This may give an idea of whats involved [^]
|
|
|
|
|
|
Yes, but this article is talking about to host ActiveX controls rather than make ActiveX controls by WTL.
|-|3llo Wo|2ld
|
|
|
|
|
As the article intro says:
"Since ActiveX controls are ATL's specialty, there are no additional WTL classes involved"
This really applies wether you're hosting ActiveX or building ActiveX.
|
|
|
|
|
Certainly. Because WTL is an extension on ATL.
|
|
|
|
|
Hi all,
Greetings and Salutations!!
I have a problem registering COM DLL's. I use ATL to create COM components but the rgs files which ATL creates and the registration process of ATL seems to only register the DLL with HKEY_LOCAL_MACHINE. If I want to register the DLL using a Windows Guest user, it does not seem to register it. Now, I looked at skype and skype seems to install on both guest accounts and admin accounts. Ofcourse, Skype does use COM DLLs but it seems that the trick is to register the DLL within HKEY_CURRENT_USER. This seems to work for skype so why shouldn't it work for me? Ofcourse, the installation would only be available to the guest user but I am ok with that. My question is, can I just make changes to the rgs file and register the DLL with HKEY_CURRENT_USER or do I have to write routines of my own which makes entries in the registry? In short, is there any way other than writing your own code which can be used to register my COM DLL with HKEY_CURRENT_USER??
Thank You for your time.
---
Hakuna-Matata
It means no worries for the rest of your days...
It's our problem free, Philosophy
"I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."
|
|
|
|
|
I now seem to be able to update the rgs values into the HKCU key but now how do I register the Typelib of the COM DLL in HKCU???
---
Hakuna-Matata
It means no worries for the rest of your days...
It's our problem free, Philosophy
"I think my response was 'What idiot dreamed this up?'" -- Mary Ann Davidson, Oracle's chief security officer, in typical blunt manner, remembering her reaction to the company's scheme to brand its databases as "unbreakable."
|
|
|
|
|
do you have a 'TypeLib' = s '{386515B1-2B6F-11D4-9048-004005719FF5}' (with your GUID)line in your .rgs file?
|
|
|
|
|
HakunaMatada wrote: My question is, can I just make changes to the rgs file and register the DLL with HKEY_CURRENT_USER
Why not change the HKCR in your .rgs to HKCU, build and register and have a look at the result with regedit? I'm assuming COM will look there for an entry.
|
|
|
|
|
|
I want to operate outlook 2007 on my app. (I'm using visual studio 2005 / WTL)
But, I couldn't find data about office automation, especially outlook.
do anybody help me?
please.
- Tristan -
|
|
|
|
|
what exactely are you trying to do ? the Outlook (Exchange) Server 2007 uses for example WebDav (being phased out) and now, Web Services to communicate with it - using these you can list emails, extract their attachments, do calendar type things
There is plenty of info on MSDN about this
'g'
|
|
|
|
|