I'm trying to create show and hide buttons in Access that will hide all open windows and create sort of an 'instance' or 'group' every time I click hide, then probably through the use of a list box I need to be able to manage those instances and toggle which is shown or hidden. I'm really new to programming and I'm basically just learning through reading forum posts. Below is what I have so far, it would be great to get some insight as to where I'm going wrong and what direction I need to head in next.
I'm trying to start by just getting the windows to show and hide in the taskbar with the use of two buttons (show/hide), I'm not getting any errors though. I've read that apparently that can happen when trying to use API calls?
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
Private Const GWL_EXSTYLE = (-20)
Private Const WS_EX_APPWINDOW = &H40000
Private Sub Command1_Click()
Dim WindowsFlags
WindowsFlags = SetWindowLong(hWnd, GWL_EXSTYLE, Style) 'get current flags
NewFlags = WindowsFlags And Not WS_EX_APPWINDOW
SetWindowLong Me.hWnd, GWL_EXSTYLE, (NewFlags)
' hide this form from the taskbar
SetWindowLong Me.hWnd, GWL_EXSTYLE, (GetWindowLong(hWnd, _
GWL_EXSTYLE) And Not WS_EX_APPWINDOW)
End Sub
Private Sub Command2_Click()
Dim WindowsFlags
WindowsFlags = SetWindowLong(hWnd, GWL_EXSTYLE, Style) 'get current flags
NewFlags = WindowsFlags And Not WS_EX_APPWINDOW
SetWindowLong Me.hWnd, GWL_EXSTYLE, (NewFlags)
' show this form from the taskbar
SetWindowLong Me.hWnd, GWL_EXSTYLE, (GetWindowLong(hWnd, _
GWL_EXSTYLE) Or WS_EX_APPWINDOW)
End Sub
This post has been edited by Atli: 16 December 2012 - 06:29 PM
Reason for edit:: Use [code] tags when posting code.

New Topic/Question
This topic is locked



MultiQuote







|