Copying text contents of standard message box in Windows

 

This is bit old handy trick but still lot of people doesn’t know about this. How you can copy the text displayed on standard windows message? Well it’s easy as you do with a text box. Just press Ctrl + C :D


If you just copy it using Ctrl + C you’ll get the following string in Windows Vista

[Window Title]

Notepad

[Main Instruction]

Do you want to save changes to Untitled?

[Save] [Don't Save] [Cancel]

 

What the hell Happened with Dell XPS M1330 Display Driver/Hardware?

 

I was watching movie “Happy Days” in my laptop and after few minutes the screen goes to a rainbow colored pixels and soon my PC got stuck and I had to “Hard Reboot” my dear lappy. I thought it might be some codec issue or something. After rebooting I started watching the remaining part of the movie and in between the screen went again as previous and I could actually see a BSOD in my notebook for the first time.

Anyway I rebooted again and checked the dump file from C:\Windows\MiniDump with the help of WinDBG. It’s reported that probably

Probably caused by : nvlddmkm.sys ( nvlddmkm+518d3 )

The stack back trace shown as follows

ChildEBP RetAddr  Args to Child            
WARNING: Stack unwind information not available. Following frames may be wrong.
8a316ce4 8be5c5bc 862ea000 00000000 00000001 nvlddmkm+0x518d3
8a317a88 8be5c46c 862ea000 00000000 8c4b26c8 nvlddmkm+0x525bc
8a317b04 8be5b7c3 863388c0 00000006 b4adca36 nvlddmkm+0x5246c
8a317b2c 8be5c938 00000117 0001fa08 92546200 nvlddmkm+0x517c3
8a317b50 8be146f2 862ea000 92546040 8a317b80 nvlddmkm+0×52938
8a317b60 8c57a154 862ea000 8a317bb8 00020000 nvlddmkm+0xa6f2
8a317b80 8c5803c5 8a317bb8 925dd5c8 845e4008 dxgkrnl+0×75154
8a317be8 8c580a97 9aebc4d0 00000001 845e4008 dxgkrnl+0x7b3c5
8a317c04 8c51ded1 00000000 00000102 925dd5c8 dxgkrnl+0x7ba97
8a317c6c 8c52eef4 925dd5c8 00042a55 00000000 dxgkrnl+0x18ed1
8a317c98 8c52ec54 925dd5c8 00000000 00000000 dxgkrnl+0x29ef4
8a317cc4 8c50ba4c 00000002 9d7efc18 00000000 dxgkrnl+0x29c54
8a317cc8 00000000 9d7efc18 00000000 00000000 dxgkrnl+0x6a4c

It’s hard to figure out what happened with this minimal information but one thing was sure, my display driver is the center point for the crash. I removed the driver and rebooted again. Windows Vista provided the default driver for the hardware and it could not solve the issue again. This time I got a new message after blinking to a black screen that, nVidia Driver(nvlddmkm) failed to perform and windows recovered from the error. On reading few blogs, I understood that this problem is not happening with the classic theme in Vista. Anyway I downloaded the latest version of Video Driver from dell’s website and upgraded still the problem persists :( . Even I was unable to enable Windows Vista theme. I was much desperate and closed hard the lid of laptop and went to bed after trying lot of different options.

Today I just downloaded the latest version of BIOS Software from Dell’s website and I upgraded to version 8 to Version 13 of the bios software. As a magic the problem flew away. I also downloaded the other latest drivers and upgraded my PC.

In Dell’s website, it’s said that this could be hardware problem and Dell will be replacing the problematic hardware. They had asked to update BIOS to resolve this issue. BUT STILL I’M CONFUSED TO GO FOR A REPLACEMENT OF GPU. I brought this laptop from Japan and now I’m in India. I dint opted for International warranty. Thus I’ve to send across to get my proper service :( .

According to Engadget, what I understood that, it’s a serious problem and Dell is trying to fix it by increasing the fan speed to compensate the heat sink issues.

So yeah, quite a few NVIDIA GPUs have been acting up. Nothing new there. However, Dell’s attempting to help its laptop owners out by making a few notable BIOS updates readily available for download. Apparently the issue “is a weak die / packaging material set, which may fail with GPU temperature fluctuations.” In order to combat the problem, Dell’s BIOS flashes “modify the fan profile to help regulate GPU temperature fluctuations,” though the Round Rock powerhouse only promises that the updates will “help reduce the likelihood of GPU issues.” Hit the read link and give it a go — it can’t hurt… we hope.

If someone has any idea, please tell me, should I go for a hardware replacement?

—– update (Wednesday 11/19/2008 4:48 PM IST)—-

I just called the Dell-India support center. The awesome guy offered technical support for me even I purchased it outside India. After few reboots, the whole system went blank. I’m not even able to see the BIOS screen in the startup. It’s the problem with the graphics hardware. Thanks Dell for your great support but still I feel sad about the poor quality of your most demanding line of laptop. Even I’m suffering the heat on arm rest area after few minutes of operation. That’s really bad :(

 

Double Buffering Helpers in Windows Vista

 

image In these days, double buffering with windows was a bit tedious task. You will have to write your own double buffering classes to avoid flickering in your drawing. Those who don’t know, why we’re using double buffering, just Google and find it out yourself… If we write as pseudocode, the double buffering can be carried out in the following steps.

[sourcecode language='cpp']
CPaintDC dcWnd(this);
// Create offscreen DC
CDC dcOff;
dcOff.CreateCompatibleDC(&dc);

CBitmap bmp;
bmp.CreateCompatibleBitmap();

dcOff.SelectObject(&bmp)// Now all drawings will be recorded on the bitmap
dcOff.YourDrawingFxn(); // you can do your own drawing
dcWnd.BitBlt( …, &dcOff, ); // Directly blit to screen
[/sourcecode]

Anyway Windows Vista UxTheme DLL provides built-in functionalities to support double buffering for your application. It again follows the trivial method of drawing but it’s more flexible and easy to use. You don’t have to burn your brain cells to create off-screen DC and rendering. The new UxTheme.DLL provides following functions for basic buffered painting. Actually I noticed these functions when I was writing the previous post on Getting theme information. Then I just saw the PPT and video of Raymond Chen from PDC 2008. I’m really impressed with his session.

BufferedPaintInit – Initialize buffered painting for the current thread.

BufferedPaintUnInit – Closes down buffered painting for the current thread

BeginBufferedPaint – begins buffered paint operation

EndBufferedPaint – Completes buffer pain operations

There are few things you should notice before using the buffered functions. Since the buffered operations are based on the bitmap blitting functions, the default background for the drawing will be black (RGB(0,0,0)). So you should draw the background before starting the actual drawing. Otherwise the background will be black by default. The next thing is that, it’s better to add the message handler for WM_ERASEBKGND and just return TRUE; instead of calling base class functions. This will avoid further flickering on resizing your window. The sample snippet below implemented buffered painting and a time has been added to call Invalidate() function in each 10ms to test the flickering. See the sample snippet below. Note that after initializing the buffered painting you should not use the original window DC for painting you should use the DC output from BeginBufferedPaint() function. The code will be running only in Windows Vista.

[sourcecode language='cpp']
void CFlickerSampleDlg::OnPaint()
{
BP_PAINTPARAMS paintParams = {0};
paintParams.cbSize = sizeof(paintParams);

CRect rect;
GetClientRect( rect );
CPaintDC dc(this);
HDC hdcBuffer;
HPAINTBUFFER hBufferedPaint = BeginBufferedPaint(dc, rect,
BPBF_COMPATIBLEBITMAP,
&paintParams, &hdcBuffer);
CDC* pDc = CDC::FromHandle( hdcBuffer ); // Use output DC for further painting. Dont use windows DC

if (hBufferedPaint)
{
// Draw your background. otherwise it will be black
FillRect( pDc->m_hDC, rect, GetSysColorBrush(COLOR_3DFACE));

// Application specific painting code
for (int i =0;i<10;i++)
{
pDc->TextOut( 0,i*20,_T(“Quick Brown Fox Jumps over lazy dog”));
}
EndBufferedPaint(hBufferedPaint, TRUE);
}
else
{
// Error occurred, default to unbuffered painting
}
}

void CFlickerSampleDlg::OnTimer(UINT_PTR nIDEvent)
{
Invalidate(); // Repaint the window for testing purpose
CDialog::OnTimer(nIDEvent);
}

void CFlickerSampleDlg::OnDestroy()
{
CDialog::OnDestroy();
BufferedPaintUnInit(); // Uninit
}

BOOL CFlickerSampleDlg::OnEraseBkgnd(CDC* pDC)
{
return 1;
}
[/sourcecode]