Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

an application to detect dead pixels of LCD pixel
Hi all,

I am writing an application to detect the dead pixel of LCD panel by using
visual C++ (MFC). My flow is follow:

1. Display a dialog with a start button. When the user press the start
button. The whole screen become black colour.
2. When the user press any key by keyboard. The whole screen changes to red
then green, blue and white.
3. The screen back to "normal display".

I am a newbie in visual c++, so i don't know how to write the code to
achieve points 2 and 3.

Can anyone know how to write code for this application?

Thank a lot.


Report this thread to moderator Post Follow-up to this message
Old Post
Kelvin
04-11-08 12:29 AM


Re: an application to detect dead pixels of LCD pixel
"Kelvin" <Kelvin@discussions.microsoft.com> wrote in message
news:3129128E-8B56-4877-BADC-1ED3AF889334@microsoft.com...
> Hi all,
>
> I am writing an application to detect the dead pixel of LCD panel by using
> visual C++ (MFC). My flow is follow:
>
> 1. Display a dialog with a start button. When the user press the start
> button. The whole screen become black colour.
> 2. When the user press any key by keyboard. The whole screen changes to
> red
> then green, blue and white.
> 3. The screen back to "normal display".
>
> I am a newbie in visual c++, so i don't know how to write the code to
> achieve points 2 and 3.

Fill screen with red:

CWnd DesktopWnd;
DesktopWnd.Attach(::GetDesktopWindow());
CWindowDC DesktopDC(&DesktopWnd);
CBrush RedBrush(RGB(0xFF,0x00,0x00));
CRect DesktopRect;
DesktopWnd.GetWindowRect(&DesktopRect);
DesktopDC.FillRect(&DesktopRect, &RedBrush);
DesktopWnd.Detach();

Restore screen to normal display:

::InvalidateRect(NULL, NULL, TRUE);


BTW, there's an MFC newsgroup:  microsoft.public.vc.mfc

Mark

--
Mark Salsbery
Microsoft MVP - Visual C++


>
> Can anyone know how to write code for this application?
>
> Thank a lot.
>

Report this thread to moderator Post Follow-up to this message
Old Post
Mark Salsbery [MVP]
04-11-08 12:29 AM


Re: an application to detect dead pixels of LCD pixel
Mark Salsbery [MVP] wrote:
> "Kelvin" <Kelvin@discussions.microsoft.com> wrote in message
> news:3129128E-8B56-4877-BADC-1ED3AF889334@microsoft.com... 
>
> Fill screen with red:
>
> CWnd DesktopWnd;
> DesktopWnd.Attach(::GetDesktopWindow());
> CWindowDC DesktopDC(&DesktopWnd);
> CBrush RedBrush(RGB(0xFF,0x00,0x00));
> CRect DesktopRect;
> DesktopWnd.GetWindowRect(&DesktopRect);
> DesktopDC.FillRect(&DesktopRect, &RedBrush);
> DesktopWnd.Detach();

Don't try to draw on the desktop window, create your own fullscreen window.

>
> Restore screen to normal display:
> 
>
>
> BTW, there's an MFC newsgroup:  microsoft.public.vc.mfc
>
> Mark
>
> 



Report this thread to moderator Post Follow-up to this message
Old Post
Ben Voigt [C++ MVP]
04-11-08 12:29 AM


Re: an application to detect dead pixels of LCD pixel
"Ben Voigt [C++ MVP]" <rbv@nospam.nospam> wrote in message
news:Ow6wkbzmIHA.3532@TK2MSFTNGP05.phx.gbl...
> Mark Salsbery [MVP] wrote: 
>
> Don't try to draw on the desktop window, create your own fullscreen
> window.


Sure, take away all my fun. :)


Cheers,
Mark

--
Mark Salsbery
Microsoft MVP - Visual C++



> 
>
>

Report this thread to moderator Post Follow-up to this message
Old Post
Mark Salsbery [MVP]
04-11-08 12:29 AM


Re: an application to detect dead pixels of LCD pixel
Hi,

