UtterAccess.com
X   Site Message
(Message will auto close in 2 seconds)

Welcome to UtterAccess! Please ( Login   or   Register )

Custom Search
3 Pages V < 1 2 3 >  (Go to first unread post)
   Reply to this topicStart new topic
> Donít Show Application Icon In Taskbar, Access 2003    
 
   
akn_39
post Sep 26 2017, 04:38 PM
Post#21



Posts: 102
Joined: 9-June 09
From: Parksville, BC, Canada


Hi Colin: Thanks for your additional comments. Here are few more observations from my configuration:

- The last time this code (Access Web/Manipulate Access Window/Dev Ashish) worked cleanly for me (i.e. no MS/Access application window reappearing after switching application windows) was with Windows/XP and Access 2010. It started reappearing after switching to another application under Windows 7, so I don't know if reinstalling Windows 10 would help.
- If I switch to another application, and hover the cursor over the MS/Access Taskbar entry (without clicking) the preview is already showing the MS/Access application window behind the user/form window.
- If I switch to another application, and then switch back to Access using Alt-Tab instead of clicking on the Taskbar entry, the MS/Access application window does NOT reappear i.e. it behaves as expected.
- My workaround has been to re-invoke the fSetAccessWindow/SW_SHOWMINIMIZED at every form open - not very elegant, but better than nothing.

Cheers. . .

Tony N.
Go to the top of the page
 
akn_39
post Sep 26 2017, 07:03 PM
Post#22



Posts: 102
Joined: 9-June 09
From: Parksville, BC, Canada


Hi Colin: I think you have accurately summarized the effect I'm trying to achieve:

. . . hide all parts of the Access application (menu bar/ribbon/nav pane & application window) EXCEPT the form itself which appears 'floating' on the desktop.


Just as your example database does, and this is exactly what fSetAccessWindow accomplished for me until Windows 7. In my databases, all the forms are Popup = Yes. However, it was my understanding that Modal should also be set to Yes - this what I have I seen in other users' comments and what has worked for me. Setting Modal to No does not change the reappearing MS/Access application window issue.

I hope this clarifies what I am trying to do - see before and after screenshots. Essentially, what your example database does, only I would like it to stay that way after switching to another application.

Regards. . .

Tony N.

Attached File  Access_Form_Display__before_.jpg ( 588.04K )Number of downloads: 2

Attached File  Access_Window_Display__after_.png ( 99.21K )Number of downloads: 3
Go to the top of the page
 
PhilS
post Sep 27 2017, 04:59 AM
Post#23



Posts: 634
Joined: 26-May 15
From: The middle of Germany


@patriciaxxx:
QUOTE
Having already pointed out the flicker problem I get when resizing the popup form, I have uploaded a very simple stripped back example to demonstrate this.

Thank you for uploading the sample database.

I tried both prepared scenarios and I can confirm the issue 100%. On Access 2010+Windows 8.1 I see the flickering (or lack thereof) exactly as you described.
Removing the Form_Resize code does significant reduce the flickering, but it is still there while there is none at all with the other form.

I traced the windows messages send to each form on resize and they are exactly the same for both forms. I assume there is some Access internal issue causing the flickering. I've got not idea how this can possibly be solved.
Go to the top of the page
 
cheekybuddha
post Sep 27 2017, 05:23 AM
Post#24


UtterAccess VIP
Posts: 11,676
Joined: 6-December 03
From: Telegraph Hill


