Solved

How can I disable click through on my transparent form?

Posted on 2006-11-18
4
619 Views
Last Modified: 2008-02-01
I'm using this procure to update my form when the user changes the slider. If they enable click-through by checking the checkbox, then click-through becomes active after changing the slider. The problem is that I can't find a way to disable click-through.

    Dim lOldStyle As Long
    Dim bTrans As Byte

    bTrans = sliderTrans.Value
   
    lOldStyle = GetWindowLong(Me.hwnd, GWL_EXSTYLE)

    If Me.chkClickThrough = False Then
        SetWindowLong Me.hwnd, GWL_EXSTYLE, lOldStyle Or WS_EX_LAYERED
    Else
        SetWindowLong Me.hwnd, GWL_EXSTYLE, lOldStyle Or WS_EX_LAYERED Or WS_EX_TRANSPARENT 'Click Through
    End If
   
    SetLayeredWindowAttributes Me.hwnd, 0, bTrans, LWA_ALPHA






If the user users Alt+Tab they can set focus on my application / form. Then if they press F10, it will uncheck click-through and run this code that doesn't work:


    Case vbKeyF10
            Me.chkClickThrough = False
            Dim lOldStyle As Long
            Dim bTrans As Byte
            bTrans = sliderTrans.Value
            lOldStyle = GetWindowLong(Me.hwnd, GWL_EXSTYLE)
            SetWindowLong Me.hwnd, GWL_EXSTYLE, lOldStyle Or WS_EX_LAYERED
   
            SetLayeredWindowAttributes Me.hwnd, 0, bTrans, LWA_ALPHA
0
Comment
Question by:HKComputer
4 Comments
 
LVL 14

Expert Comment

by:Glenn_Moore
Comment Utility
If you look at your form in the design view and click inside the form, one option is Tab Order, you can remove access to any of the fields you choose.
0
 
LVL 4

Author Comment

by:HKComputer
Comment Utility
I fixed the problem already. Logic bug:

Case vbKeyF10
  Me.chkClickThrough = False
  Dim lOldStyle As Long
  Dim bTrans As Byte
  bTrans = sliderTrans.Value
  lOldStyle = GetWindowLong(Me.hwnd, GWL_EXSTYLE)
  SetWindowLong Me.hwnd, GWL_EXSTYLE, WS_EX_LAYERED   '<----Removed lOldStyle
   
  SetLayeredWindowAttributes Me.hwnd, 0, bTrans, LWA_ALPHA
0
 
LVL 1

Accepted Solution

by:
Computer101 earned 0 total points
Comment Utility
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

The first two articles in this short series — Using a Criteria Form to Filter Records (http://www.experts-exchange.com/A_6069.html) and Building a Custom Filter (http://www.experts-exchange.com/A_6070.html) — discuss in some detail how a form can be…
Regardless of which version on MS Access you are using, one of the harder data-entry forms to create is one where most data from previous entries needs to be appended to new records, especially when there are numerous fields and records involved.  W…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

743 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now