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