transparent form

wwstudioinc
wwstudioinc used Ask the Experts™
on
I found this code on the web it makes the form transparent but the onclick event procedures does work any suggestion to make that happen.
1.
      Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" ( _
   2.
                      ByVal hwnd As Long, _
   3.
                      ByVal nIndex As Long) As Long
   4.
   5.
      Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" ( _
   6.
                      ByVal hwnd As Long, _
   7.
                      ByVal nIndex As Long, _
   8.
                      ByVal dwNewLong As Long) As Long
   9.
                     
  10.
      Private Declare Function SetLayeredWindowAttributes Lib "user32" ( _
  11.
                      ByVal hwnd As Long, _
  12.
                      ByVal crKey As Long, _
  13.
                      ByVal bAlpha As Byte, _
  14.
                      ByVal dwFlags As Long) As Long
  15.
  16.
      Private Const GWL_STYLE = (-16)
  17.
      Private Const GWL_EXSTYLE = (-20)
  18.
      Private Const WS_EX_LAYERED = &H80000
  19.
      Private Const LWA_COLORKEY = &H1
  20.
      Private Const LWA_ALPHA = &H2
  21.
  22.
      Private Sub Form_Load()
  23.
          Me.BackColor = vbCyan
  24.
          SetWindowLong Me.hwnd, GWL_EXSTYLE, GetWindowLong(Me.hwnd, GWL_EXSTYLE) Or WS_EX_LAYERED
  25.
          SetLayeredWindowAttributes Me.hwnd, vbCyan, 0&, LWA_COLORKEY
  26.
      End Sub

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
please furnish your code for the on-click event.
Commented:
Why don't you just minimise the form using

DoCmd.Minimize

as the onclick event of a button on the form
Jeffrey CoachmanMIS Liason
Most Valuable Expert 2012

Commented:
Is that "Mystery" code even designed for Access?
Is the code specific to Windows Vista (were transparent forms were first introduced.)
Thus, it might only work on Visa Machines with the "Areo" graphics enabled.
Are you sure the code even works?
Finally was there no documentation on how to use this code from the site where you got it from?

Pleas be specific when you say:
  <the onclick event procedures does work>
You mean nothing happens?
Any error message?
System crash?
?

As you know, we are here to help.
But it is a bit unfair to just get "Mystery" code posted, and to be asked:
     "Why won't it work?"

I live by rule #8 here:
http://mvps.org/access/tencommandments.htm

;-)

Jeff

Author

Commented:
oh well

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial