Gissan Skrevet 25. august 2006 Skrevet 25. august 2006 Hvordan kan man enable (ta av, låse) avslutt-knappen (x-en oppe i hjørnet) i VB 6.0? Hilsen, tissedam!
aadnk Skrevet 25. august 2006 Skrevet 25. august 2006 Legg til følgende kode i øverst (dog under Option Explicit) i formkodevinduet: Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As LongPrivate Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long Private Const MF_BYCOMMAND = &H0& Private Const SC_CLOSE = &HF060& Public Sub SetXState(Form As Form, bState As Boolean) Dim hMenu As Long ' Hent peker til formets menylinje hMenu = GetSystemMenu(Form.hwnd, blnState) ' Endre menyelement og oppdater RemoveMenu hMenu, SC_CLOSE, MF_BYCOMMAND DrawMenuBar Form.hwnd End Sub Deretter kan du "disable" X-tasten således: SetXState Me, False . Det motsatte er opplagt nok slik: SetXState Me, True
Gissan Skrevet 25. august 2006 Forfatter Skrevet 25. august 2006 Legg til følgende kode i øverst (dog under Option Explicit) i formkodevinduet: Private Declare Function GetSystemMenu Lib "user32" (ByVal hwnd As Long, ByVal bRevert As Long) As LongPrivate Declare Function RemoveMenu Lib "user32" (ByVal hMenu As Long, ByVal nPosition As Long, ByVal wFlags As Long) As Long Private Declare Function DrawMenuBar Lib "user32" (ByVal hwnd As Long) As Long Private Const MF_BYCOMMAND = &H0& Private Const SC_CLOSE = &HF060& Public Sub SetXState(Form As Form, bState As Boolean) Dim hMenu As Long ' Hent peker til formets menylinje hMenu = GetSystemMenu(Form.hwnd, blnState) ' Endre menyelement og oppdater RemoveMenu hMenu, SC_CLOSE, MF_BYCOMMAND DrawMenuBar Form.hwnd End Sub Deretter kan du "disable" X-tasten således: SetXState Me, False . Det motsatte er opplagt nok slik: SetXState Me, True 6741526[/snapback] Takk for hjelpen! Fant det ut nå.
Anbefalte innlegg
Opprett en konto eller logg inn for å kommentere
Du må være et medlem for å kunne skrive en kommentar
Opprett konto
Det er enkelt å melde seg inn for å starte en ny konto!
Start en kontoLogg inn
Har du allerede en konto? Logg inn her.
Logg inn nå