home *** CD-ROM | disk | FTP | other *** search
- /* ************************************ **
- * Name: dynamix.h
- * Enthält die Klassendefinitionen
- * für die Anwendung und die dyna-
- * mischen Dialoge.
- * Update: 12-Dec-1992 tw
- ** ************************************ */
-
- // ///////////////////////////////////////
- // MainWindow
- // Das Applikations-Hauptfenster. In
- // diesem Fall eine Dialogbox
- // Update: 12-Dec-1992 tw
- // ///////////////////////////////////////
- class MainWindow : public CDialog
- {
- public:
- // Construction
- MainWindow()
- {
- VERIFY( Create( dynamix ));
- }
-
- // Capture Close-Message
- afx_msg void OnClose()
- {
- PostQuitMessage( 0 );
- }
-
- // Capture Button clicked message
- void OnBtnClicked();
-
- DECLARE_MESSAGE_MAP();
- };
-
- // ///////////////////////////////////////
- // Die Anwendung
- // Enthält in diesem Fall nur die init-
- // instance-funktion
- // ///////////////////////////////////////
-
- class theApp : public CWinApp
- {
- public:
- BOOL InitInstance();
-
- };
-
- // ********[ dynamische Dialog ]**********
-
- // DLGTEMPLATE, wie im Resources Manual
- // verlangt, nur das der Speicher für
- // die strings hier noch nicht definiert
- // werden können
- // Selbiges gilt für das
- // das DLGITEMTEMPLATE
-
- typedef struct tagDLGTEMPLATE
- {
- LONG Style; // style bits
- BYTE nItems; // Anzahl dialogelemente
- int x; // left side
- int y; // top
- int width; // breite
- int height; // hoehe
-
- } DLGTEMPLATE, FAR *LPDLGTEMPLATE;
-
- typedef struct tagDLGITEMTEMPLATE
- {
- int x;
- int y;
- int width;
- int height;
- int ID;
- LONG Style;
-
- } DLGITEMTEMPLATE,
- FAR *LPDLGITEMTEMPLATE;
-
- // ///////////////////////////////////////
- // XDynamicDialogBox
- // Eine Klasse für die dynamische Er-
- // zeugung von Dialogboxen.
- // Die Klasse ist von CModalDialog
- // abgeleitet, und enthält einige
- // private Daten, die für die Kapselung
- // der etwas komplexen Speicherver-
- // waltung benötigt werden.
- // Update: 12-Dec-1992 tw
- // ///////////////////////////////////////
-
- class XDynamicDialogBox :
- public CModalDialog
- {
- private:
- // Handle auf globalen speicher
- HANDLE m_hMem;
-
- // anzahl byte, die über das Handle
- // erreicht werden können
- int m_nBytes;
-
- // Anzhal Kontrollelemente auf dem
- // Dialog
- int m_nItems;
-
- public:
- // Construction/Destruction
- XDynamicDialogBox(CWnd* pParentWnd=NULL)
- : CModalDialog( (UINT)NULL, pParentWnd )
- {
- m_hMem = NULL;
- m_nBytes = 0;
- m_nItems = 0;
- }
- ~XDynamicDialogBox()
- {
- ASSERT( m_hMem );
- GlobalFree( m_hMem );
- }
-
- // Funktionen zum definieren der Box
- // sowie der einzelnen Kontrollelemente
-
- void DefineBox( LONG style, int x,
- int y, int cx, int cy,
- LPSTR szMenuName,
- LPSTR szClassName,
- LPSTR szCaption );
- void AddItem( int x, int y, int cx,
- int cy, int nID,
- LONG style,
- LPSTR szClass,
- LPSTR szText,
- BYTE DataBytes,
- LPBYTE pData );
-
- int DoModal()
- {
- ASSERT( m_hMem );
- ASSERT( m_nBytes );
- VERIFY(
- CModalDialog::CreateIndirect(
- m_hMem ));
- return CModalDialog::DoModal();
- }
-
- };
-