Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 749
  • Last Modified:

Disable close button on control box

I am creating an instance of IE and I dont want the close button to be displayed only minimize and maximize. Below is my code and the function to call the IE window from inside my Vb order entry app. I'm looking for the easiest method, even if it means disabling the whole bar and all controls. The form that is displayed will have a close button.

sAMZURL = "http://csmgr.amazon.com/operators/order.php?harp_op_id=" & MKPntObj.UserID & "&harp_dnis=" & MKPntObj.DNIS
            If g_strCompanyID = 126 Then
                'MsgBox sAMZURL
                Call LaunchIE(sAMZURL, False, False)
            End If

Private Sub LaunchIE(ByVal strUrl As String, ByVal blnToolBar As Boolean, ByVal blnStatusBar As Boolean)
    Dim objIE As Object
    Set objIE = CreateObject("InternetExplorer.Application")
    objIE.Toolbar = blnToolBar
    objIE.StatusBar = blnStatusBar
    objIE.Visible = True
    Call objIE.Navigate(strUrl)
    Set objIE = Nothing
End Sub
0
Dalexan
Asked:
Dalexan
  • 2
1 Solution
 
vinnyd79Commented:
Try adding this to the declarations area on your form:

Private Declare Function GetSystemMenu Lib "User32" (ByVal hWnd As Long, ByVal bRevert As Integer) As Integer
Private Declare Function RemoveMenu Lib "User32" (ByVal hMenu As Integer, ByVal nPosition As Integer, ByVal _
                            wFlags As Integer) As Integer
Const MF_BYPOSITION = &H400


Then change the sub routine to:

Private Sub LaunchIE(ByVal strUrl As String, ByVal blnToolBar As Boolean, ByVal blnStatusBar As Boolean)
    Dim objIE As Object
    Dim SysMenu As Long, Res As Long
    Set objIE = CreateObject("InternetExplorer.Application")
    objIE.Toolbar = blnToolBar
    objIE.StatusBar = blnStatusBar
    objIE.Visible = True
    Call objIE.Navigate(strUrl)
   
    SysMenu = GetSystemMenu(objIE.hWnd, 0)
    Res = RemoveMenu(SysMenu, 6, MF_BYPOSITION)
   
    Set objIE = Nothing
End Sub
0
 
DalexanAuthor Commented:
Wow, Thank you, that was quick and it works great.
0
 
DalexanAuthor Commented:
Perhaps you may have an answer for another question I have posted?

http://www.experts-exchange.com/Programming/Programming_Languages/Visual_Basic/Q_21878238.html
0

Featured Post

VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now