Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

Reloading an ActiveX control

Posted on 2006-04-27
6
Medium Priority
?
701 Views
Last Modified: 2013-11-18
I have an ATL ActiveX control that works, but it's crashing every time I hit reload because the software doesn't appear to exit entirly before running through the initalization again.

The WM_DESTROY event runs, but it imidatly starts up with WM_INITDIALOG again before quitting.

How do I make the plugin fully exit, and then re-launch when the user hits reload in the browser?
0
Comment
Question by:GENTP
  • 3
  • 2
6 Comments
 
LVL 8

Expert Comment

by:mrblue
ID: 16554319
I am a little bit confused.

1. "How do I make the plugin fully exit, and then re-launch when the user hits reload in the browser?" - do you use the control on some web page ?

2. Or maybe in dialog - "WM_INITDIALOG" ?

If you use different control will everything be OK ?
0
 
LVL 2

Accepted Solution

by:
MechanTOurS earned 2000 total points
ID: 16554786
U must make sure u destroy ur control correctly

1) check/debug your main ATL class destructor.
u may be doing something wrong there.

2) if u have threads running, make sure to stop them.

3) unload loaded DLLs

4) do u implement InPlaceActivate & InPlaceDeactivate method ?
see IOleInPlaceObjectWindowlessImpl && CComControlBase for details

exemple:

HRESULT InPlaceActivate(LONG iVerb, const RECT* prcPosRect = NULL)
{
      return CComControlBase::InPlaceActivate(iVerb, prcPosRect);
}

HRESULT InPlaceDeactivate(void)
{      
       // u may closeThreads here
      return IOleInPlaceObjectWindowlessImpl<CUrClassControl>::InPlaceDeactivate();
}

0
 
LVL 5

Author Comment

by:GENTP
ID: 16562234
I'm still trying to figure out how to do suggestions 1, 2, and 3.  Can you possibly help me out further with them?  4 on the other hand gives me errors when I try to add the functions you suggested.

error C2695: 'Cax3DPlugin::InPlaceDeactivate': overriding virtual function differs from 'ATL::IOleInPlaceObjectWindowlessImpl<T>::InPlaceDeactivate' only by calling convention

Now I did try calling InPlaceDeactivate(); in my WM_DESTROY function, but that didn't seem to work either.  It still doesn't cause the software to fully exit and re-launch.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 2

Expert Comment

by:MechanTOurS
ID: 16567987
1) do u know how to debug ur activeX ?
u need to place a breakpoint at the start of ur destructor,
then iterate each line with F10 until a line make ur activeX crash.
To enter a function call, press F11

2) are u running threads made with CreateThread function ?
if no, u shouldn't care about that one.

3) are u loading libraries with LoadLibrary function ?
if no, all is ok.

4) correction :

u should have in ur header :
STDMETHOD(InPlaceDeactivate)(void);

and in ur cpp file :
STDMETHODIMP Cax3DPlugin::InPlaceDeactivate(void)
{      
      return IOleInPlaceObjectWindowlessImpl<Cax3DPlugin>::InPlaceDeactivate();
}


u may debug / trace this line too


 
0
 
LVL 5

Author Comment

by:GENTP
ID: 16576667
1) yeah I know that much
2) I wasn't sure.  I'm converting a large code base and it looks like there are threads, but they're all handled properly.
3) Yes that is happening.  If things are working right now, would they be leaking?
4) InPlaceDeactivate doesn't seem to change anything.
0
 
LVL 2

Expert Comment

by:MechanTOurS
ID: 16584645
ok, try to disable/enable ur code incrementally.

- disable all but activeX base
- check it runs and quits normally
- then activate little part or level of ur code and check it runs and quits ok.

I can't tell u more without ur whole source project.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I made this because I wanted to get e-mail with a attached csv file so I'd would be able to import user input into a MS Excel template, but I also wanted to register/save all inputs from each day in a file on the server. 1st - It creates a temp C…
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
The goal of the video will be to teach the user the concept of local variables and scope. An example of a locally defined variable will be given as well as an explanation of what scope is in C++. The local variable and concept of scope will be relat…
The viewer will learn how to use the return statement in functions in C++. The video will also teach the user how to pass data to a function and have the function return data back for further processing.
Suggested Courses

810 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question