Solved

How can I disable click through on my transparent form?

Posted on 2006-11-18
4
630 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
ID: 17972100
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
ID: 17972109
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
ID: 18400834
PAQed with points refunded (500)

Computer101
EE Admin
0

Featured Post

Simplifying Server Workload Migrations

This use case outlines the migration challenges that organizations face and how the Acronis AnyData Engine supports physical-to-physical (P2P), physical-to-virtual (P2V), virtual to physical (V2P), and cross-virtual (V2V) migration scenarios to address these challenges.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I see at least one EE question a week that pertains to using temporary tables in MS Access.  But surprisingly, I was unable to find a single article devoted solely to this topic. I don’t intend to describe all of the uses of temporary tables in t…
Phishing attempts can come in all forms, shapes and sizes. No matter how familiar you think you are with them, always remember to take extra precaution when opening an email with attachments or links.
In Microsoft Access, learn the trick to repeating sub-report headings at the top of each page. The problem with sub-reports and headings: Add a dummy group to the sub report using the expression =1: Set the “Repeat Section” property of the dummy…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

749 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