Resetting the resolution of a monitor from within Delphi

This is a rescue app that can help a computer that turns on and is obviously working but the customer says nothing comes up on the screen. They quite often won’t admit what was done but the monitor says Freq Out of Range or nothing at all.

Just put this in the startup folder, reboot, and your problem is solved. It also works as a good party trick…

EXE: http://www.TheCodeCave.com/downloads/delphi/ResetRes86.exe
Source and exe: http://www.TheCodeCave.com/downloads/delphi/ResetRes86.zip[delphi]

// ****************************************************************************
// ResetRes86 01/Jan/2000
//
// Written by Brian Layman (AKA Capt. Queeg AKA SilverPaladin)
// Visit him at http://www.TheCodeCave.com
//
// A rescue util for Windows machines that have been set to a resolution not
// supported by the monitor. This has made me a hero for many a customer.
//
// I also used two modified versions of this tool, each associated with a
// hot key to switch between the resolution my monitors at could use and
// the resolution my monitors at home could use back when I strapped a
// handle onto my work computer and carried it back and forth.
//
// Warning: This routine changes your Windows settings. It can be used as a
// joke or a tool. It is a good best practice to understand every line
// of new code before you run it, who knows what could be lurking. Better
// yet, do not run this example at all. You should stop right now and erase
// the files. For if it causes blue smoke to be emitted from your network
// card, if it erases all users from your computer, or if it makes your
// sister break up with her lawyer boyfriend and start dating a caver, it
// is not my fault. (Actually that last one might be an improvement, but
// it is still not my fault.) But the fact of the matter is, computers
// have a mind of their own and we programmers live on the wild side.
//
// Usage: ResetRes.exe
// Simply place this file in the folder:
// C:\Documents and Settings\All Users\Start Menu\Programs\Startup
// and reboot the computer. When the next person logs it, the monitor
// will be at a resolution and hz cycle supported by all modern CRT and
// LCDs.
//
// Suggested Usage: If you have a game that
//
// Donations – If this program & source really helps you out, feel free to
// buy me a cappacino, movie ticket, ebook, or something else small for
// my next “Dad’s Night Out”. You can Paypal to Brian@TheCodeCave.com. Or
// leave a comment on my blog with your country of origin. Or even better
// yet, add me to your blog roll.
//
// History:
// 01/Jan/2000 – BL – Created
//
// ****************************************************************************
program ResetRes86;

uses
Forms, Windows;

{$R *.RES}

var
pDMode : _DEVICEMODEA;
begin
// The only required line for a Delphi app…
Application.Initialize;

// Assign the desired device mode
// The BitsPerPel is the only non-selfexlanatory setting I think.
// It controls the color depth as follows.
// 4 = “16 Colors”
// 8 = “256 Colors”
// 16 = “High Color”
// 24, 32 = “True Color”
pDMode.dmBitsPerPel := 8;
pDMode.dmPelsWidth := 800;
pDMode.dmPelsHeight := 600;

// Some touch screen LCDs don’t display at a rate higher than 60
pDMode.dmDisplayFrequency := 60;

// Mark the items that we are changing.
PDMode.DmFields := (DM_BITSPERPEL or DM_PELSWIDTH or DM_PELSHEIGHT or DM_DISPLAYFREQUENCY);
// Pass in the size, since we could change any number of fields.
pDMode.dmSize := SizeOf(pDMode);

// Call ChangeDisplaySettings to assign the settings to the registry and make
// it take effect.
// CDS_UPDATEREGISTRY The graphics mode for the current screen will be changed
// dynamically and the graphics mode will be updated in the registry. The mode
// information is stored in the USER profile.
ChangeDisplaySettings(pDMode, CDS_UPDATEREGISTRY);
end.[/delphi]

Congratulations to Cindy Moore!

She’s the winner of my First-Blog-I-Wander-Into-that-Has-Me-in-Their-Blogroll unannounced contest! Cindy has her blog over at the Digital Ramble.

She wins a large Café Voltaire from my local coffee Arabica Coffee House, or equal funds towards an other beverage that might be more to her tastes ;).


The cozy café down the street...
Congratulations Cindy!
Now go check your paypal account! 😉
(And btw that’s not her in the picture – at least the chances are pretty slim – lol)

I happen to really like her blog. It seems that she’s on a similar mission to mine. And that is (basicaly) to spread the knowledge that she found beneficial and toss in a little about herself along the way. She’s a computer programmer, though not in Delphi, near as I can tell (I guess no one’s perfect.) She’s got at least one WP plugin posted, the Favicon Manager WordPress. This plugin provides an easy way to get ANY image associated with your website to be your FavIcon. It also associates your icon with your feeds – a nice feature.

We both post our reading libraries too, but mine are slanted decidedly more to the fictional side of the scale. Heck, she even uses GAIM. But I warn you, if you thought my posts got to be long winded… you should be prepared. Digital Ramble is right! 😉 All in all, Digital Ramble is a good tech blog with some helpful hints, tips and tools.

Go check it out, it’s well worth the read!

Hidden Notepad.exe feature…