To avoid flickering, try this:
CODE
Private Sub Form_Resize()
On Error Resume Next
  Dim lHeight As Long, lWidth As Long
  Const SPACER As Double = 0.199 * 566.929133858
  lHeight = Me.InsideHeight
  lWidth = Me.InsideWidth
  With Me
    If Not .Section(0).Height = lHeight + SPACER Then
      .Section(0).Height = lHeight + SPACER
    End If
    If Not .fsubImage2.Height = lHeight - .fsubImage2.Top - SPACER - .Section(acHeader).Height Then
      .fsubImage2.Height = lHeight - .fsubImage2.Top - SPACER - .Section(acHeader).Height
    End If
    If Not .fsubImage2.Width = lWidth - .fsubImage2.Left - SPACER Then
      .fsubImage2.Width = lWidth - .fsubImage2.Left - SPACER
    End If
    If Not .fsubImage2.Form!imgImage2.Width = lWidth Then
      .fsubImage2.Form!imgImage2.Width = lWidth
    End If
    If Not .fsubImage2.Form!imgImage2.Height = lHeight Then
      .fsubImage2.Form!imgImage2.Height = lHeight
    End If
  End With
End Sub


Don't set a value unless it's necessary (ie not what it should be).

Also, don't requery a control in the resize sub!

hth,

d
Go to the top of the page
 
patriciaxxx
post Sep 27 2017, 05:49 AM
Post#25



Posts: 273
Joined: 20-December 12



ADezii Thank you for your reply, but would like the taskbar to remain unaltered. First goal was to remove the Access application button or tab or icon or whatever itís actually called from the taskbar (see screenshot which Iíve attached again). As an alternative (because my first goal seems to be unobtainable with Access 2003 / WinXP) I was going to make the Access application invisible but that seems hindered by the problem of a flickering image / form / subform issue on resize.
Unfortunately, so far at least, there doesnít seem to be a fix for the two options I would lilke to pursue?

Colin Thank you for your reply, no I donít think youíve lost the plot, I think your initial understanding of my first goal is correct. This tab or whatever it is that appears in the task bar seems to be referred to by different names by different people, which can and does lead to confusion. For further clarification read my comments to ADezii above and see my screenshot below.

PhilS Thank you for your reply, Iím glad that you can confirm this behavior and grateful to you for trying to solve the problem as this seems like the route I should go (in the absence of a solution to my first goal) .

David Thank you for your reply, fingers crossed, Iím going to try your code right now and will post the outcome shortly, thank you for your time and continuing to support this topic.
Attached File(s)
Attached File  img1.jpg ( 3.16K )Number of downloads: 0
 
Go to the top of the page
 
patriciaxxx
post Sep 27 2017, 06:05 AM
Post#26



Posts: 273
Joined: 20-December 12



Hello David

Just tried the code and unfortunately the result when resizing the form is exactly the same which is to say the image flickers just the same as before?

I just canít help but think that the key to solving this lies with the fact that if a long enough timer delay is used when loading the form and the invisible routine fired form the timer event then everythingís OK (I had to use 1 second as a minimum as less than this for me still resulted in the same flicker)

My experience is limited, but to me this suggests the form can work properly and the timer is either causing or setting or doing something which allows the form to resize without flicker. But I canít determine what that something is.
Go to the top of the page
 
cheekybuddha
post Sep 27 2017, 06:13 AM
Post#27


UtterAccess VIP
Posts: 11,676
Joined: 6-December 03
From: Telegraph Hill


You're definitely not still requerying the image control in the Resize event?
Go to the top of the page
 
patriciaxxx
post Sep 27 2017, 08:21 AM
Post#28



Posts: 273
Joined: 20-December 12



David Definitely not requerying, I used your exact code.

Colin It is strange that itís flicker free for you although it wasnít for PhilS It seems to suggest to me that the resize code you used, and that which I first used and also Davidís which I just tried, while all different are not what needs changing here to solve this weird behaviour? As for replacing the Access icon with a cutom icon, Iím sorry if I mislead you with my last comment but thatís not what my first goal is, I know how to do that. Iím trying to remove the whole button which is the same effect you get when the app window is made invisible. I donít need the app window to be invisible, Iím happy for it to be visible but I want the button on the taskbar gone, so Iím left with just the popup form in taskbar button which my popup form creates. The reason I switched to the app invisible option is because it doesnít look like Iím going to be successful in my first goal and the entire app invisible does at least address my first goal. The fact there are so many posts is because you are all tying to help me solve this problem and for that I am very grateful to everyone involved, and also because Tony N is seeking a solution to a problem he has encountered.

