16. januar 2006 - 13:25Der er
15 kommentarer og 1 løsning
Fjern knappen til at lukke og maksemere i højre hjørne
Er det mugligt at fjerne eller deaktivere kmapperne til at lukke (X) eller Maksimere/Minimere i højre øverste hjørne, eller fjerne hele linjen (ligesom når der er fuld skærm), men det skal bare stadig en vindue.
Prøv at sætte dette her ind i et nyt modul og kør Sub HideX
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
Sub HideX()
Dim hWnd As Long, a As Long hWnd = FindWindow(vbNullString, Application.Caption) a = GetWindowLong(hWnd, GWL_STYLE) SetWindowLong hWnd, GWL_STYLE, a And Not WS_SYSMENU
Men tøv lige en kende. Hvis nu bak kan forklare hvordan (hvis man kan) få den til at fungere ved åbning af en mappe, det kunne jeg nemlig ikke få den til igår, så synes jeg vi skal dele points.
Tak skal du have faqpoler, men har du fået makroen til at virke ved åbning af Excel, så vil jeg gerne vide hvordan? Det undrer mig lidt, at jeg kan kalde andre makroer, men ikke lige denne!
Det gør du ved at kalde makroen fra workbook_open eller fra sub auto_open og samtidig tvinge en skærmopdatering igennem med screenupdating
Option Explicit Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Const GWL_STYLE = -16 Const WS_SYSMENU = &H80000
Sub HideX()
Dim hWnd As Long, a As Long hWnd = FindWindow(vbNullString, Application.Caption) a = GetWindowLong(hWnd, GWL_STYLE) SetWindowLong hWnd, GWL_STYLE, a And Not WS_SYSMENU Application.ScreenUpdating = True
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long Const GWL_STYLE = -16 Const WS_SYSMENU = &H80000
Sub Auto_Open() HideX End Sub
Sub HideX()
Dim hWnd As Long, a As Long hWnd = FindWindow(vbNullString, Application.Caption) a = GetWindowLong(hWnd, GWL_STYLE) SetWindowLong hWnd, GWL_STYLE, a And Not WS_SYSMENU End Sub
Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.