When exiting one controller game and launching another, it's annoying to have to reach for the mouse in between. Here's a game menu the joystick can control. Works flawlessly with my brand new xbox wireless controller (carbon black).
All native VB6 code plus some API calls, thus it's "portable" with no installation. No idea how far back it's compatible with; I'll guess Windows XP but don't hold me to it. With right around 1250 total lines of code it compiles to a svelte 72k exe.
The joystick support is based on Ben321's excellent CodeBank entry here. I use the same method, but wrap it inside a usercontrol with its own internal timer the programmer never has to see. Instead of having to check the joystick state inside a timer, you can just respond to the usercontrol events, which fire off similarly to keyboard events.
Here's how GameMenu looks on my machine:
![Name: Screenshot.jpg
Views: 27
Size: 61.3 KB]()
You can see my shortcut to it in my quicklaunch area so it ends up being extremely similar to just hitting the start menu.
The program uses an "ini"-style text file to customize your game list as well as any of the many customizable settings. Any game you add to the menu, you also need to add an *.ico (or *.bmp) file to the icons folder with the same name as the title, as well as a shortcut file (*.lnk or *.url) in the shortcuts folder. This was the key breakthrough for me, as the Microsoft Store games I have (Halo, AoE) are resistant to ShellExecute-ing with the paths and filenames hidden inside a walled garden. But all games let you create a shortcut on the desktop, and shortcuts ShellExecute just fine.
Here's the contents of the GameMenu.txt in the zip:
Checking some other postings, it appears that including the exe along with the source code is the protocol so I've included the exe.
Note that the shortcuts aren't expected to work for you; you need to make your own for your own games. You also need to make icons. I extracted icons from my game exe's with the freeware utility IconViewer 3.02, and then opened those icons with open source freeware GreenFish Icon Editor and chose "export page" to create vb6-compatible ico files of a fixed size. Worked a treat, actually.
Aside from the utility of the thing, this project contains some of my better coding.
All native VB6 code plus some API calls, thus it's "portable" with no installation. No idea how far back it's compatible with; I'll guess Windows XP but don't hold me to it. With right around 1250 total lines of code it compiles to a svelte 72k exe.
The joystick support is based on Ben321's excellent CodeBank entry here. I use the same method, but wrap it inside a usercontrol with its own internal timer the programmer never has to see. Instead of having to check the joystick state inside a timer, you can just respond to the usercontrol events, which fire off similarly to keyboard events.
Here's how GameMenu looks on my machine:
You can see my shortcut to it in my quicklaunch area so it ends up being extremely similar to just hitting the start menu.
The program uses an "ini"-style text file to customize your game list as well as any of the many customizable settings. Any game you add to the menu, you also need to add an *.ico (or *.bmp) file to the icons folder with the same name as the title, as well as a shortcut file (*.lnk or *.url) in the shortcuts folder. This was the key breakthrough for me, as the Microsoft Store games I have (Halo, AoE) are resistant to ShellExecute-ing with the paths and filenames hidden inside a walled garden. But all games let you create a shortcut on the desktop, and shortcuts ShellExecute just fine.
Here's the contents of the GameMenu.txt in the zip:
Code:
; Joystick sensitivity ranges from 0 to 32767; lower is more sensitive.
Sensitivity: 7000
InitialDelay: 260
RepeatDelay: 80
; Icon files can be *.ico or *.bmp Shortcuts can be *.lnk or *.url
IconPath: Icons\48x48
ShortcutPath: Shortcuts
; Right-click anywhere on the form (or game) to see what font values actually apply
FontName: Segoe UI
FontSize: 10.2
FontBold: False
; Colors (eg Blue) can be html (#0000FF) long integer (16711680) or an RGB list (0, 0, 255)
; System color constants are negative (eg: vbHighlight = -2147483635)
TextColor: 255, 255, 255
DimColor: 196, 196, 196
BackColor: 54, 53, 51
Highlight: 38, 37, 36
Activated: -2147483635
Separator: 71, 70, 67
; Offsets (in pixels) to position window flush with bottom left corner of desktop
OffsetX: -2
OffsetY: 2
; Margins (in pixels) for column spacing, separator height, etc...
MarginX: 12
MarginY: 12
; MENU DEFINITIONS
;
; Program will look for icon and shortcut files named the
; same as the title with the following substitutions:
; : ==> _ / ==> - \ ==> - | ==> - * ==> @ " ==> ' < ==> [ > ==> ]
; ? removed (no replacement)
; eg: Title "Bob: Lobl*w?" would look for files named "Bob_ Lobl@w.*"
[Column]
Title: Geometry Wars
Title: The Ur-Quan Masters
Title: Oxygen Not Included
Title: Subnautica
Title: Defense Zone 3
Title: -
Title: X-COM: Enemy Within
Title: Hitman: Absolution
[Column]
Title: Grid 2
Title: PGA Tour 2K21
Title: -
Title: Halo
Title: DOOM
Title: -
Title: Starcraft
Title: Starcraft II
Title: Age of Empires
Note that the shortcuts aren't expected to work for you; you need to make your own for your own games. You also need to make icons. I extracted icons from my game exe's with the freeware utility IconViewer 3.02, and then opened those icons with open source freeware GreenFish Icon Editor and chose "export page" to create vb6-compatible ico files of a fixed size. Worked a treat, actually.
Aside from the utility of the thing, this project contains some of my better coding.