You may find running a console application in the background with the big black console window hidden is difficult on Windows.
Here is a solution that will even work for non-console apps (window exe's). But be careful since you will have to use the task manager to kill applications that don't close on their own.
The script arguments is the command you want to run. For example:
> hide.vbs "C:\Windows\System32\makecab.exe" data.txt out.cab
> hide.vbs notepad.exe
Using the script allows the creation of shortcut files to specific actions by tools (batch files, ImageMagick, etc).
- Save the code to hide.vbs (download here)
- Create a shortcut to hide.vbs (right click, drag to location, select create shortcut)
- Edit the shortcut target:
C:\hide.vbs "C:\Windows\System32\makecab.exe" "C:\hide.vbs" trash.cab
- Double click on the shortcut and you will see a trash.cab file created without seeing the console window (try a shortcut directly to makecab.exe to see how it normally behaves).
Here is the script source:
If WScript.Arguments.Count < 1 Then
MsgBox("Error: Missing command arguments")
Set objSWbemServices = GetObject("WinMgmts:Root\Cimv2")
Set colProcess = objSWbemServices.ExecQuery("Select * From Win32_Process")
For Each objProcess In colProcess
If InStr (objProcess.CommandLine, WScript.ScriptName) <> 0 Then
argStr = Mid(objProcess.CommandLine, InStr(objProcess.CommandLine , WScript.ScriptName) + Len(WScript.ScriptName) + 1)
cmdStr = Trim(argStr)
CreateObject("Wscript.Shell").Run cmdStr, 0, True
An earlier post (Creating an AVI for ANIMATE_CLASS) described how to create an AVI that will work with the ANIMATE_CLASS common control. However, there are still some particulars that need to be ironed out for the AVI creation and play to be successful... especially when attempting to create an AVI from a GIF animated image.
Most of the issues center around bit depth and global palettes during the conversion. But, instead of explaining all this, I'll just give the basic steps used to create the AVI:
- Download ImageMagick
- At the command prompt use IM to create a series of frames with the proper encoding
Add the frame files (frame_00000.bmp)
Select the fps and press Begin
Choose a save name
Choose the "Microsoft RLE" compressor with quality set to 100
Press OK and verify the AVI can be played in Media Player
- convert -append spin.gif all.gif
- convert all.gif -unique-colors -depth 8 map.gif
- convert -coalesce spin.gif BMP2:frame_%05d.bmp
- mogrify -define bmp:format=bmp2 +matte -remap map.gif -colors 256 *.bmp
Also, keep in mind some colors may cause problems with transparency. So, be sure to remove ACS_TRANSPARENT from the window style if you don't want transparency.
Here is a Microsoft sample
for creating an AVI animation window (note: it uses ACS_TRANSPARENT).
I've spent far... far... too much time trying to get an AVI format that will actually work in the ANIMATE_CLASS common control. The usual tools were tried: ImageMagick, ffmpeg, and mplayer. But, nothing worked.
The windows API wouldn't complain about a bad format. It would just not display the AVI in the window.
So, after some digging, I realized I needed an RLE-8 compressed AVI. All the other tools would use an unsupported codec or they would produce a raw format codec that wouldn't be viewed in Windows Explorer or play in Windows Media Player.
After a bunch of trial and error, I came across MakeAVI. It's a super simple interface and gives you the choice of RLE compression or uncompressed video.
So, save your time and use MakeAVI when you want to mess around with archaic Win32 animation API's.
Update: Also see Creating an AVI from a GIF that works with ANIMATE_CLASS
It can be tricky setting your window as the top z-order window. It's not just a simple call to SetForegroundWindow.
Here's how to do it:
This solution is from Nish Sivakumar's code project article and KevinSW's comment.
Here are a series of maps of US counties showing various statistics (Religion, Mental Illness, Education, Income, etc...):
If I had the time and the data, I'd throw together a US county filter/screen app so people can browse and search the relative desirability of each county (like a stock filter).
First off, the term backslash for \ doesn't sit well. It would be best described as downslash since that is the direction the pen travels as it is written. But, for consistency, let's call it a backslash.
Maybe you have tried installing a Japanese keyboard and IME in Windows 7 and decided to uninstall it. You may notice after uninstalling everything (and doing the requisite restart) a yen symbols still replaces the backslash when typing the key.
In a command prompt (console), paths will look like:
To fix the problem, go to:
Settings (Control Panel) -> Region and Languages -> Administrative -> Language for non-Unicode programs -> Change system locale
You may have noticed that the setting was still set to Japanese. Make sure it is set back to English, whichever flavor that is.
Sparkle is an OSX framework used for automating software. Once integrated into an application it will pull an appcast to see if it a newer version is available. If a newer version exists, it will download and install it. This framework frees developers from having to roll out their own update mechanism that lives outside the App Store.
Built into Sparkle are little crumbs that make sure the update isn't performed too often since it will degrade the host application's performance. These preferences are saved in the host application's OSX preference/properties location.
When developing it is useful to be able to do an update check on every launch, which means clearing the crumbs Sparkle left behind. To do this use the "defaults" commandline tool:
$ defaults delete com.yourappdomainbundlename SUEnableAutomaticUpdates
$ defaults delete com.yourappdomainbundlename SULastCheckTime
If you want to see what else Sparkle puts in your application preferences, just read them:
$ defaults read com.yourappdomainbundlename
Xcode makes easy tasks hard. Want to view memory at a specific address? Well, don't look in the View menu, where most of the IDE panes are. Go to Product -> Debug -> View Memory.
Everyday using Xcode is like a scavenger hunt in Hades where the reward is absent and you can only ask yourself why you continue.
Say you have an application that makes a simple getenv() call to check an environment variable and you want to test it during runtime in the Xcode IDE debugger. How do you tell Xcode 4.6 to supply the environment variable?
It's hidden away in the schema. So, edit your schema and choose the "Run YourApp" item on the left panel. Then add an environment variable in the table to the right.
Working on any mildly complex project is a nightmare. Sure, Apple is all about minimalism, but those headers are descriptive and are useful when trying to describe solutions to project configurations. Scanning StackOverflow's Xcode questions reveal a funny but sad mix of "the left panel" or "the second-to-left panel."
The Xcode IDE is a dirty joke that makes the life of a developer worse. The time spent in Xcode config land versus actually being productive creating something is obscene.
• • •