|
-
Jan 19th, 2008, 07:12 AM
#1
Thread Starter
Frenzied Member
-
Jan 19th, 2008, 08:07 AM
#2
Hyperactive Member
-
Jan 19th, 2008, 09:01 AM
#3
Member
Re: Prevent Maximizing Window
On the Form's properties, set MaxButton to False. You can't do it in code because its read-only, i think.
-
Jan 19th, 2008, 10:24 AM
#4
Re: Prevent Maximizing Window
You can use SetWindowLong to remove the Maximize button from the Window style at runtime.
chem
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Jan 19th, 2008, 12:46 PM
#5
Re: Prevent Maximizing Window
Use the SetWindowPlacement API so you can specify the maximum size, normal size and other positioning/placement properties. Then when they "Maximize it will only max to the size you specify.
http://www.vbforums.com/showpost.php...0&postcount=18
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 
-
Jan 22nd, 2008, 10:55 PM
#6
Thread Starter
Frenzied Member
-
Jan 22nd, 2008, 10:56 PM
#7
Re: Prevent Maximizing Window
Very simple - set the MaxButton property in the IDE to False.
-
Jan 22nd, 2008, 11:05 PM
#8
Re: Prevent Maximizing Window
If your program "hangs" then you must have something wrong. You cant just give up on things without trying to fix them. That is what programmers do, debug code. 
Post code of what you are having trouble with
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 
-
Jan 23rd, 2008, 01:42 AM
#9
Thread Starter
Frenzied Member
Re: Prevent Maximizing Window
Very simple - set the MaxButton property in the IDE to False.
I can't do that because I need to set the MaxButton to False at runtime which VB doesn't allow.
If your program "hangs" then you must have something wrong. You cant just give up on things without trying to fix them. That is what programmers do, debug code
Yes...yes...I tried to debug it (otherwise I wouldn't have posted my follow-up question after 4 days) but couldn't find a way out
Actually this pertains to opening new browser windows when a button or a link is clicked in a web page (for e.g. the Manage Attachments button which exists in the page where users type their questions). Using the WebBrowser control's events ClientToHostWindow, WindowSetHeight, WindowSetLeft, WindowSetTop & WindowSetWidth, I have succeeded in opening new browser windows to the position & dimensions in which the new browser window has been programmed (by the website programmer) to open. This is how I did it:
Code:
Dim blnCH As Boolean
Dim iH As Integer
Dim iW As Integer
Private Sub Form_Activate()
'adjust the position & dimension of the new browser window only if a
'new browser window is programmed to open; not if user right-clicks a
'link & then selects Open in New Window
If (blnCH = True) Then
wWeb.Top = 0
wWeb.Left = 0
wWeb.Height = iH * Screen.TwipsPerPixelY
wWeb.Width = iW * Screen.TwipsPerPixelX
End If
End Sub
Private Sub wWeb_ClientToHostWindow(CX As Long, CY As Long)
blnCH = True
Me.WindowState = vbNormal
'this is where I added your code RobDog
End Sub
Private Sub wWeb_WindowSetHeight(ByVal Height As Long)
iH = Height
Me.Height = Height * Screen.TwipsPerPixelY
End Sub
Private Sub wWeb_WindowSetLeft(ByVal Left As Long)
Me.Left = Left * Screen.TwipsPerPixelX
End Sub
Private Sub wWeb_WindowSetTop(ByVal Top As Long)
Me.Top = Top * Screen.TwipsPerPixelY
End Sub
Private Sub wWeb_WindowSetWidth(ByVal Width As Long)
iW = Width
Me.Width = Width * Screen.TwipsPerPixelX
End Sub
What could be causing the browser to hang?
EDIT:
Forgot to add that it opens a new IE window as well.
ARPAN
IF YOU HAVE AN APPLE & I HAVE AN APPLE AND WE EXCHANGE THE APPLES, THEN YOU & I WILL STILL HAVE ONE APPLE BUT IF YOU HAVE AN IDEA & I HAVE AN IDEA AND WE EXCHANGE OUR IDEAS, THEN EACH OF US WILL HAVE TWO IDEAS!
NOTHING IS IMPOSSIBLE IN THIS WORLD.....EVEN THE WORD IMPOSSIBLE SAYS I'M POSSIBLE!
PRACTICE MAKES A MAN PERFECT BUT NOBODY IS PERFECT; SO WHY PRACTICE?
-
Jan 23rd, 2008, 02:00 AM
#10
Thread Starter
Frenzied Member
-
Jan 23rd, 2008, 02:17 AM
#11
Re: Prevent Maximizing Window
OK now we are getting somewhere. The do loop is looking for the window handle. For whatever reason its not finding it. Is it a different string or different language perhaps?
When you place a breakpoint, what are the values? Caption to look for on the window and the actual caption of the window as reported by Spy++?
-
Jan 24th, 2008, 02:01 AM
#12
Thread Starter
Frenzied Member
Re: Prevent Maximizing Window
Yes you are right RobDog. The title of the new browser window gets assigned in the WebBrowser's DocumentComplete event which fires after the ClientToHostWindow event & I have put your code in the ClientToHostWindow event which means that when the Do loop executes, no title has been assigned to the new browser window which I think causes the browser to hang. Earlier the Do loop looked like this:
Code:
Do While lRet = 0
lRet = FindWindow(vbNullString, wWeb.LocationName)
Loop
I changed the code within the Do loop slightly:
Code:
Do While lRet = 0
lRet = FindWindow(vbNullString, vbNullString)
Loop
Now the app doesn't hang but users can still maximize the new browser window by clicking the icon on the titlebar.
What would you suggest?
ARPAN
IF YOU HAVE AN APPLE & I HAVE AN APPLE AND WE EXCHANGE THE APPLES, THEN YOU & I WILL STILL HAVE ONE APPLE BUT IF YOU HAVE AN IDEA & I HAVE AN IDEA AND WE EXCHANGE OUR IDEAS, THEN EACH OF US WILL HAVE TWO IDEAS!
NOTHING IS IMPOSSIBLE IN THIS WORLD.....EVEN THE WORD IMPOSSIBLE SAYS I'M POSSIBLE!
PRACTICE MAKES A MAN PERFECT BUT NOBODY IS PERFECT; SO WHY PRACTICE?
-
Jan 24th, 2008, 02:17 AM
#13
Re: Prevent Maximizing Window
What about using a hook?
Have a look at the Module in this sample,
http://www.Planet-Source-Code.com/vb...68724&lngWId=1
If you change the ptMaxSize to something like,
mm.ptMaxSize.X = 500
mm.ptMaxSize.Y = 500
When you maximize the form it will only be 500 by 500.
-
Jan 24th, 2008, 02:18 AM
#14
Re: Prevent Maximizing Window
Well by changing the Findwindow to both nullstrings you will be obtaining any open window of any class and title.
There should be a way for you enumerate all the child windows of your browser window. The only problem again is to know which is the new window.
The first thing I can think of is to populate a string array of all the open windows titles. Then when you click on the new window link you can enumerate the windows again and check for the one that is different which will be one additional and the defferent caption will be the new wndow.
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 
-
Jan 24th, 2008, 02:19 AM
#15
Re: Prevent Maximizing Window
 Originally Posted by Edgemeal
But you would have to know what window to hook and thats the problem.
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 
-
Jan 24th, 2008, 02:24 AM
#16
Re: Prevent Maximizing Window
Oh sorry, from the 1st post I thought it was a VB form you wanted to stop from maximizing.
-
Jan 24th, 2008, 03:10 AM
#17
Re: Prevent Maximizing Window
Well it is but its got a webbrowser control on it which in part of his stuff is opening another window from the html code which isnt a vb form.
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 
-
Jan 24th, 2008, 07:59 AM
#18
Thread Starter
Frenzied Member
Re: Prevent Maximizing Window
There's one very stupid way to ensure that maximizing the window doesn't maximize the window & this is that stupid approach (using the blnCH boolean variable shown in thread #9):
Code:
Private Sub Form_Resize()
If (blnCH = False) Then
'do resizing here for normal windows
Else
If Not (Me.WindowState = vbMinimized) Then
Me.WindowState = vbNormal
If (Me.Height > iH * Screen.TwipsPerPixelY) Then
Me.Height = iH * Screen.TwipsPerPixelY
End If
If (Me.Width > iW * Screen.TwipsPerPixelX) Then
Me.Width = iW * Screen.TwipsPerPixelX
End If
End If
Ed If
End Sub
When you try to maximize such a new browser window, then you can see the window maximizing momentarily after which it reverts back to the original height & width in the restored state! It looks sort of funny....gives an animated look to the window......
The 3rd & 4th If conditions aren't necessary but the 2nd one is a must otherwise even if users minimize the window, the window will refuse to minimize & restore its state back to normal.
ARPAN
IF YOU HAVE AN APPLE & I HAVE AN APPLE AND WE EXCHANGE THE APPLES, THEN YOU & I WILL STILL HAVE ONE APPLE BUT IF YOU HAVE AN IDEA & I HAVE AN IDEA AND WE EXCHANGE OUR IDEAS, THEN EACH OF US WILL HAVE TWO IDEAS!
NOTHING IS IMPOSSIBLE IN THIS WORLD.....EVEN THE WORD IMPOSSIBLE SAYS I'M POSSIBLE!
PRACTICE MAKES A MAN PERFECT BUT NOBODY IS PERFECT; SO WHY PRACTICE?
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
|