Thursday, March 31, 2011

How to redraw Access form on RDC session

I recently moved one of my applications to terminal services hosting. In most case this works just fine, but in this application I use DBPix ActiveX control with pop-up form (red ring) over it, movable by user:

image

This combination produced very weird visual effects on terminal server session, basically control area was not repainted correctly. I tried to send WM_PAINT message, InvalidateRect function, nothing helped. So I ended up with following solution: after form load and after event of moving popup form I run .Move form method to move form one pixel left and then back.

If IsRunningInTerminal() Then
       Me.Move Me.WindowLeft + 8
       Me.Move Me.WindowLeft – 8
End If

Not very elegant solution, but it works. And if you know better solution – please post comment here.

By the way, Ammara developing new DBpix 3.0 version with some exciting features!

5 comments:

  1. I've found this http://www.access-programmers.co.uk/forums/showthread.php?t=134027 but it doesn't seem to do what you show and in any case it's all part of an Access mdb. In the picture you show, the red ring is a pop-up Access form but the drawing of a a house underneath it is still in the same mdb or not?

    ReplyDelete
  2. Ciao Girgio,
    i will make a new post on transparent forms.

    ReplyDelete
  3. Ok. What are WM_PAINT message and InvalidateRect function?

    ReplyDelete
  4. easy to find:
    http://msdn.microsoft.com/en-us/library/dd145213(v=vs.85).aspx

    ReplyDelete
  5. Such a great article which this combination produced very weird visual effects on terminal server session, basically control area was not repainted correctly.Trying to send WM_PAINT message, InvalidateRect function, nothing helped. Thanks for sharing this article.

    ReplyDelete