Live-Forum - Die aktuellen Beiträge
Anzeige
Archiv - Navigation
740to744
Aktuelles Verzeichnis
Verzeichnis Index
Übersicht Verzeichnisse
Vorheriger Thread
Rückwärts Blättern
Nächster Thread
Vorwärts blättern
Anzeige
HERBERS
Excel-Forum (Archiv)
20+ Jahre Excel-Kompetenz: Von Anwendern, für Anwender
740to744
740to744
Aktuelles Verzeichnis
Verzeichnis Index
Verzeichnis Index
Übersicht Verzeichnisse
Inhaltsverzeichnis

UF festlegen

UF festlegen
08.03.2006 09:11:48
walter
Guten Morgen,
ich habe folgendes Makr, womit die UF nicht versetzt werden konnte.
Bei meiner alten Version funktioniert nur jetzt aktuell nicht, WAS kann das sein?
&ltpre&gt
Private Sub UserForm_Initialize()
Dim UFEingang
'--------------- für Bildschirmanpassung --------------------------------------
Dim hwndForm As Long, hwndMenu As Long
Dim intY, intLast, intNext As Integer
'------------------------------------------------------------------------------
On Error Resume Next
With UFEingang
StartUpPosition = 0
Top = 0
Left = 0
Height = GetDeviceCaps(GetDC(0&), 8)
Width = GetDeviceCaps(GetDC(0&), 10)
End With
ReleaseDC 0, GetDC(0&)
hwndForm = FindWindow(vbNullString, Me.Caption)
'-------- ab hier festgelegt, UF kann nicht verschoben werden --------------
If hwndForm &lt&gt 0 Then
hwndMenu = GetSystemMenu(hwndForm, 0)
If hwndMenu &lt&gt 0 Then DeleteMenu hwndMenu, &HF010, &H0
End If
'---------------------------------------------------------------------------
End Sub&lt/pre&gt
Gruß Walter

4
Beiträge zum Forumthread
Beiträge zu diesem Forumthread

Betreff
Datum
Anwender
Anzeige
AW: UF festlegen
08.03.2006 09:47:54
Nepumuk
Hallo Walter,
versuch es mal so:
Option Explicit

Private Declare Function GetDeviceCaps Lib "gdi32.dll" ( _
    ByVal hdc As Long, _
    ByVal nIndex As Long) As Long
Private Declare Function GetDC Lib "user32.dll" ( _
    ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32.dll" ( _
    ByVal hwnd As Long, _
    ByVal hdc As Long) As Long
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" ( _
    ByVal lpClassName As String, _
    ByVal lpWindowName As String) As Long
Private Declare Function GetSystemMenu Lib "user32.dll" ( _
    ByVal hwnd As Long, _
    ByVal bRevert As Long) As Long
Private Declare Function DeleteMenu Lib "user32.dll" ( _
    ByVal hMenu As Long, _
    ByVal nPosition As Long, _
    ByVal wFlags As Long) As Long

Private Const SC_MOVE As Long = &HF010&
Private Const MF_BYCOMMAND As Long = &H0&
Private Const HORZRES = 8&
Private Const VERTRES = 10&
Private Const GC_CLASSNAMEMSEXCELFORM = "ThunderDFrame"

Private Sub UserForm_Activate()
    Dim hwndForm As Long, hwndMenu As Long
    With Me
        .StartUpPosition = 0
        .Top = 0
        .Left = 0
        .Height = GetDeviceCaps(GetDC(0&), HORZRES)
        .Width = GetDeviceCaps(GetDC(0&), VERTRES)
    End With
    ReleaseDC 0, GetDC(0&)
    hwndForm = FindWindow(GC_CLASSNAMEMSEXCELFORM, Me.Caption)
    If hwndForm <> 0 Then
        hwndMenu = GetSystemMenu(hwndForm, 0)
        If hwndMenu <> 0 Then DeleteMenu hwndMenu, SC_MOVE, MF_BYCOMMAND
    End If
End Sub

Gruß
Nepumuk

Anzeige
Ja aber
08.03.2006 10:35:26
walter
Hallo Nepumuk,
funktioniert Super Danke.
Frage:
Funktioniert dies auch unter Excel97/2000, da ich zu Hause nur die habe ?
gruß walter
AW: Ja aber
08.03.2006 14:07:24
Nepumuk
Hallo Walter,
Versionsunabhängig:
Option Explicit

Private Declare Function GetDeviceCaps Lib "gdi32.dll" ( _
    ByVal hdc As Long, _
    ByVal nIndex As Long) As Long
Private Declare Function GetDC Lib "user32.dll" ( _
    ByVal hwnd As Long) As Long
Private Declare Function ReleaseDC Lib "user32.dll" ( _
    ByVal hwnd As Long, _
    ByVal hdc As Long) As Long
Private Declare Function FindWindow Lib "user32.dll" Alias "FindWindowA" ( _
    ByVal lpClassName As String, _
    ByVal lpWindowName As String) As Long
Private Declare Function GetSystemMenu Lib "user32.dll" ( _
    ByVal hwnd As Long, _
    ByVal bRevert As Long) As Long
Private Declare Function DeleteMenu Lib "user32.dll" ( _
    ByVal hMenu As Long, _
    ByVal nPosition As Long, _
    ByVal wFlags As Long) As Long

Private Const SC_MOVE As Long = &HF010&
Private Const MF_BYCOMMAND As Long = &H0&
Private Const HORZRES = 8&
Private Const VERTRES = 10&
Private Const GC_CLASSNAMEMSEXCELFORM5 = "ThunderXFrame"
Private Const GC_CLASSNAMEMSEXCELFORM6 = "ThunderDFrame"

Private Sub UserForm_Activate()
    Dim hwndForm As Long, hwndMenu As Long
    With Me
        .StartUpPosition = 0
        .Top = 0
        .Left = 0
        .Height = GetDeviceCaps(GetDC(0&), HORZRES)
        .Width = GetDeviceCaps(GetDC(0&), VERTRES)
    End With
    ReleaseDC 0, GetDC(0&)
    Select Case Val(Application.Version)
        Case 8
            hwndForm = FindWindow(GC_CLASSNAMEMSEXCELFORM5, Me.Caption)
        Case Else
            hwndForm = FindWindow(GC_CLASSNAMEMSEXCELFORM6, Me.Caption)
    End Select
    If hwndForm <> 0 Then
        hwndMenu = GetSystemMenu(hwndForm, 0)
        If hwndMenu <> 0 Then DeleteMenu hwndMenu, SC_MOVE, MF_BYCOMMAND
    End If
End Sub

Gruß
Nepumuk

Anzeige
Danke o.t.
08.03.2006 21:37:29
Walter
Hallo Nepumuk,
herzlichen Dank, habe gerade getestet.
mfg walter

Links zu Excel-Dialogen

Beliebteste Forumthreads (12 Monate)

Anzeige

Beliebteste Forumthreads (12 Monate)

Anzeige
Anzeige
Anzeige