It’s JUST Notepad right?

I mean your normal every-day geek uses it all the time. There’s nothing new under the sun there?

OK, not everyone knows that hitting F5 will insert the date, but I’d bet MOST medium to high level geeks do. Heck, it’s on the menu… And sure to enable goto line you have to turn off word wrap. But I was shocked to learn a new notepad feature today.

According to John TP , it’s an Easter Egg, but I would call it the log feature.

The process is simple. If you need a step by step, go to John’s site. Otherwise save a text file with the first line consisting only of .LOG. Then EVERY time after that you safe the file, you get the date and time added to the end of the file…

Kinda nifty…

I’m not sure how I’d ever use that, but it obviously had a use for MS… Wouldn’t you have to macro this to take advantage of this feature?

I achieve the same thing by having a batch file in my All Users startup group that contains:
@date /t >>c:\Temp\boot.txt
@time /t >>c:\Temp\boot.txt

Then I have an (extra extra) record of everytime my machine is rebooted. Except that now that I’ve blogged about it, any unauthorized boots will be edited out.

But this all makes me wonder what else is in notepad.exe that I don’t know about… a hex editor doesn’t reveal .LOG in string format in the exe. So, who knows… there could be more stuff like this out there…

RamRod – BBC7 Flavour

I’m home sick today.

So here’s a quick post with a tool that I wrote to speed up my access to BBC7’s spoken word/audio books shows.

RamRod: BBC7 Flavour

RamRod has been custmized for BBC7 Links

As many of you know, I often spend hours listening to England’s BBC7 radio stream. They re-air all of the serialized Sci Fi, mystery, comedy and Drama radio shows that were broadcast in the last century in the BBC and sometimes in the US.

They have a listen again feature that allows you to listent to any of the shows you’ve missed in the last week. This program helps make that easier. So while I am home sick today, I can click on the 7th Dimension button and can listen to their Monday Sci Fi show, an unabbidged reading of Day of the Triffids. When that show is over, I just select Tuesday and click the go button and I’m on to the next show. Since, BBC7 is on a weekly rotating schedule, I can do that for all of the shows, for instance the Crime and Thriller hour is featuring a dramatization of Sara Paretsky VI Warshawski’s novel Deadlock. Since I am a week behind I can easily click through the episodes as I catch up.

In any case, maybe someone will find this useful. It’s great to be able to hear Michaela say “Saturday at 11 on BBC7” and within three clicks, be listening to it…

A working screen shot of The Code Cave's Ram Rod program, BBC7 Flavour.

This Delphi demo with source shows how to download a file from the interenet.
Downloads:
Here is the EXE: http://www.thecodecave.com/downloads/delphi/RamRod4BBC7.exe
Source:
Continue reading RamRod – BBC7 Flavour

Whoa! Bush makes surprise visit to Baghdad. Cool….

Excerpts from: http://www.cnn.com/2006/WORLD/meast/06/13/iraq.main/index.html

BAGHDAD, Iraq (CNN) — President Bush arrived Tuesday in Baghdad on an unannounced visit to meet with Iraqi Prime Minister Nuri al-Maliki.

Bush and his top officials had begun a two-day summit at Camp David, Maryland, on Monday to discuss Iraq’s progress and had scheduled a teleconference with al-Maliki for Tuesday morning.

But Bush secretly left for Iraq on Monday night to see al-Maliki in person.

Bush’s visit comes less than a week after a U.S. airstrike killed terrorist leader Musab al-Zarqawi and the Iraqi parliament approved the prime minister’s nominations for three key security posts in the new Cabinet, ending a stalemate among politicians over these positions.
[..]
Had those posts been filled sooner, Bush would have made the trip months earlier, [U.S. Presidential counselor Dan] Bartlett said.
[..]
“When you’re dealing with issues of enormous consequence, the security of our country, the security of the Middle East and the world, and you’re making such monumental decisions, it’s critically important that you’re able to meet with the new leader, confer with the leader, who you’re going to be making those decisions with,” Bartlett said.

Steelers QB Ben Roethlisberger was involved in a motorcycle accident around 11:30am

Living in Browns’ country every browns fan has come up to me with a half grin on their face asking if I’ve heard the news…
Of course that was before the exact details came out…

The Pittsburgh Tribune Review* is reporting: “Roethlisberger lost most of his teeth, fractured his left sinus cavity bone, suffered a nine-inch laceration to the back of his head and a broken jaw, and severely injured both of his knees when he hit the ground, police said. A plastic surgeon has been summoned.”

UPDATE: BTW, I read on a sports forum that had linked to my post, that another Steeler had reported that the surgery was specifically for the broken jaw and was expected to heal enough for him to play early in the season. The Steeler was un-named. So take that for what it is worth.

From KDKA:
“Witnesses tell KDKA he was not wearing a helmet and appeared to have head and facial injuries.”

