Slink-e / CDJ Discussion Archive #10
VB, Slinkx, and subclassing a form
Posted By: Rich Boykin <rboykin@p...>
Anyone done this? I'm writing a small system tray program in VB to handle ir/X10 mapping that runs all the time so that I have this functionality even when cdj is not running. I'm using the "cNewMenu DLL to create SysTray Menus with Icons" project from vbaccelerator.com to build subclassed form for the system tray icon, and to pass events back to the parent form (hidden).
The parent form has the slinkx control, and everything works fine, except one thing. I added a function that "resets" the system (so that you can load a new map file without restarting the program) and when I call that function strange stuff happens.
Before I click on any entry in the system icon, the slinkx.numdevices = 1 (or however many I've added in the ini file), but after I select "Update ini" from the menu (no code run after this, just the subclassing calls to pass the event back to the parent form) the slinkx.numdevices = 269! And looping through the collection of devices, the devicenames are all "" or NULL, even the ones I previously added.....I haven't tried this on any other systray menu items (I haven't added any others except "Exit"), but i'm going to try that tonite and see if the behavior happens then too.
My guess is that somehow the subclassing is screwing stuff up, but I don't know for sure. The strangest part is, no matter what I do, the slinkx.numdevices is always 269 after the function is called from the systray menu.....strange!
Not really a problem - I'll just have to remove the "update" function from the program, and just use the sytem icon as an indicator that the program is running, and to close it from the menu....
Anyone else do something like this?
If anyone's interested, I can post the project to the user submitted area when it's ready for prime time. The format of the "map" file is a little different, but basically the idea is the same
where the first device:event is the "trigger" and the resulting series of events or event is the event that is triggered. Pretty straightforward. The .ini file holds the mapping information, as well as allows you to define what device files are loaded at runtime.