Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Explorer crashes while toolbar is being closed 1

Status
Not open for further replies.

Artemyy

Programmer
Oct 27, 2003
10
0
0
RU
I've got problem. I have self designed toolbar.
I have two related dlls. First is main and just translates requests to second. The second one contains implementation of all internal logic.
Some part of sources is here. It's for Visual C++ 6.0

header 1:
class ATL_NO_VTABLE Dashboard :
public CComObjectRootEx<CComMultiThreadModel>,
public CComCoClass<Dashboard, &CLSID_Dashboard>,
public IObjectWithSite,
public IPersistStream,
public IDeskBand,
public IContextMenu,
public CWindowImpl<Dashboard>
{
//
}

header 2:
class DashboardImpl :
public IDashboardImpl,
public CWindowImpl<DashboardImpl>
{
//
}

new window creates here
bool DashboardImpl::RegisterAndCreateWindow()
{
RECT rc = {0, 0, 200, 60};
Create (hwndParent_, rc, NULL, WS_CHILD);
return IsWindow() != 0;
}

and destroys here
HRESULT DashboardImpl::CloseDWImpl (DWORD dwReserved)
{
//
if (IsWindow())
DestroyWindow();

return S_OK;
}

but when i close the toolbar the explorer crashes if dllMain method for first dll has been invoked with DLL_PROCESS_DETACH parameter.
I don't know how to fix it and I'm asking for your help///
 
Try to comment destroying methods and see what happens. Put there the method which creates problems.

Ion Filipski
1c.bmp
 
Hello, Ion.

I tryed to comment all destroying methods, but it was not helpful.
I can only tell that explorer crashes because of access violation just after dllMain method has finished. Consequently the error appears not in my own code, explorer generates it. I just have something in my code that makes him do it. And I ask maybe you've ever seen something like that and can tip me how to resolve it or some workaround way...
 
Of course the error is generated indirectly by your code, and result in a crash in the internet explorer. In most cases it happens when you have free/delete/release/destroy-ed something in your program and internet explorer try to free/delete/release/destroy the same thing which is already free/delete/release/destroy-ed. You should just see which one. I think if you have got some interfaces from InternetExplorer you should detach them from smart poinetrs, so they will not be released and IE will not try to do it again. Also see any data you pass to IE and release in your program. For example be attentive at SysAllocString/SysFreeString, and also be attentive while you work with _bstr_t, _variant_t. So, there are so many cases...

Ion Filipski
1c.bmp
 
sorry. I need to define more exactly. I meant windows explorer not internet explorer.
I commented all logic that was not related with loading and unloading of dlls. That was not helpful. Maybe the problem lives somewhere in registering/unregistering classes or creating/destroying local windows?
 
I this case it could be a problem when you unload the dll before explorer expects it. Explorer is trying do do some operations with your dll, but it is unloaded already.

Ion Filipski
1c.bmp
 
Yes. That's it. I'm getting access violation after DllMain detach. Explorer tryes to do something else with my dll after it's been unloaded.
But I don't have any obvious deletings inside my code (I have commented them). And I don't know how to make the explorer to skip unloading...
I guess I simply have to to use some other technology.

Best regards, Artemy Kilin.
 
I think you shouln'd caer about dll unloading. Let it unload automatically when explorer unloads.

Ion Filipski
1c.bmp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top