No error. 

Form B is contextual Help that is invoked from a Help button on a
messagebox, and once the permission to do what's on the messagebox is OKd or
Cancelled, I want the Help form to disappear. Independently, the application
does something depending on the users response, but I just want the Help
form to disappear. And, I don't want to implement a full contextual Help
system. 

 

  _____  

Ian Thomas
Victoria Park, Western Australia

  _____  

From: ozdotnet-boun...@ozdotnet.com [mailto:ozdotnet-boun...@ozdotnet.com]
On Behalf Of Glen Harvy
Sent: Saturday, December 18, 2010 12:10 PM
To: ozDotNet
Subject: Re: Closing form instance

 

Can you explain what you mean by 'automatically'. I can't come to grips with
the scenario and why you would need to use SendMessage at all.

Form A pops up a message box presumably because of an error. The message box
can show Form B which contains further detailed data about the error or the
price of eggs in China blah blah...



On 18/12/2010 12:49 PM, Ian Thomas wrote: 

I have an instance of a help form that is started from a Help button on a
messagebox, itself hosted on a Windows Form. It uses a handler for the
HelpRequested event, and distinguishes between different Help messages via
the tag property of the sender control. I think that is fairly standard or
commonly used. 

The only way I can find to close the help form automatically, is by storing
its handle and using SendMessage(hWnd, WM_CLOSE,0,0) which seems clumsy (I
believe any Form.Close() actually does the same, but it's the declarations
and single line bits of code in various places that just seems messy). 

Of course closing the application (or the form hosting the messagebox)
closes the help form, and I don't see any bad side-effects anywhere. 

Are there better ways? 

  _____  

Ian Thomas
Victoria Park, Western Australia

Reply via email to