Thank you to one and all for your continued help and support.
Go to the top of the page
 
patriciaxxx
post Sep 27 2017, 10:38 AM
Post#29



Posts: 273
Joined: 20-December 12



Iím still trying to fathom the invisible app flicker problem and have uploaded a small example database.

The only change Iíve made is that here Iím loading the form and pressing a button on the form to make the app invisible and hey it works.

Needless to say I donít want to be pressing buttons to make the thing invisible it must all happen seamlessly / immediately upon start up.

Iím hoping that the example will mean enough to some one to know how to solve this flicker problem.

Any ideas, any one?
Attached File(s)
Attached File  db1_CR.zip ( 644.68K )Number of downloads: 13
 
Go to the top of the page
 
patriciaxxx
post Sep 28 2017, 06:38 AM
Post#30



Posts: 273
Joined: 20-December 12



Thank you Colin, Iíll play around with it, thank you for all your help.

I also thank everyone else who contributed to this post.
Go to the top of the page
 
patriciaxxx
post Sep 29 2017, 07:00 AM
Post#31



Posts: 273
Joined: 20-December 12



CODE
Option Compare Database
Option Explicit

Private Const WM_USER As Long = &H400
Private Const TB_HIDEBUTTON As Long = (WM_USER + 4)
Private Const TB_ISBUTTONHIDDEN As Long = (WM_USER + 12)
Private Const TB_DELETEBUTTON As Long = (WM_USER + 22)
Private Const TB_GETBUTTON As Long = (WM_USER + 23)
Private Const TB_BUTTONCOUNT = (WM_USER + 24)
Private Const TB_GETBUTTONTEXTA As Long = (WM_USER + 45)
Private Const TB_GETBUTTONTEXTW As Long = (WM_USER + 75)
Private Const TB_AUTOSIZE As Long = (WM_USER + 33)

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, ByVal wParam As Long, ByVal lParam As String) As Long

Private tWnd As Long

        
Private Sub Command1_Click()
    Dim bWnd As Long
  
    tWnd = FindWindow("Shell_TrayWnd", vbNullString)
    bWnd = FindWindowEx(tWnd, bWnd, "BUTTON", vbNullString) 'Start button handle

    tWnd = FindWindowEx(tWnd, 0, "ReBarWindow32", vbNullString)
    tWnd = FindWindowEx(tWnd, 0, "MsTaskSwWClass", vbNullString)
    tWnd = FindWindowEx(tWnd, 0, "ToolbarWindow32", vbNullString)  'Taskbar handle

    SendMessage tWnd, TB_BUTTONCOUNT, 0, 0
    
    SendMessage tWnd, TB_HIDEBUTTON, 1, 0
End Sub


CODE
Option Compare Database
Option Explicit

Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" (ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" (ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal lpsz2 As String) As Long
Private Declare Function ShowWindow Lib "user32" (ByVal hwnd As Long, ByVal nCmdShow As Long) As Long

'To hide the taskbar buttons
Private Sub Command1_Click()
Dim TaskBarWin As Long, TaskButtonWin As Long

                TaskBarWin = FindWindow("Shell_TrayWnd", vbNullString)
                TaskButtonWin = FindWindowEx(TaskBarWin, 0, "ReBarWindow32", vbNullString)
                ShowWindow TaskButtonWin, 0 'Hide Active Buttons
End Sub


CODE
'To show the taskbar buttons again
Private Sub Command2_Click()
                Dim TaskBarWin As Long, TaskButtonWin As Long

                TaskBarWin = FindWindow("Shell_TrayWnd", vbNullString) 'Find Taskbar
                TaskButtonWin = FindWindowEx(TaskBarWin, 0, "ReBarWindow32", vbNullString) 'Find TaskBar Button Area
                ShowWindow TaskButtonWin, 1 'Show Active Buttons
