Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

SW_HIDE and Access popup modal form resize event image flicker

Status
Not open for further replies.

patriciaxxx

Programmer
Jan 30, 2012
277
GB
With Access 2003 / WinXP I can resize the form / image without flicker (see Form2 in example).

But when I hide the Access application window and try the same thing the image flickers (see Form1 in example).

Trying to understand and solve the problem I notice the same flicker problem was present if just minimized the application window using accmdApplicationMinimize.

Can anyone help solve the flicker problem when hiding app window?

I have attached an example db to illustrate the problem.

 
 http://files.engineering.com/getfile.aspx?folder=d866d91c-4fcc-4315-8a8e-a6548d6b7559&file=db1.mdb
The flickering is a consequence of an implementation issue with Access 2010 and earlier related to hiding the main application window. You'll not only your own form flickering, but also desktop icons will flash as well. There's no flicker with 2016 (have not tested with 2013, but I'd expect it to be flicker-free, as with 2016). Of course this doesn't help you with XP and Access 2003

Unfortunately I now no longer have any XP or Access 2003 development systems to write code on. You might like to experiment with the WS_EX_NOPARENTNOTIFY extended windows style for your form
 
Actually, I've tested WS_EX_NOPARENTNOTIFY now and it doesn't help. Basically, it is really quite difficult to reprogram the fundamental way that Access repaints forms and controls
 
Hello strongm and thank you for your reply

I have been struggling to solve this flickering for days without success. If some extended windows style for the form won’t solve it and there’s no other way to show the app window invisible that won’t cause flicker then I have only one idea left but I too have a problem with that.

(because I know how to set the window region so it doesn’t appear which combined with no Access button on the taskbar would have a similar effect)

Specifically how can I detect and hide just the Access button on the taskbar?

I have tried the following code but it’s not right?

Code:
    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

 
Couple of problems with that code. Firstly:

[tt]bWnd = FindWindowEx(tWnd, bWnd, "BUTTON", vbNullString) 'Start button handle[/tt]

should really be

[tt]tWnd = FindWindowEx(tWnd, 0, "BUTTON", vbNullString) 'Start button handle[/tt]

(and it should be pointed out that this code will not work on Vista or later, since the later OSs implement the taskbar differently)

The second problem is firstly that TB_HIDEBUTTON requires a ControlID, not an integer index. And the way to get a ControlID is to use the TB_GETBUTTON message which requires a TBBUTTON structure to be passed into another application message queue, and that requires cross-process memory transfer. Which means delving down into some really quite low-level memory allocation APIs, such as VirtualAllocEx. And once you start doing that you have to make sure you carry out proper memory management (aomething VBA normally completely hides from you). Basically, a huge amount of effort for very little gain.

SO here's a question - why do you need to hide the Access application button whilst the form is showing?
 
Hello strongm, thanks for replying

> why do you need to hide the Access application button whilst the form is showing

To be honest and especially having read your explanation, the button approach is no good. It was a poorly thought out alternative to the invisible application window.

If I could ask further questions regarding the invisible application window approach which is really what I need, of course without the flickering image control when I resize the form.

In further testing of my example I have discovered the following two things which I mention to you now in the hope that they may point you in the direction of a solution to the flickering?.

1. When the image flickers there is absolutely no flashing of desktop icons or anything else for that matter. It is totally confined to just the form image control.

2. I took the invisible code out of the Form load event and placed it in the Timer event. I discovered that if the timer interval was set to at least 1 second the flickering was completely gone.

I don’t want to use the timer though because firstly the interval may vary from machine to machine and in any event the pause between opening and waiting before the app window is hidden just doesn’t look good.

The reason I ask you about these discoveries, especially the second, is because they suggest to me there may be something that can be done to solve the flickering, I just don’t know what?

 
>the button approach is no good. It was a poorly thought out alternative to the invisible application window

The point is that you are still hiding the button. My question is why do you feel you need to do that?
 

> The point is that you are still hiding the button. My question is why do you feel you need to do that?

I did answer that and also tried to explain what I was doing
here:
and there’s no other way to show the app window invisible that won’t cause flicker then I have only one idea left but I too have a problem with that.

(because I know how to set the window region so it doesn’t appear which combined with no Access button on the taskbar would have a similar effect)

So the main thing is I’m really trying to make the app window hidden, the button thing came about because it didn’t look like I was going to succeed with hiding the window and having no image flickering.

Which brings me back to my latest discoveries and the last question I put to you, does it help in providing a solution to the hidden app window with no image flickering? or is there really no way forward here?
 
Ok .... why do you need to hide the application window

My question is why do you need to achieve that? If you can answer THAT then it might be possible to provide an alternative solution. For example, why not try just minimising the Access window?
 
Hello strongm

> why do you need to hide the application window

I trying to develop a db which opens a popup modal form that places its own button in the taskbar and hides the Access window in the process, which is the look that’s requested for this project.

The only stumbling point has been the image flickering when the form is resized. I’ve actually invested a lot of time and effort looking into this seemingly simple problem to try and solve it, and in the process tried everything I can think of both to solve it and as alternatives that would yield the same look, and all either without success or bringing there own even bigger problems. Strange how the seemingly simplest problems appear to be just the opposite.

> For example, why not try just minimising the Access window

This I tried way back in my searching for a solution to this. Needless to say it didn’t produce the desired result, that is to say it interestingly produced exactly the same flickering result that the invisible app window produce.

Which I though interesting because like my discovery with the timer event it keeps suggesting to me that something is being missed which could solve this flickering problem?




 
Hello strongm, thankyou for replying and thank you for all your help and advice both now and in the past.

As always it’s much appreciated.
 
There's some code that I did not build but have used for YEARS now in a database at my church for our sound room. The way I use it is to hide the main Access window, and only show the pop-up modal form. However, once I moved to Windows 7, I can't get anything for it on the taskbar at all. Honestly, I've not bothered with trying to fix that, b/c it works fine for what I need. I will say there are a few options in the code, so you could play with the options to see if you can get what you need or else see if there's some piece you can use in your own code. Here's one old discussion where some options were given, and I pasted a link there to the thread containing the code I'm now using:
thread705-895857

It may not end up giving you exactly what you want, but it might at least get you started down the trail.


"But thanks be to God, which giveth us the victory through our Lord Jesus Christ." 1 Corinthians 15:57
 
If you are trying to make a stand alone application you might consider building a front end in vb.net and leaving the backend in access. The learning curve in pretty steep though.
 
kjv1611 - the OP already knows how to hide the Access application Window. Her point is that, once it is hidden, images on the form flicker when resizing. It is the flicker issue she wants to fix - not the application hiding issue ... (and if you are using a later OS than XP, then you might not see the flickering)
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top