Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type MessageBox ¶
type MessageBox struct {
Title string
Message string
Flags flags.Parent
// contains filtered or unexported fields
}
MessageBox represents a Windows message box dialog with configurable properties. It provides methods to display and control a standard Windows message box.
func (MessageBox) Close ¶
func (m MessageBox) Close()
Close attempts to programmatically close an open message box with the matching title. It searches for a window with the same title as specified in the MessageBox struct and sends a WM_CLOSE message (0x0010) to terminate it. Note: This method may not work reliably if multiple windows have the same title or if the message box is not currently open.
func (MessageBox) GetHwnd ¶
func (m MessageBox) GetHwnd() (windows.HWND, error)
GetHwnd returns the window handle (HWND) associated with the MessageBox and an error. This handle references the parent window, if one was specified. It returns the stored hwnd value and nil error if valid, or an invalid HWND (0) with an error if the handle is uninitialized or invalid. Implements the BaseWindow interface from the winplus package.
func (MessageBox) IsVisible ¶
func (m MessageBox) IsVisible() bool
IsVisible checks if a message box with the matching title is currently visible. Returns true if a window with the specified title exists, false otherwise.
func (MessageBox) Open ¶
func (m MessageBox) Open() ReturnValue
Open displays the message box as a modal dialog and blocks until the user responds. The appearance and buttons are determined by the Flags field. Returns an integer representing the button pressed by the user:
- Common return values (see https://github.com/dywoq/winplus/tree/main/msgbox/returnvalues)
- See Windows API MessageBox documentation for full list of possible return values
func (MessageBox) OpenWithTimeout ¶
func (m MessageBox) OpenWithTimeout(timeout uint32) ReturnValue
OpenWithTimeout displays the message box with a timeout in milliseconds. After the timeout expires, the message box closes automatically. Returns the button pressed or 0 if timed out. Note: Requires flags.TaskModal flag to work properly in some Windows versions.
type ReturnValue ¶
type ReturnValue int
ReturnValue represents the return value from the Windows API. It indicates which button a user clicked in a message box dialog. The values correspond to the Windows API return codes as defined in the Windows SDK.