End Sub


I continued to research removing a button from he taskbar and have actually found some code that looks promising.

I hope that someone with more experience using apiís than me will read this post, review the three code snippets and be able to produce from them precisely the code I need.

The first code block seems to remove a folder button from the taskbar the second code block removes all the buttons and the third block puts them back.

I am trying to launch my Access db and hide only its application button for its instance only.

Can any one help?
Go to the top of the page
 
patriciaxxx
post Sep 29 2017, 09:15 AM
Post#32



Posts: 273
Joined: 20-December 12



Hello Colin and thank you for replying.

> show the app window but hide the taskbar icon

Yes.

If we look back my original posts it was clear, I think, or at least it seemed to be, what I was trying to accomplish. You only have to look at the image I posted showing the access app button (or whatever you want to call it) on the taskbar. Iím trying to open my db show the app, show my form, and hide the app button on the taskbar. And the following behaviour would also apply to what Iím trying to achieve.

> If I open another db whilst yours is open with window/taskbar icon hidden, the new db taskbar icon is visible & yours stays hidden.

The reason for the number of posts and time invested etc is a reflection of trying to succeed in this endeavour.

> I haven't read the code you posted but the amended version I posted the other day db2_CR.mdb already does what I think you're asking for.

No, not at all. First it hides the app (not what i really want) and second it only works from clicking the command button which I definitely donít want.

My Post#46 has unfortunately led you to believe I had solved my own problem, sorry for that. Its purpose was that I thought I had found something that might lead someone more experience than me to a solution. In any event the whole invisible app approach only came about as a poor substitute, because no was seemed able to solve my first problem.

There has been a lot of time invested but then like Tony N itís something that intrigues me and I do want to find the correct way of doing this. I can now see from that code I just posted (which I appreciate you say you havenít looked at yet) that there is indeed a solution to the problem. But i need help to find the right way.

Both before I posted this topic and during the responses etc I carried out a lot of online research and can say that what Iím trying to accomplish has been sought for in many programming languages, yet there remains no clear and precise example that I can find on the web to achieve it, and as for VBA examples, well there are none,

The first code block I posted hides a folder button from the taskbar, that is to say if you open a folder, then from Access run that first code block the folder button is hidden from the taskbar.

This suggests to me that what Iím trying to do is possible. Iím not as experience as some here especially when it comes to apiís therefore canít produce the proper code to do what I need, which of course is why Iím asking for help.

So in a nutshell can anyone provide the correct way ďto show the app window but hide the taskbar iconĒ.

Hopefully the code I posted in Post#49 will be sufficient for a more experienced VBA programmer to do this.
Go to the top of the page
 
patriciaxxx
post Sep 29 2017, 10:22 AM
Post#33



Posts: 273
Joined: 20-December 12



No worries Colin, I donít know how to solve it either. It would have been good to find the answer though. I was hoping someone here might have known.
Go to the top of the page
 
cheekybuddha
post Sep 29 2017, 11:48 AM
Post#34


UtterAccess VIP
Posts: 11,676
Joined: 6-December 03
From: Telegraph Hill


My guess is that you have to find the correct class to use in this line:
CODE
' ...
    tWnd = FindWindow("Shell_TrayWnd", vbNullString)
' or
'  TaskBarWin = FindWindow("Shell_TrayWnd", vbNullString)
' ...


I think the Access window class is "OMain". Using this class with your code in Win10 did not yield the desired result.

If that's not it, you can enumerate all the window classes on screen using this code (again gathered from Randy Birch):
CODE
Option Compare Database
Option Explicit

''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Copyright ©1996-2011 VBnet/Randy Birch, All Rights Reserved.
' Some pages may also contain other copyrights by the author.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' Distribution: You can freely use this code in your own
'               applications, but you may not reproduce
'               or publish this code on any web site,
'               online service, or distribute as source
'               on any media without express permission.
''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
Dim hwndSelected As Long
Dim sClassSelected As String
Dim sTitleSelected  As String

