home *** CD-ROM | disk | FTP | other *** search
- VERSION 2.00
- Begin Form MainWindow
- BackColor = &H00C0C0C0&
- BorderStyle = 3 'Fixed Double
- Caption = "Menu Embedding Demo"
- ClipControls = 0 'False
- FontBold = -1 'True
- FontItalic = 0 'False
- FontName = "System"
- FontSize = 9
- FontStrikethru = 0 'False
- FontUnderline = 0 'False
- Height = 1455
- Icon = AAFRAME.FRX:0000
- KeyPreview = -1 'True
- Left = 2205
- LinkMode = 1 'Source
- LinkTopic = "Form1"
- MaxButton = 0 'False
- ScaleHeight = 1020
- ScaleWidth = 3630
- Top = 1830
- Width = 3780
- Begin PictureBox EmbedMenu
- Height = 315
- Left = 1590
- ScaleHeight = 285
- ScaleWidth = 1860
- TabIndex = 1
- Top = 420
- Width = 1890
- End
- Begin CommandButton Command1
- BackColor = &H00C0C0C0&
- Caption = "E&xit"
- Height = 315
- Left = 150
- TabIndex = 0
- Top = 420
- Width = 1245
- End
- Sub Command1_Click ()
- Unload MenuForm
- Unload MainWindow 'Dumps the VB form.
- End 'Shuts down the VB app.
- End Sub
- Sub CtlInit (D As Control, OutIn As Integer)
- 'This is for the concave look.
- LowLight D, OutIn
- End Sub
- Sub Form_KeyDown (KeyCode As Integer, Shift As Integer)
- Const Alt_Mask = 4
- Const Key_E = 69
- AltDown = (Shift And Alt_Mask) > 0
- If KeyCode = Key_E Then
- If AltDown Then
- MenuForm.SetFocus
- SendKeys "%E"
- End If
- End If
- End Sub
- Sub Form_Load ()
- 'This sets the defaultwidth of the 3d frames; you can muck
- 'with the width in the BAS General Declarations const declaration
- 'near the end of the file; it's at 1 now. Higher nos.
- 'make it wider.
- FrameWidth = DEFAULTWIDTH
- MainWindow.Show
- 'Here we get various stuff useful for embedding the menu form.
- Call GetWindowRect(MainWindow.EmbedMenu.hWnd, lpRect)
- capsize% = GetSystemMetrics(SM_CYCAPTION)
- xbordwidth% = GetSystemMetrics(SM_CXFRAME) - GetSystemMetrics(SM_CXBORDER)
- ybordheight% = GetSystemMetrics(SM_CYFRAME) - GetSystemMetrics(SM_CYBORDER)
- Load MenuForm
- MenuForm.Show
- 'Tell it where it belongs--in the main form's picture box.
- a% = SetParent(MenuForm.hWnd, MainWindow.EmbedMenu.hWnd)
- 'Now put it into place.
- Call SetWindowPos(MenuForm.hWnd, 0, -xbordwidth%, -ybordheight%, 500, 3000, SWP_NOZORDER)
- MainWindow.SetFocus 'Return focus to our main window.
- End Sub
- Sub Form_Paint ()
- 'This makes controls convex
- PaintFrames CTLRAISED
- 'This makes them concave
- PaintTexts CTLRECESSED
- MenuForm.SetFocus
- SendKeys "%E{ESC 2}" '"{F10}"
- q% = DoEvents()
- MainWindow.SetFocus 'Return focus to our main window.
- End Sub
- Sub InitCtl (C As Control, InOut As Integer)
- 'This is for the convex look.
- Highlight C, InOut
- End Sub
- Sub PaintFrames (InOut As Integer)
- 'Sets each listed control for convex 3D look.
- InitCtl Command1, InOut
- End Sub
- Sub PaintTexts (OutIn As Integer)
- 'Sets each listed control for concave 3D look.
- CtlInit EmbedMenu, OutIn
- End Sub
-