Skip to content

Commit

Permalink
Added Taskbar Icon & Removed Auto Update
Browse files Browse the repository at this point in the history
  • Loading branch information
atagulalan committed Jun 6, 2020
1 parent 065e7bd commit 68517ed
Show file tree
Hide file tree
Showing 5 changed files with 63 additions and 21 deletions.
12 changes: 11 additions & 1 deletion My Project/Resources.Designer.vb

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 12 additions & 5 deletions My Project/Resources.resx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Serialization.Formatters.Binary.BinaryFormatter
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
Expand All @@ -60,6 +60,7 @@
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
Expand All @@ -68,9 +69,10 @@
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" />
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
Expand All @@ -85,9 +87,10 @@
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" msdata:Ordinal="1" />
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
Expand All @@ -109,9 +112,13 @@
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<assembly alias="System.Windows.Forms" name="System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" />
<data name="VolumerIcon" type="System.Resources.ResXFileRef, System.Windows.Forms">
<value>..\Volumer.ico;System.Drawing.Icon, System.Drawing, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a</value>
</data>
</root>
Binary file modified Volumer.exe
Binary file not shown.
50 changes: 40 additions & 10 deletions Volumer.vb
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,9 @@ Public Class VolumerForm
End Function

Dim ControlTimer As New Timer
Dim TaskbarIcon As New NotifyIcon
Dim Context As New ContextMenu

Dim cursorOnTaskbar As Boolean
Dim CropRects As New ArrayList
Dim screens As New Dictionary(Of String, List(Of Rectangle))
Expand Down Expand Up @@ -59,6 +62,28 @@ Public Class VolumerForm
ControlTimer.Interval = 1
ControlTimer.Enabled = True

' Set reload button
Dim ReloadButton As New MenuItem
ReloadButton.Index = 0
ReloadButton.Text = "&Reload"
AddHandler ReloadButton.Click, AddressOf UpdateScreens

' Set exit button
Dim ExitButton As New MenuItem
ExitButton.Index = 1
ExitButton.Text = "E&xit"
AddHandler ExitButton.Click, AddressOf ExitApplication

' Set taskbar icon
TaskbarIcon.Icon = My.Resources.VolumerIcon
TaskbarIcon.Text = "Volumer"
TaskbarIcon.Visible = True

' Add context menu
Context.MenuItems.Add(ReloadButton)
Context.MenuItems.Add(ExitButton)
TaskbarIcon.ContextMenu = Context

' Start global mouse hook
MouseHook.Start()
AddHandler MouseHook.MouseWheel, AddressOf Mouse_Wheel
Expand All @@ -78,6 +103,10 @@ Public Class VolumerForm
End If
End Sub

Private Sub ExitApplication(sender As Object, e As EventArgs)
Application.Exit()
End Sub

Private Sub ControlTimer_Tick(sender As Object, e As EventArgs)
Dim posx = Cursor.Position.X
Dim posy = Cursor.Position.Y
Expand All @@ -87,17 +116,18 @@ Public Class VolumerForm
Me.Hide()
End If

' MAJOR PROBLEM: POSSIBLE MEMORY LEAK.
' Check resolution
For Each OneScreen In Screen.AllScreens
Dim i = OneScreen.DeviceName
If Not (OneScreen.Bounds.X = screens(i).Item(0).X And OneScreen.Bounds.Y = screens(i).Item(0).Y And
OneScreen.Bounds.Width = screens(i).Item(0).Width And OneScreen.Bounds.Height = screens(i).Item(0).Height And
OneScreen.WorkingArea.X = screens(i).Item(1).X And OneScreen.WorkingArea.Y = screens(i).Item(0).Y And
OneScreen.WorkingArea.Width = screens(i).Item(1).Width And OneScreen.WorkingArea.Height = screens(i).Item(0).Height) Then
' Console.WriteLine("Updating screens...")
UpdateScreens()
End If
Next
'For Each OneScreen In Screen.AllScreens
' Dim i = OneScreen.DeviceName
' If Not (OneScreen.Bounds.X = screens(i).Item(0).X And OneScreen.Bounds.Y = screens(i).Item(0).Y And
' OneScreen.Bounds.Width = screens(i).Item(0).Width And OneScreen.Bounds.Height = screens(i).Item(0).Height And
' OneScreen.WorkingArea.X = screens(i).Item(1).X And OneScreen.WorkingArea.Y = screens(i).Item(0).Y And
' OneScreen.WorkingArea.Width = screens(i).Item(1).Width And OneScreen.WorkingArea.Height = screens(i).Item(0).Height) Then
' ' Console.WriteLine("Updating screens...")
' UpdateScreens()
' End If
'Next

cursorOnTaskbar = False
For Each CropRect In CropRects
Expand Down
5 changes: 0 additions & 5 deletions Volumer.vbproj
Original file line number Diff line number Diff line change
Expand Up @@ -50,13 +50,8 @@
</PropertyGroup>
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Data" />
<Reference Include="System.Deployment" />
<Reference Include="System.Drawing" />
<Reference Include="System.ServiceProcess" />
<Reference Include="System.Windows.Forms" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Import Include="Microsoft.VisualBasic" />
Expand Down

0 comments on commit 68517ed

Please sign in to comment.