You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
IfHasDetected=NothingThen' if hasdetected is still nothing which would be set from init
29
-
ThrowNewNullReferenceException("Attempted to check if fullscreen application was detected before the detection method was run.")' throw exception with verbose message to hopefully help user
30
-
ReturnFalse' in case of a try/catch to ignore above error, return false instead
31
-
EndIf
32
-
ReturnHasDetected' return
33
-
EndFunction
34
-
35
-
''' <summary>
36
-
''' Returns the program name that has been detected from the last detection run.
37
-
''' </summary>
38
-
''' <returns>
39
-
''' The window title of the program that has been detected. Throws NullReferenceException if no fullscreen application detected.
40
-
''' </returns>
41
-
PublicFunctionGetProgramDetected()AsString
42
-
IfProgramDetected=NothingThen' if programdetected is still nothing which would be set from init
43
-
ThrowNewNullReferenceException("Attempted to check name of fullscreen application before the detection method was run, or when no fullscreen application was detected.")' throw exception with verbose message to hopefully help user
44
-
Return""' in case of a try/catch to ignore above error, return blank string instead
45
-
EndIf
46
-
ReturnProgramDetected' return
47
-
EndFunction
48
-
49
-
''' <summary>
50
-
''' Returns the process ID that has been detected from the last detection run.
51
-
''' </summary>
52
-
''' <returns>
53
-
''' The process ID of the program that has been detected. Throws NullReferenceException if no fullscreen application detected.
54
-
''' </returns>
55
-
PublicFunctionGetProcessIDDetected()AsUInteger
56
-
IfProcessIDDetected=NothingThen' if processiddetected is still nothing which would be set from init
57
-
ThrowNewNullReferenceException("Attempted to check process ID of fullscreen application before the detection method was run, or when no fullscreen application was detected.")' throw exception with verbose message to hopefully help user
58
-
Return0' in case of a try/catch to ignore above error, return 0 integer instead
''' Checks for any fullscreen application in-use, and stores it in the object.
99
-
'''
100
-
''' Take a look at the 'Get' functions provided by the object for output.
101
-
''' </summary>
102
-
PublicSubDetectFullscreenApplication()' this is a base function which can be used to pull ANY fullscreen window, including web browsers.
103
-
hWnd=GetForegroundWindow()' assumed to be the fullscreen program, is actually just the current window in focus
104
-
desktopHandle=GetDesktopWindow()' gets the desktop window, as to check that it isn't the desktop which is in focus
105
-
shellHandle=GetShellWindow()' gets the shell window, as to check that it isn't the shell (usually explorer.exe) which is in focus
106
-
107
-
IfNothWnd=NothingAndNothWnd.Equals(IntPtr.Zero)Then' checks to make sure there actually is a currently focussed window, and that the focussed window is valid (not hidden, etc)
108
-
IfNot(hWnd.Equals(desktopHandle)OrhWnd.Equals(shellHandle))Then' checks to see if the application doesn't match the desktop window (would likely happen if no window focussed), and that it doesn't match the shell application (usually explorer.exe)
109
-
GetWindowRect(hWnd,appBounds)' gets the window size of the application it is going to check
110
-
screenBounds=Screen.FromHandle(hWnd).Bounds' gets the current monitor size (resolution)
111
-
If((appBounds.Bottom-appBounds.Top)=screenBounds.HeightAnd(appBounds.Right-appBounds.Left)=screenBounds.Width)Then' aka if window is fullscreen
112
-
runningFullScreen=True' set boolean to True
113
-
GetWindowText(GetForegroundWindow,windowText,windowText.Capacity)' get window text of application
9
+
NamespaceFullscreenDetection
10
+
11
+
PublicStructureRECT
12
+
PublicLeftAsInteger
13
+
PublicTopAsInteger
14
+
PublicRightAsInteger
15
+
PublicBottomAsInteger
16
+
EndStructure
17
+
18
+
PublicClassFullscreenDetector
19
+
PrivateHasDetectedAsBoolean=Nothing
20
+
PrivateProgramDetectedAsString=Nothing
21
+
PrivateProcessIDDetectedAsUInteger=Nothing
22
+
23
+
''' <summary>
24
+
''' Returns if a fullscreen application has been detected from the last detection run.
IfHasDetected=NothingThen' if hasdetected is still nothing which would be set from init
31
+
ThrowNewNullReferenceException("Attempted to check if fullscreen application was detected before the detection method was run.")' throw exception with verbose message to hopefully help user
32
+
ReturnFalse' in case of a try/catch to ignore above error, return false instead
33
+
EndIf
34
+
ReturnHasDetected' return
35
+
EndFunction
36
+
37
+
''' <summary>
38
+
''' Returns the program name that has been detected from the last detection run.
39
+
''' </summary>
40
+
''' <returns>
41
+
''' The window title of the program that has been detected. Throws NullReferenceException if no fullscreen application detected.
42
+
''' </returns>
43
+
PublicFunctionGetProgramDetected()AsString
44
+
IfProgramDetected=NothingThen' if programdetected is still nothing which would be set from init
45
+
ThrowNewNullReferenceException("Attempted to check name of fullscreen application before the detection method was run, or when no fullscreen application was detected.")' throw exception with verbose message to hopefully help user
46
+
Return""' in case of a try/catch to ignore above error, return blank string instead
47
+
EndIf
48
+
ReturnProgramDetected' return
49
+
EndFunction
50
+
51
+
''' <summary>
52
+
''' Returns the process ID that has been detected from the last detection run.
53
+
''' </summary>
54
+
''' <returns>
55
+
''' The process ID of the program that has been detected. Throws NullReferenceException if no fullscreen application detected.
56
+
''' </returns>
57
+
PublicFunctionGetProcessIDDetected()AsUInteger
58
+
IfProcessIDDetected=NothingThen' if processiddetected is still nothing which would be set from init
59
+
ThrowNewNullReferenceException("Attempted to check process ID of fullscreen application before the detection method was run, or when no fullscreen application was detected.")' throw exception with verbose message to hopefully help user
60
+
Return0' in case of a try/catch to ignore above error, return 0 integer instead
''' Checks for any fullscreen application in-use, and stores it in the object.
101
+
'''
102
+
''' Take a look at the 'Get' functions provided by the object for output.
103
+
''' </summary>
104
+
PublicSubDetectFullscreenApplication()' this is a base function which can be used to pull ANY fullscreen window, including web browsers.
105
+
hWnd=GetForegroundWindow()' assumed to be the fullscreen program, is actually just the current window in focus
106
+
desktopHandle=GetDesktopWindow()' gets the desktop window, as to check that it isn't the desktop which is in focus
107
+
shellHandle=GetShellWindow()' gets the shell window, as to check that it isn't the shell (usually explorer.exe) which is in focus
108
+
109
+
IfNothWnd=NothingAndNothWnd.Equals(IntPtr.Zero)Then' checks to make sure there actually is a currently focussed window, and that the focussed window is valid (not hidden, etc)
110
+
IfNot(hWnd.Equals(desktopHandle)OrhWnd.Equals(shellHandle))Then' checks to see if the application doesn't match the desktop window (would likely happen if no window focussed), and that it doesn't match the shell application (usually explorer.exe)
111
+
GetWindowRect(hWnd,appBounds)' gets the window size of the application it is going to check
112
+
screenBounds=Screen.FromHandle(hWnd).Bounds' gets the current monitor size (resolution)
113
+
If((appBounds.Bottom-appBounds.Top)=screenBounds.HeightAnd(appBounds.Right-appBounds.Left)=screenBounds.Width)Then' aka if window is fullscreen
114
+
runningFullScreen=True' set boolean to True
115
+
GetWindowText(GetForegroundWindow,windowText,windowText.Capacity)' get window text of application
116
+
EndIf
114
117
EndIf
115
118
EndIf
116
-
EndIf
117
-
HasDetected=runningFullScreen
118
-
IfrunningFullScreen=TrueThen' only run if fullscreen application was detected
119
-
ProgramDetected=windowText.ToString
120
-
DimprocessIdAsUInteger' create variable to store process ID of application in
121
-
GetWindowThreadProcessId(hWnd,processId)' get process ID of that specific application/window
122
-
ProcessIDDetected=processId
123
-
Else
124
-
ProgramDetected=Nothing
125
-
ProcessIDDetected=Nothing
126
-
EndIf
127
-
runningFullScreen=False' prevents requirement for reinit
128
-
EndSub
129
-
130
-
EndClass
119
+
HasDetected=runningFullScreen
120
+
IfrunningFullScreen=TrueThen' only run if fullscreen application was detected
121
+
ProgramDetected=windowText.ToString
122
+
DimprocessIdAsUInteger' create variable to store process ID of application in
123
+
GetWindowThreadProcessId(hWnd,processId)' get process ID of that specific application/window
124
+
ProcessIDDetected=processId
125
+
Else
126
+
ProgramDetected=Nothing
127
+
ProcessIDDetected=Nothing
128
+
EndIf
129
+
runningFullScreen=False' prevents requirement for reinit
0 commit comments