Thursday, September 20, 2007
Version 2.5.1.3 Released
- ADDED Disable Error Messages flag. Actually, it would be more like disable any and all messages altogether except for init errors... It came as a request through the feature request tracker in Sourceforge. *^~^* iya~~~ to think that somebody would ask for a feature for my little program~~~ I'm so happy~~ ^-^. Anyways, the person who requested it needed for the
program to fail "silently". Could have always used the MessageBox class (Show Debug Info = On) since that message box is modeless, oh well. Now, it doesn't run AfxMessageBox for errors that need to be shown but Show Debug Info is off. The only exception for this is the code that is run in InitDialog and the constructor of the main app. Since that code is not run more than once... I didn't make it hide the message boxes. Well, enjoy~ ^-^ and hope it works well. (It's not as if there are errors all the time, so there's a limit to how well I can test it...)
- FIXED count images code. It was trying to show the MessageBox's OK button when there was no message box in view. Must have happened when I was using search/replace to add the bLogDebugInfo into the program. Oh well, it's fixed now. ^-^
- UPDATED the lodePNG library. The author of it got into contact with me! I was so~ amazed. lol. I want my program to be better, and he wants his library to be better. ^-^ We are currently trying to figure out why it crashes with Optimizations enabled. In the mean time, he uploaded a newer version of the library so I went to get it. It does things faster than before. ^-^
- FIXED Manual Location bug. If there was an error (no valid images in location), even if the m_bPlaceStick flag was off, the thing would stick, so I moved the resetting code a scope upwards and now it works. ^-^
Saturday, June 2, 2007
Version 2.4.2.6 Released
- ADDED code to just log debug info into file instead of displaying it and letting the user save it. You can still do that, but you can also have it to just log it automatically. If you turn this option on, it'll save it in"Background.log" file in the same directory as the executable. If you leave it on for hours on end... the file may get too big... lol =P. I left it on for about a whole day and it came to be about 1.2MBs in size... hmmm... not bad. ^-^
- ADDED a dialog box to be able to select the SplashScreenImage/TrayIcon set to either one of the ones that it picks, or to do it randomly... as it has been doing till now. Don't know... just had the idea of adding it... -o-;;
- CHANGED code to recognize Vista when figuring out Windows version.
- CHANGED the size of the Message Box. Made it longer so that I could see more of the info displayed in 1 pass. I wanted to make it resizable... but when I looked in google about it... it was too complicated/too lazy to do so....
- CHANGED the Open Dialog code for Manually Change Image so that it'll select "All Files(*.*)" by default
- CHANGED some stuff in the PNG library code... mainly I added 58 typecasts. Geez... what a pain... I did it in the hopes of making it work in the Release version, but to no avail... still don't know what's wrong with it. B_B
- CHANGED Release options to disable Optimizations when compiling. That's what was giving me the errors on Release mode and not on Debug mode.
- CHANGED PNG code so that instead of displaying checkered boxes for transparency, it would display it as transparent? well, it seems the background color in Vista is black so..... don't know how to change it, but this comes out nicely with this. It appears in black so. ^-^
Wednesday, May 30, 2007
It seems...
Wednesday, May 23, 2007
Figured it out!
Tuesday, May 22, 2007
2.3.3.3 Fix?
Some updates (2.3.3.3)
OK. I have a hunch that the reason why this fails is because the taskbar is not ready to add the icon(for some reason or another) and thus times out one me. So, in order to... get around this, I have the program to try to set the icon 3 times, with 1 second delay in between each try. Hopefully, this'll solve it. I've looked around on the web, and it seems I'm not the only one with this problem... and apparently there's no real solution to it. @_@
Active Desktop
Erick told me that it would be nice for it to work with Active Desktop, so I added code to set the wallpaper using IActiveDesktop::SetWallpaper() routine. As far as I know, it sets it centered, not tiled, not stretched, centered. The scaling and converting to BMP is done by the Background App (since Active Desktop won't align them and stuff like I do with Center Tiling on). Only the actual setting of the background is done with IActiveDesktop::SetWallpaper(). I haven't thoroughly tested it. Erick says that if I make it hide the icons on the desktop, that means that Active Desktop is Active. I tried that, and changing wallpaper with the Background App works. So, I'm assuming it works... hopefully
PNG Support
Added PNG support using lodePNG library. It's slow. I have to plot the pixels on the BITMAP object myself. Whenever this program loads a PNG file, it'll slow down a bit, since it means it's plotting the pixels using SetPixel(x, y, color). Well, it's a nice alternative as opposed to having to load the PNG library, zlib library, etc. I'm happy with it... except for the speed. Oh well, guess can't be helped. Just cope with it. lol ^-^
Dialog code
I added a ResetControls code so that when you press Cancel, it'll actually do that and not just hide the options dialog. And I moved all of the variable passing to a struct. It was a pain to do so.
Unknown Error
When I run the Debug version of the app, it runs fine, for hours and hours on end... but just now, with the Release version... it crashed. @_@ Don't know why, looking into it. So far, I have no idea why. It appears to be random, and that sucks... It works fine with the Debug version though... @_@ *sigh*... should have released later... *sigh* oh well, too late now. Try the app and see if it works for you. Maybe it's me and Vista. I don't know... Somebody look through my code and tell me what I did wrong @_@ It always crashes at the point when Debug message says "Scaling image file...." thingie... *sigh*... what a bummer. 2 years in the army and now that I'm trying to get back into this... I'm greeted with this. -_-
Background 2.3.3.3 Release!
- ADDED PNG File support. I found lodePNG library while looking for a way to add PNG support. It's nice and small. Right now loading and displaying of PNG files is slow, but works. It gave me a bit of trouble, perhaps it's just me getting back to programming and stuff... It's done and although it may not work fully, it works somewhat... at least with the files that I have.
One thing about it is that CPicture::SaveAsBitmap() can't save the PNG files. I left it as that since SaveBitmapFile() is outside of the CPicture class and the only way for me to save the PNG file is through SaveBitmapFile(), so I decided to implement the saving of PNG files to BMP in the main program app.
- ADDED reset control code. Now when you press Cancel, it truly works like it. When you press Cancel, it resets all controls. Before, it would just hide the dialog box, nothing else. Now it resets controls so as to not confuse people that some settings are on or off.
- ADDED code to set wallpaper with ActiveDesktop enabled. When setting the wallpaper, if ActiveDesktop is enabled, it'll use the IActiveDesktop::SetWallpaper() to set it, otherwise, it'll use the good-old SystemParametersInfo(). Note, this thing is untested since I don't have a
Windows OS with ActiveDesktop (I'm using Vista right now).
- CHANGED code so that the tray icon would change with the AboutBox/Splash images. I had it load only the 1st icon... and I guess I forgot to change it while thinking I had. lol. Now it's fixed. ^-^ Also, when you disable splash screen, then it'll only use the 1st icon (Ruri icon).
- CHANGED automatic starting with windows code. I was using GetCurrentDirectory() but I changed that to GetModuleFileName() since the previous function wasn't working well. It would fail whenever I set the option AFTER it changed the background once.
- CHANGED the way for the dialogs to pass data back and forth. I'm now using a struct of pointers to pass to the property pages. Makes the code look... nicer?
Trashed the super debug logging mode idea... takes too much useless space.
Trashed the moving of dialog code to DLL idea... didn't seem necessary.
VIEW TECHNICAL TALK SECTION FOR SOME IMPORTANT INFO!
Tuesday, May 8, 2007
New site
Moved Site
Information
General Overview
Here you will find out about all the features of this program. ^_^
This program randomly selects an image from given locations and then sets that image as the wallpaper while attemting to figure out the best way of putting that image.
Features
This is a tray-icon based program so you will see a tray icon once you start the program. Right-clicking on it will bring up the menu.

As you can see, you can change the background if you either double-click on the tray icon, or select the "Change the Background" option in the menu.
"Manually Select Image" option was at first made for debugging purposes (to see if SetWallpaper() worked), but since I ended up using it anyway, I just left it. You can pick any valid image and set it as the wallpaper with this option. ^_^

"Manually Select Location"'s idea came about when I was watching some anime. lol. I wanted the program to pick images from a certain folder only, but that feature hadn't been implemented (I was using the timer to set it every 5 minutes so with this option it could become like a slideshow of sorts), so I decided to make it so that it could, now if you choose "Manually Select Location" option, then a folder-choosing dialog will pop-up.

Now choose a folder that contains images and it will randomly select an image from that folder and set it as wallpaper. You CAN make the location be kinda permanent, until you restart the program if you have an option set in the Options Dialog.

Options Dialog
Here you'll know about the Options Dialog box. We'll first start with the General options.

First option specifies where the background will be saved at. Windows converts all non-bitmap(BMP) images to bitmaps so the converted image MUST be saved somewhere. Windows hides this process from you. So, this will save the image it picks to that file. So, if you have the timer on, then this file that you specify in this edit box, will get overwritten every given minutes.
The first check box specifies whether the program will show you the file name of the image it picked. It doesn't show as much as when showing the debug info, but it shows something... By default all checkboxes are off. The settings that you see in this screenshot is what I currently use.
The Enable Timer checkbox enables the changing of the background at minute intervals given in the small edit box. I usually have it enabled to change the background change every 5 minutes. Well, when you have about 2700+ images... it's handy. =P lol
The automatically starting of the program is done through the registry. It will first write to the registry in HKCU, then in HKLM. When autostarting, it WILL change the background once. If you have the other checkbox set, it WILL exit AFTER changing the background once.
Next is the Advanced General Options dialog

The next 2 edit boxes are about maximum file sizes for both bitmaps and non-bitmap files. By default, the maximum file size for bitmap images is set to be 4 MBs, and for non-bitmap images is set to be 1MB. I have some jpeg images that are 4MBs and... they were really slowing down the whole system whenever I tried to set them as the background... so I added these options. A 800x600 16-bit bitmap is about 1.2MBs, so I think that the default values are ok.
If something doesn't work quite right, you can have the program show debug info. Here's a look at the message log window and a sample listing of the log file

Background Application Log
Time of Log : Mon Mar 01 12:49:49 2004
Initializing...
Current Windows Version : Microsoft Windows XP Professional
Location chosen : E:\Anime\Images
Gathering all directories in E:\Anime\Images
Gathered 78 directories from E:\Anime\Images
Gathering all directories in E:\Anime\Images/D.N. Angel
Gathered 0 directories from E:\Anime\Images/D.N. Angel
Directory picked : E:\Anime\Images/D.N. Angel
Directory to use : E:\Anime\Images/D.N. Angel
Gathering all valid image files in E:\Anime\Images/D.N. Angel
Gathered 2 image files from E:\Anime\Images/D.N. Angel
Image files gathered from E:\Anime\Images/D.N. Angel
Number of items in the Previous List : 18 of 500
Current Screen Resolution : 800 x 600
Current Color Mode : 16 bpp
Loading E:\Anime\Images/D.N. Angel\DNAngeL_-Dark_and_Daisuke.jpg for processing...
Calculating wallpaper mode...
Image Dimensions : 1024 x 768
Image considered small == false
Screen ratio 4 : 3
nDiff2 == 0
nXDiff2 == -28 | nYDiff2 == -28
Difference between the heights of image and screen == 168
Wallpaper Style : Stretched
New image dimensions : 800 x 600
Center Tiling Calculations
New image dimensions : 800 x 600
nXRepeat == 1 | nYRepeat == 1
nXOffset == 0 | nYOffset == 0
Scaling the image to fit the screen...
Saving scaled image to file...
Setting E:\Anime\Images/D.N. Angel\DNAngeL_-Dark_and_Daisuke.jpg as wallpaper...
Wallpaper has been set to E:\Anime\Images/D.N. Angel\DNAngeL_-Dark_and_Daisuke.jpg
As you can see, a lot of debug info is displayed. So, if anything doesn't work quite right, you can save the log file to see how things are going and check the code to see if it is wrong or something, or you could send it to me ^_^ to check on it too. ^_^
Next is the Location Tab

In here the locations where the image files are at are entered. As you can see there are 4 locations entered here. They all have a percentage, the higher the percentage, the better the chance of getting picked. They also have an "Include Root" column. This indicates whether to pick the files directly from that location folder OR to first go into a subdirectory THEN start picking files. As you can see the first location is set to not include root, which means that any image picked from that location is actually picked from one of the subdirectories within that location.
The Add location dialog and the Advanced Location Options Dialog are pretty much self-explanatory so I'll skip them. =P The Advanced Location Dialog only deals with the "Previous List" that the program keeps and is explained in the dialog box. OK, next is the Scaling options tab

This tab is pretty much the most important one. First, you can have the program scale a big image down, or stretch some small images. Center Tiling is a term I coined. lol =P Well, certainly I hadn't heard it before. lol =P. To know more about it, click on "Center Tiling Info" button. About scaling and stuff... there's not really much to say... the checkboxes are rather self-explanatory... at least to me. =P The Advanced Scaling/Image Options Dialog... only go there and change stuff if you understand how the program works (look at the source code)... Or experiment around (thank God for "Restore Default value buttons" =P). The most important aspect of this program is in setting an image as the wallpaper and many of the options used for it are in the Advanced Scaling/Image Options dialog box. So, if you change things around and it doesn't work anymore, use the "Restore Default Values" button... and read everything!!! (including the SetWallpaper() code ^_^)
And that's it for this section. I hope you liked my little tour into the Background Changing App. ^_^
Technical Talk Section
OK, this space is for me to talk technically. lol. Mostly talk about programming and stuff. ... So far I have no idea what I'm going to put here... but if I want to upload this site... I better come up with something. lol =P
Known Issues
OK, I'll put up a new release once these "issues" pile up... 'cause I don't want to make a release that consists of only 1 change... who would? =P So, here goes
Why a generic name such as "Background"?
... well... I never really gave it a name... This program started as a VBScript. lol. It was named Background.VBS. Since it was changing the background, background.vbs didn't seem such a bad idea for a name, besides, it's just a VBScript, not a MFC app... but then... things got bigger, and then went to become a JScript script... THEN one day, I decided to add an Options Dialog box! lol. I think my ignore script for mIRC had a lot to do with it. lol. =P Coding a dialog box in mIRC was... cool... so I thought that it was time for the background changing script to get its own dialog box as well... and... the name just... got stuck... lol =P Oh, I was using an OCX file that I had made using VB5CCE to actually set the wallpaper and stuff. lol WSH is not THAT powerful to be setting wallpapers and stuff. lol =P
What's up with Background-ASCII.exe, Background-MBCS.exe, and Background-UNICODE.exe?
... how did this become a FAQ? ..... oh well... who knows? =P OK, on to the question... err... answer. Well, my main audience (Erick) was complaining that Background V2 didn't work for him... So I changed things around a bit... and still didn't work, SO, I thought that maybe it was a character set thing. Since the Unicode version won't work in Win98... I thought that maybe my MBCS version wasn't working in his computers... so I decided to compile it for each character set (ASCII(SBCS), MBCS, and Unicode). Hey, it works in my Win98 and I don't use the Win98 to make programs and stuff... Hopefully now it will work... at least some version. ^_^
FormatMessage() not working well in Win98
For some reason, my FormatMessage() won't work well in Windows'98. It doesn't give any errors, it just returns an empty string... Here's the code
// Returns the description of the error code returned by GetLastError() |
Now for some reason, FormatMessage returns 0 to dwLength and I'd like to know why... It works fine in WinXP... Well, I haven't looked up in Google about it yet since I get online about once a week and for about an hour or so. Well... I guess this is just 1 more thing to "fix" for the next release. ^_^
Shell_NotifyIcon() fails during startup
OK... The previous sniplet of code is now correct and works as it's supposed to... before though... it wasn't working very well... See, since I have all my strings in a string table, I was using oString.LoadString(IDS_STRINGID), but the LoadString() member SETS the last error to 0 if it succeeds, and for the longest time, I've been getting errors with error code of 0. lol. Well, now that's fixed. ^_^ OK, on to this problem. It doesn't happen often... actually, it happens once in a blue moon, but it happens. It's nothing serious, really. It fails to create the tray icon, then since it failed, the main program object fails to create, thus the program exits. If you restart the program, then it works fine, but I'd still like to know why it doesn't work from time to time. Here's the code that I'm using to add the tray icon.
| *** In the class constructor *** |
// Just in case... hopefully it will stop the |
| *** In OnInitDialog() *** |
// Add the Tray Icon to the System Tray |
Needless to say, but that ZeroMemory() code did NOT stop that error message from appearing... *sigh* This works and all... but it's that sometimes it fails and... it kills me not knowing why. lol. I've looked around Google Groups a bit...(1 hour), but the closest thing I found was that maybe it's not my program failing, but Explorer... if so... then there's nothing I can do..., but if it isn't?
The "bug"
Oh wow, a bug! lol. Well, here's how it is. In Windows'98, if you have the screen set to be 16-bits color mode, then the "bug" will appear. It only happens if you have the program to scale the image. The first time that it scales the image, it works fine. THEN, the 2nd time, it won't work. It scales it, and saves it fine... BUT Windows CAN'T set the saved bitmap as the wallpaper!!!... I don't know why that happens... I'm assuming it has something to do with the SaveBitmapFile() that I got off the web... but ... it does work... half the time... but it still works, and it works flawlessly in WinXP... I'd like to know why and fix it. This "bug" has been with me ever since Version 1.4. I'm thinking that it's either that SaveBitmapFile() function or the stdole version of Win98... who knows?
Things I want to do
Well, there's 2 things I'd like to be able to do to make this program better... one is to change the mode of the list control in the FileOpen dialog box to Thumbnailed view, instead of the default List view that it comes up with. The 2nd thing is to add a check box to the BrowseForFolder dialog, just like in Winamp. That way I could move that Manually Select Location option from the Options Dialog and put it where it should be. I once almost got it using a code I downloaded from the web. This guy had subclassed it very thoroughly, and I was actually able to add the check box... but... the checkbox didn't work as expected... See, whenever I put the mouse over the check box, the check in the checkbox would dissapear, and appear if I moved the mouse away from it(assuming that the check box is in a BS_CHECKED state)... So, I just gave up on it for now...
That's it for this section... I'll add more or remove some items as time passes and as things change. Well, have fun and enjoy the program! ^_^