|
-
Jun 4th, 2006, 12:15 AM
#1
Thread Starter
Addicted Member
Would it be possible ..... ???
Hi there,
One item which always interested me, was if it is possible to use a message box not as a pop up window but as part of a container i.e. picture box or so to open up ONLY in that container and any error message for that matter as well ??? So what I'm trying to get is a guided operation of that so beloved MsBox.
Maybe somebody could help in any way ???.
Thanks aktell
-
Jun 4th, 2006, 12:42 AM
#2
Re: Would it be possible ..... ???
I really dont think so AFAIK but its a whole lot easier if you create a small form that duplicates a msgbox. Then use the SetParent API to nest the form into your container.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 4th, 2006, 02:35 AM
#3
Thread Starter
Addicted Member
Re: Would it be possible ..... ???
Thanks alot it is a beginning and I will try to find something on these lines.
There is not anything you would know of how it's or has been done ???.
Thanks aktell
-
Jun 4th, 2006, 04:07 AM
#4
Re: Would it be possible ..... ???
Nope, just like I posted is your best bet.
VB/Office Guru™ (AKA: Gangsta Yoda™ ®)
I dont answer coding questions via PM. Please post a thread in the appropriate forum. 
Microsoft MVP 2006-2011
Office Development FAQ (C#, VB.NET, VB 6, VBA)
Senior Jedi Software Engineer MCP (VB 6 & .NET), BSEE, CET
If a post has helped you then Please Rate it! 
• Reps & Rating Posts • VS.NET on Vista • Multiple .NET Framework Versions • Office Primary Interop Assemblies • VB/Office Guru™ Word SpellChecker™.NET • VB/Office Guru™ Word SpellChecker™ VB6 • VB.NET Attributes Ex. • Outlook Global Address List • API Viewer utility • .NET API Viewer Utility •
System: Intel i7 6850K, Geforce GTX1060, Samsung M.2 1 TB & SATA 500 GB, 32 GBs DDR4 3300 Quad Channel RAM, 2 Viewsonic 24" LCDs, Windows 10, Office 2016, VS 2019, VB6 SP6 
-
Jun 4th, 2006, 05:04 PM
#5
Thread Starter
Addicted Member
Re: Would it be possible ..... ???
I just found this !!! within this Forum - http://www.vbforums.com/showthread.php?t=409165 - and it is a very simelar question I had ??? and you (RobDog888) where so kind to reply too.
Now as we are so far I really need some help to redirect ALL - AND ONLY the App's Error MsBoxes etc. of to this Form2 !!!
Thanks aktell
-
Jun 6th, 2006, 05:39 AM
#6
NonModal MessageBox Inside A Container
This is what I've tried. I'm using a timer, so there is a slight flickering.
I'll post again if I find any better way.
VB Code:
' add 2 form in the project
' place a picturebox, a command button and a timer in Form1
' and place this code inside Form1
Option Explicit
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Const MB_ICONASTERISK = &H40&
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Private Declare Function SetParent Lib "user32" (ByVal hWndChild As Long, ByVal hWndNewParent As Long) As Long
Private Declare Function MessageBoxNonModal Lib "user32" Alias "MessageBoxA" (ByVal hwnd As Long, ByVal lpText As String, ByVal lpCaption As String, ByVal wType As Long) As Long
Private Declare Function MoveWindow Lib "user32" (ByVal hwnd As Long, ByVal x As Long, ByVal y As Long, ByVal nWidth As Long, ByVal nHeight As Long, ByVal bRepaint As Long) As Long
'==============================================================================
Private Sub Form_Load()
Timer1.Enabled = False
End Sub
'==============================================================================
Private Sub Command1_Click()
Timer1.Interval = 5
Timer1.Enabled = True
'shows non-modal messagebox
' (Form2 is a hidden form)
Call MessageBoxNonModal(Form2.hwnd, "Hi! I'm inside PictureBox", _
"MessageBox inside PictureBox", MB_ICONASTERISK)
End Sub
'==============================================================================
Private Sub Timer1_Timer()
Dim hMsgBox As Long
Dim rectMsgBox As RECT
Timer1.Enabled = False
' Find the hWnd of the MessageBox
hMsgBox = FindWindow("#32770", "MessageBox inside PictureBox")
' Get screen co-ordinate of the MessageBox
GetWindowRect hMsgBox, rectMsgBox
'Change the messagebox's parent.
SetParent hMsgBox, Picture1.hwnd
'Move the Messagebox to PictureBox's top,left corner
MoveWindow hMsgBox, 0, 0, (rectMsgBox.Right - rectMsgBox.Left), (rectMsgBox.Bottom - rectMsgBox.Top), 1
End Sub
'==============================================================================
Private Sub Form_Unload(Cancel As Integer)
'This ensures that all forms get unloaded
UnloadAll
End Sub
Inside a Module:
VB Code:
' Inside a Module
Option Explicit
Public Sub UnloadAll()
'Unloads all Form from Forms collection
Dim frm As Form
For Each frm In Forms
Unload frm
Next
End Sub
-
Jun 8th, 2006, 05:21 AM
#7
Thread Starter
Addicted Member
Re: Would it be possible ..... ???
Hi there,
I'm very impressed Thank You Very Much. Please don't hessitate to get back to me if you find more.
Thanks aktell
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|