Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

How can I disable click through on my transparent form?

Posted on 2006-11-18
4
Medium Priority
?
641 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
3 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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

You need to know the location of the Office templates folder, so that when you create new templates, they are saved to that location, and thus are available for selection when creating new documents.  The steps to find the Templates folder path are …
Windows Explorer let you handle zip folders nearly as any other folder: Copy, move, change, and delete, etc. In VBA you can also handle normal files and folders, but zip folders takes a little more - and that you'll find here.
In Microsoft Access, learn different ways of passing a string value within a string argument. Also learn what a “Type Mis-match” error is about.
Add bar graphs to Access queries using Unicode block characters. Graphs appear on every record in the color you want. Give life to numbers. Hopes this gives you ideas on visualizing your data in new ways ~ Create a calculated field in a query: …
Suggested Courses

877 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