From me:
PA is NOT the state to be riding in without a helmet. The road conditions (repair + gravel) not to mention the curves and hills just add too many variables. That’s even before you start thinking about the cars pulling out in front of you… Nebraska, that’s a different story. Plus no helmet on the 10th street bridge??? That’s just plain stupid. The buses in Pittsburgh deliberately (almost) try to take out motorcylclists. They assume you don’t need the whole lane and that they can take the right hand turns wide and swing their tails into the next lane over. The DO NOT do that when there are cars there or they would take out the passenger side door and window.

And can you imagine the poor people from Maine that go on vacation and take out the QB that won the last superbowl???

Predictions:
The lid law in PA will come under intense scrutiny but remain as is.
Riders in the NFL and other professional sports will come under an intense scrutiny (AKA the Cleveland Brown’s Kellen Winslow times 10) and some bylaw will be passed preventing riding without a helmet.
That law will provoke do gooders accross the country to revisit state helmet law legislation. Should be a fun year.

More from KDKA PITTSBURGH: Pittsburgh Steelers Quarterback Ben Roethlisberger is
Continue reading Steelers QB Ben Roethlisberger was involved in a motorcycle accident around 11:30am

[Advair] more than tripled users’ risk of asthma-linked death

I caught this news article last week and it definately raised my eyebrowse as this is a medicine i’ve had perscriptions for both Serevent and Advair for the past two years. I haven’t taken Advair at all this year nor much of the latter half of last year, since my symptoms have decreased. Still…

A friend of my wife had an asthma attack last year while on vacation. She’s preped herself for a month before hand – dilegently taking her battery of medicines. Near the end of the vacation, the family left giving her a couple days on her own. That’s when she had what I understand was her first and only asthma attack during the vacation. It was bad enough that a woman in a nearby room heard her and called for an ambulance. By the time the paramedics got there, her heart had stopped. Flatlined – dead…

With drugs and physical intervention, they revived her, only to have her OD on the stuff they revived her with. This caused her heart to stop again. Once again they revived her again. This time it stuck.

She’s alive and well and part of the knitting group Denise attends on Tuesday nights.

Advair was one of the medications she diligently used to prep herself for the vacation.

http://health.yahoo.com/news/163034

Asthma Inhaler Type Could Boost Death Risk

June 8, 2006 08:47:39 PM PST
By Randy Dotinga
HealthDay Reporter
Yahoo! Health: Addiction News

THURSDAY, June 8 (HealthDay News) — Adding to the ongoing controversy over a popular class of asthma inhaler medications, a new data review suggests the drugs may be dangerous.
Continue reading [Advair] more than tripled users’ risk of asthma-linked death

A horrible, horrible time suck…

Whatever you do, if you’re at all obsessive compulsive about puzzles, DO NOT click on any of these links…

http://www.TheCodeCave.com/swf/hapland.swf
http://www.TheCodeCave.com/swf/hapland2.swf
http://www.TheCodeCave.com/swf/hapland3.swf

Hapland is a game that is sort of like viewing a complete “incredible machine” that you must figure out how to activate in the right sequence… You must look at the cause and effect of everything on the screen and figure out the right sequence to light the torches and activate the portal at the end of each level.

My 10 and 8 year olds (and my wife and I) have solved Hapland1. Now we are working on 2. We’re kind of stuck at the moment… but we’ve made some progress…

Anyway, these games were written by the fine folks at foon.co.uk. I recommend that you visit them; there’s a link inside the game. I’m hosting locally since it downloads much faster and I want to play it at near full screen. At foon.co.uk, it is a fixed size.

wp_error is an excellent tool

Rob Miller wrote an excellent article on the use of wp_error in WordPress plugins…
http://robm.me.uk/2006/06/11/wp_error/
I’d suggest suggest that every WordPress hacker/plugin author, that is not familiar with this realtively unknown bit of wordpress lore, should go and read it!

If nowhere else, it will be indispensible when writing validation routines. You can call some VerifyPostVars routine and have it return a variable. If the variable causes Is_WP_Error() to return true, then you can display the results. The neat thing is that the WP_Error structure can contain multiple results. So, you can say
X is required, but was not supplied.
Y was not formatted correctly.
Z is not valid with the sellected options.
All at once, rather than having the user try to submit a form multiple times. Sure you can build other structures to handle that, but if everyone starts using WP_Error, plugins will all be consistent.

How to unlock your LG vx 5200, 6000, 8100, 9800

One of the major problems I have with my vx5200 phone is that it takes hundreds of pictures of the inside of my pocket…

Right now I only have one solution for this: Lock the keypad.
However, I was expecting it to unlock by pressing Menu * like my old (I-didn’t-know-how-good-I-had-it-when-I-had-it) Nokia phone.

Now however, with the new Verizon menu system on all of their LG phones, my lg5200 did not unlock the same way… After trying all logical four digit number combinations I could think of in 15-20 minutes, (1234, 4321, 1111, 2222, 5432, 6543, 0000) I stopped and thought “OK – if it is not a number pattern, it is a specific number. What specific number is associated with this phone…”

Well the answer is obvious… The unlock code for Verizon phones is….

Drum roll please……..dddddddddddddddddddd

The answer is The last four digits of your phone number.