English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I have created a an ActiveX control in which one Button is Close button.
This button checks some information valid or not if found invalid information all project will end after prompting a message.
HOW CAN I DO IT. I have used "END" keyword but saying this keyword will nor supoort in Dll project.

SIPLY: I WANT TO END UP CURRENT PROJECT/SOFTWARE USED MY ACTIVEX CONTROL.

thanks in advance

2007-01-30 00:45:00 · 3 answers · asked by Jack J 1 in Computers & Internet Programming & Design

3 answers

The only safe way is to find out top-most parent window and send Windows message to close it. Unloading forms does not neccesarily solves the problem (the container must not be a VB form).
This requires you to learn about finding parent windows (Win API functions, explanations are good in MSDN) and do that for each parent until you find some window that has no parents (top-most) and send Win Message to close it (look in MSDN).

Simpler alternative is to provide an public event e.g. DoShutdown() on your control that is raised when Close button validation fails. On the form that contains your control handle the event and put the "End" there.

2007-01-30 06:13:39 · answer #1 · answered by BataV 3 · 0 1

I woud suggest putting a boolean property on your ocx that says whether or not to end the current application. And then check that property within the actual project. From there unload all forms and end politely.

Hope that helps!

2007-01-30 09:10:41 · answer #2 · answered by Special Ed 5 · 0 0

Figure out how to access the PARENT FORM from the ActiveX control, and then UNLOAD the PARENT FORM.

2007-01-30 12:33:24 · answer #3 · answered by Richard H 7 · 0 0

fedest.com, questions and answers