Private Type RECT
  Left    As Long
  Top     As Long
  Right   As Long
  Bottom  As Long
End Type

Private Type POINTAPI
  x       As Long
  y       As Long
End Type

Private Type WINDOWPLACEMENT
  Length            As Long
  flags             As Long
  showCmd           As Long
  ptMinPosition     As POINTAPI
  ptMaxPosition     As POINTAPI
  rcNormalPosition  As RECT
End Type

Private Const LB_SETTABSTOPS = &H192

Private Const GW_HWNDNEXT = 2
Private Const GW_CHILD = 5
Private Const GWW_ID = (-12)

Private Const SW_SHOWNORMAL = 1
Private Const SW_SHOWMINIMIZED = 2
Private Const SW_SHOWMAXIMIZED = 3
Private Const SW_SHOWNOACTIVATE = 4

Private Declare Function FindWindow Lib "user32" _
   Alias "FindWindowA" _
  (ByVal lpClassName As String, _
   ByVal lpWindowName As String) As Long
  
Private Declare Function GetDesktopWindow Lib "user32" () As Long

Private Declare Function GetWindow Lib "user32" _
  (ByVal hwnd As Long, _
   ByVal wCmd As Long) As Long

Private Declare Function GetWindowPlacement Lib "user32" _
  (ByVal hwnd As Long, _
   lpwndpl As WINDOWPLACEMENT) As Long

Private Declare Function GetWindowRect Lib "user32" _
  (ByVal hwnd As Long, _
   lpRect As RECT) As Long

Private Declare Function GetWindowText Lib "user32" _
   Alias "GetWindowTextA" _
  (ByVal hwnd As Long, _
   ByVal lpString As String, _
   ByVal cch As Long) As Long

Private Declare Function GetClassName Lib "user32" _
   Alias "GetClassNameA" _
  (ByVal hwnd As Long, _
   ByVal lpClassName As String, _
   ByVal nMaxCount As Long) As Long

Private Declare Function MoveWindow Lib "user32" _
   (ByVal hwnd As Long, _
    ByVal x As Long, ByVal y As Long, _
    ByVal nWidth As Long, ByVal nHeight As Long, _
    ByVal bRepaint As Long) As Long

Private Declare Function SendMessage Lib "user32" _
   Alias "SendMessageA" _
  (ByVal hwnd As Long, _
   ByVal wMsg As Long, _
   ByVal wParam As Long, _
   lParam As Any) As Long

Private Declare Function SetForegroundWindow Lib "user32" _
   (ByVal hwnd As Long) As Long

Private Declare Function SetWindowPlacement Lib "user32" _
  (ByVal hwnd As Long, _
   lpwndpl As WINDOWPLACEMENT) As Long

Private Declare Function ShowWindow Lib "user32" _
  (ByVal hwnd As Long, _
   ByVal nCommand5 As Long) As Long
  
Function EnumWindows(Optional strTitle As String = "*", _
                     Optional strClass As String = "*") As Boolean

  Dim hWnds() As Long
  Dim ret As Long
  
  ret = FindWindowLike(hWnds(), 0, strTitle, strClass)
  EnumWindows = ret > 0
  
End Function

