04. februar 2002 - 13:45Der er
25 kommentarer og 3 løsninger
Åbne database i maximeret vindue
Jeg åbner én database fra en anden ved hjælp af nedenstående modul, som jeg har lånt fra et af terrys tidligere svar, men jeg kan ikke få det til at åbne den nye database i et maximeret vindue. Jeg er kommet frem til at det er hwnd værdien, som ikke skal være 0, men jeg kan ikke finde den rigtige værdi. Er der nogen som kan hjælpe?
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Public Const SW_HIDE = 0 Public Const SW_SHOW = 5
Function OpenDb() as integer Dim result As Integer
result = ShellExecute(0, "Open", "YourDatabase.mdb", "", "C:\temp", SW_SHOW)
I have a startup form, but I don't want to maximize that. I want to maximize the Access window so that the size of the Access window don't resize my startup form. I think it's a matter of finding the right hwnd value, but I can't find these values anywhere.
It is possible to use the windows API call (ShowWindow) to maximize Access, but as you mention yourself you need the windows handle (Hwnd) to be able to do this and I am not quiet sure how to do this.
Public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Public Const SW_HIDE = 0 Public Const SW_MAXIMIZED = 3 Public Const SW_SHOW = 5
Function OpenDb() as integer Dim result As Integer
result = ShellExecute(0, "Open", "YourDatabase.mdb", "", "C:\temp", SW_MAXIMIZED)
end function
This works here! What operating system are you using, although I cant see why it shouldnt
shellExecute is a Windows API call, so no references are needed. It may very well be possible that some API calls react differently between different versions of Windows.
Du får en HPROCESS fra ShellExecuteEx. Jeg har selv hele Win32 API'et, men kan ikke finde noget om hvordan man finder en window handle ud fra en process handle. Det MÅ man da kunne!
OK! In the Shellexecute it is possible to use SW_SHOWMAXIMIZED which also activates the window, then there should be an API to get the hwnd of the active window, or?
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.