Thanks for your help!

Sorry that I still don't know how to "make" the whole screen to become black
when pressing the start button.

Could you told me how to achieve this?

Thanks a lot.


"Mark Salsbery [MVP]" wrote:

> "Ben Voigt [C++ MVP]" <rbv@nospam.nospam> wrote in message
> news:Ow6wkbzmIHA.3532@TK2MSFTNGP05.phx.gbl... 
>
>
> Sure, take away all my fun. :)
>
>
> Cheers,
> Mark
>
> --
> Mark Salsbery
> Microsoft MVP - Visual C++
>
>
> 

Report this thread to moderator Post Follow-up to this message
Old Post
Kelvin
04-11-08 09:55 AM


Re: an application to detect dead pixels of LCD pixel
My code is follow:

void CTestScreenDlg::OnButtonStart()
{
// TODO: Add your control notification handler code here
CWnd DesktopWnd;
DesktopWnd.Attach(::GetDesktopWindow());
CWindowDC DesktopDC(&DesktopWnd);
CBrush RedBrush(RGB(0xFF,0x00,0x00));
CRect DesktopRect;
DesktopWnd.GetWindowRect(&DesktopRect);
DesktopDC.FillRect(&DesktopRect, &RedBrush);
DesktopWnd.Detach();

}

but i cannot make the whole screen become red......



"Kelvin" wrote:

> Hi,
>
> Thanks for your help!
>
> Sorry that I still don't know how to "make" the whole screen to become bla
ck
> when pressing the start button.
>
> Could you told me how to achieve this?
>
> Thanks a lot.
>
>
> "Mark Salsbery [MVP]" wrote:
> 

Report this thread to moderator Post Follow-up to this message
Old Post
Kelvin
04-11-08 09:55 AM


Re: an application to detect dead pixels of LCD pixel
That code worked for me, but as Ben mentioned, you should create a window,
make it the size of the screen, and do the drawing on that window.

The system refreshes the desktop when you draw on it, at least it did to me
on Vista :)

Mark

--
Mark Salsbery
Microsoft MVP - Visual C++


"Kelvin" <Kelvin@discussions.microsoft.com> wrote in message
news:CF98DEB5-243E-43DF-B502-FE043B919EC4@microsoft.com...
> My code is follow:
>
> void CTestScreenDlg::OnButtonStart()
> {
> // TODO: Add your control notification handler code here
> CWnd DesktopWnd;
> DesktopWnd.Attach(::GetDesktopWindow());
> CWindowDC DesktopDC(&DesktopWnd);
> CBrush RedBrush(RGB(0xFF,0x00,0x00));
> CRect DesktopRect;
> DesktopWnd.GetWindowRect(&DesktopRect);
> DesktopDC.FillRect(&DesktopRect, &RedBrush);
> DesktopWnd.Detach();
>
> }
>
> but i cannot make the whole screen become red......
>
>
>
> "Kelvin" wrote:
> 

Report this thread to moderator Post Follow-up to this message
Old Post
Mark Salsbery [MVP]
04-11-08 09:55 AM


Re: an application to detect dead pixels of LCD pixel
Hi Marks,

Thanks a lot. I can use the code to display red color on the entire screen.

But, how to create a window, make the size of the screen and retrieves the
device context (DC) for that window?

Thanks,
Tim


"Mark Salsbery [MVP]" wrote:

> That code worked for me, but as Ben mentioned, you should create a window,
> make it the size of the screen, and do the drawing on that window.
>
> The system refreshes the desktop when you draw on it, at least it did to m
e
> on Vista :)
>
> Mark
>
> --
> Mark Salsbery
> Microsoft MVP - Visual C++
>
>
> "Kelvin" <Kelvin@discussions.microsoft.com> wrote in message
> news:CF98DEB5-243E-43DF-B502-FE043B919EC4@microsoft.com... 

Report this thread to moderator Post Follow-up to this message
Old Post
Kelvin
04-14-08 09:48 AM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

VC++ archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 07:41 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.