Fenstergrösse beschränken

EriFo

Erfahrenes Mitglied
Hallo miteinander,

ich hab 'nen Dialog, dessen Grösse Variabel ist, von dem ich aber nicht möchte, dass er eine bestimmte Grösse unterschreitet.
Es soll also irgendwann eine Art "Anschlag" kommen bei dem der Benutzer das Fenster nicht weiter verkleinern (/vergrössern) kann.

Ich habs mit allem möglichen probiert aber da ist nix gescheites bei rausgekommen. °-_-

M.f.G. Erik
 
scheint Wirkungslos

Klappt irgendwie nicht.
Ich kann zwar die Methode aufrufen und diese Struktur übergeben aber mein Programm beeindruckt das nicht sonderlich.

Wo müsste man die eigentlich aufrufen ? Momentan tue ich das noch in OnShowWindow();

M.f.G. Erik
 
Siehe MSDN , diese Funktion soll man nicht selber aufrufen die wird aufgerufen.

CWnd::OnGetMinMaxInfo
afx_msg void OnGetMinMaxInfo( MINMAXINFO FAR* lpMMI );

Parameters

lpMMI

Points to a MINMAXINFO structure that contains information about a window’s maximized size and position and its minimum and maximum tracking size. For more about this structure, see the MINMAXINFO structure.

Remarks

The framework calls this member function whenever Windows needs to know the maximized position or dimensions, or the minimum or maximum tracking size. The maximized size is the size of the window when its borders are fully extended. The maximum tracking size of the window is the largest window size that can be achieved by using the borders to size the window. The minimum tracking size of the window is the smallest window size that can be achieved by using the borders to size the window.

Windows fills in an array of points specifying default values for the various positions and dimensions. The application may change these values in OnGetMinMaxInfo.

Note This member function is called by the framework to allow your application to handle a Windows message. The parameters passed to your function reflect the parameters received by the framework when the message was received. If you call the base-class implementation of this function, that implementation will use the parameters originally passed with the message and not the parameters you supply to the function.




MINMAXINFO Structure
The MINMAXINFO structure has the following form:

typedef struct tagMINMAXINFO {
POINT ptReserved;
POINT ptMaxSize;
POINT ptMaxPosition;
POINT ptMinTrackSize;
POINT ptMaxTrackSize;
} MINMAXINFO;

The MINMAXINFO structure contains information about a window's maximized size and position and its minimum and maximum tracking size.

Members

ptReserved

Reserved for internal use.

ptMaxSize

Specifies the maximized width (point.x) and the maximized height (point.y) of the window.

ptMaxPosition

Specifies the position of the left side of the maximized window (point.x) and the position of the top of the maximized window (point.y).

ptMinTrackSize

Specifies the minimum tracking width (point.x) and the minimum tracking height (point.y) of the window.

ptMaxTrackSize

Specifies the maximum tracking width (point.x) and the maximum tracking height (point.y) of the window.

See Also CWnd::OnGetMinMaxInfo
 
Ich habs jetzt so gelöst. Klappt ziehmlich gut :

LRESULT CResultsDlg::WindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch (message)
{
case WM_GETMINMAXINFO:
((MINMAXINFO *)lParam)->ptMinTrackSize.x = 300;
((MINMAXINFO *)lParam)->ptMaxTrackSize.x = 1280;
((MINMAXINFO *)lParam)->ptMinTrackSize.y = 200;
((MINMAXINFO *)lParam)->ptMaxTrackSize.y = 960;
return 0;
default:
return CDialog::WindowProc(message, wParam, lParam);
}

}
 

Neue Beiträge

Zurück