So I was working on a transparent add-on VB.net program
that will be clickable only if you click shift
. E.g. It will just stay there but clicks will go through it unless I hold shift f.e
I saw this and tested the codes, VB.net Click through form
However I tried to change some controls but none are able to give me a kind of "toggle". Any clue of what I can fix for it?
Answers in C# are welcome as well as I can program C# instead if it is not do-able in VB
Edit: Code I have been trying to use is this
Imports System.Runtime.InteropServices
Public Class Form1
Private InitialStyle As Integer
Dim PercentVisible As Decimal
Private Sub Form_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
InitialStyle = GetWindowLong(Me.Handle, -20)
PercentVisible = 0.8
SetWindowLong(Me.Handle, -20, InitialStyle Or &H80000 Or &H20)
SetLayeredWindowAttributes(Me.Handle, 0, 255 * PercentVisible, &H2)
Me.BackColor = Color.Red
Me.TopMost = True
End Sub
<DllImport("user32.dll", EntryPoint:="GetWindowLong")> Public Shared Function GetWindowLong(ByVal hWnd As IntPtr, ByVal nIndex As Integer) As Integer
End Function
<DllImport("user32.dll", EntryPoint:="SetWindowLong")> Public Shared Function SetWindowLong(ByVal hWnd As IntPtr, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
End Function
<DllImport("user32.dll", EntryPoint:="SetLayeredWindowAttributes")> Public Shared Function SetLayeredWindowAttributes(ByVal hWnd As IntPtr, ByVal crKey As Integer, ByVal alpha As Byte, ByVal dwFlags As Integer) As Boolean
End Function
End Class
Edit 2: I need it to be able to make controls Click-able as well..
Example:
Can design a Countdown clock that the user will see in his screen but if he clicks at the area where it is nothing will happen and the click will go through, If the user wants to interact with the program he will hold Shift and the program is now clickable