Private Function FindWindowLike(hWndArray() As Long, _
                                ByVal hWndStart As Long, _
                                WindowText As String, _
                                Classname As String) As Long
  
   Dim hwnd As Long
   Dim sWindowText As String
   Dim sClassname As String
   Dim r As Long
      
  'Hold the level of recursion and
  'hold the number of matching windows
   Static level As Long
   Static found As Long
  
  'Initialize if necessary
   If level = 0 Then
     found = 0
     ReDim hWndArray(0 To 0)
     If hWndStart = 0 Then hWndStart = GetDesktopWindow()
   End If
  
  'Increase recursion counter
   level = level + 1
  
  'Get first child window
   hwnd = GetWindow(hWndStart, GW_CHILD)

   Do Until hwnd = 0
      
      'Search children by recursion
       Call FindWindowLike(hWndArray(), hwnd, WindowText, Classname)
      
      'Get the window text and class name
       sWindowText = Space(255)
       r = GetWindowText(hwnd, sWindowText, 255)
       sWindowText = Left(sWindowText, r)
        
       sClassname = Space(255)
       r = GetClassName(hwnd, sClassname, 255)
       sClassname = Left(sClassname, r)
      
      'Check that window matches the search parameters
       If (sWindowText Like WindowText) And (sClassname Like Classname) Then
        
           found = found + 1
           ReDim Preserve hWndArray(0 To found)
           hWndArray(found) = hwnd
           Debug.Print hWndArray(found), sClassname, sWindowText

       End If
      
      'Get next child window
       hwnd = GetWindow(hwnd, GW_HWNDNEXT)
        
   Loop
  
  'Decrement recursion counter
   level = level - 1
  
  'Return the number of windows found
    FindWindowLike = found

End Function


Call EnumWindows from the Immediate window, but beware it will output more results than can be shown in the Immediate Window!

You might want to change the Debug.Print line in FindWindowLike to write to a table or file so you can inspect all the results.

Happy hunting and good luck!!!

thumbup.gif

d
Go to the top of the page
 
patriciaxxx
post Sep 30 2017, 06:01 AM
Post#35



Posts: 273
Joined: 20-December 12



Thank you David

I tried Randyís code which confirmed your thoughts on the Access window class being OMain.

When I tried it nothing happens, so it too fails for me. Strange as the other class does remove a folder button from the taskbar. There must be something missing or wrong in the code snippet?

Thank you very much for trying though, I do appreciate your help and advice. The reason I persist in trying to find the solution apart from my own desire to know is also to provide a positive conclusion to this topic, should others come to read it seeking the answer they will find it.

Thanks again.

Go to the top of the page
 
cheekybuddha
post Sep 30 2017, 06:29 AM
Post#36


UtterAccess VIP
Posts: 11,676
Joined: 6-December 03
From: Telegraph Hill


You're welcome!

You may want to experiment with some of the other classes that are found - Access is put together in a very strange way and the class you need may not be the obvious one!
Go to the top of the page
 
PhilS
post Oct 9 2017, 04:37 PM
Post#37



Posts: 634
Joined: 26-May 15
From: The middle of Germany


QUOTE
I second ADezii's assessment that it is going to be very hard to remove the icon from the task bar.

This assumption proved to be correct.
Here are all the gory details: How to hide the Taskbar Button of a window. - An excursion to the raw COM API with VBA.
Go to the top of the page
 
cheekybuddha
post Oct 9 2017, 04:54 PM
Post#38


UtterAccess VIP
Posts: 11,676
Joined: 6-December 03
From: Telegraph Hill


Philipp,

Fantastic investigation, fantastic work, fantastic writeup!

notworthy.gif

thumbup.gif

d
Go to the top of the page
 
PhilS
post Oct 10 2017, 03:01 AM
Post#39



Posts: 634
Joined: 26-May 15
From: The middle of Germany


David,
Thanks a lot for the feedback. cool.gif
I encountered that part of the Windows API (Shell Interfaces) more than once in the past and it always was a dead end. I'm happy that I now figured out a blueprint for using this kind of API.
Go to the top of the page
 
patriciaxxx
post Oct 10 2017, 06:16 AM
Post#40



Posts: 273
Joined: 20-December 12



Hello Philipp

I second Davidís remarks and congratulate you on a truly impressive article.

Could you include a 2000/2003 file in your 'VBA 6 / Access 2000 - Access 2007' link for me to look at as I currently am limited to Access 2002 Win XP.
Go to the top of the page
 
3 Pages V < 1 2 3 >


Custom Search


RSSSearch   Top   Lo-Fi    14th November 2019 - 12:20 PM