473,398 Members | 2,525 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,398 software developers and data experts.

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.

Apr 10 '08 #1
8 1417
"Kelvin" <Ke****@discussions.microsoft.comwrote in message
news:31**********************************@microsof t.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.
Apr 10 '08 #2
Mark Salsbery [MVP] wrote:
"Kelvin" <Ke****@discussions.microsoft.comwrote in message
news:31**********************************@microsof t.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();
Don't try to draw on the desktop window, create your own fullscreen window.
>
Restore screen to normal display:
>>InvalidateRect(NULL, NULL, TRUE);


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

Mark

>>
Can anyone know how to write code for this application?

Thank a lot.

Apr 10 '08 #3
"Ben Voigt [C++ MVP]" <rb*@nospam.nospamwrote in message
news:Ow**************@TK2MSFTNGP05.phx.gbl...
Mark Salsbery [MVP] wrote:
>"Kelvin" <Ke****@discussions.microsoft.comwrote in message
news:31**********************************@microso ft.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();

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++
>
>>
Restore screen to normal display:
>>>InvalidateRect(NULL, NULL, TRUE);


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

Mark

>>>
Can anyone know how to write code for this application?

Thank a lot.

Apr 10 '08 #4
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]" <rb*@nospam.nospamwrote in message
news:Ow**************@TK2MSFTNGP05.phx.gbl...
Mark Salsbery [MVP] wrote:
"Kelvin" <Ke****@discussions.microsoft.comwrote in message
news:31**********************************@microsof t.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();
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++
>
Restore screen to normal display:

InvalidateRect(NULL, NULL, TRUE);
BTW, there's an MFC newsgroup: microsoft.public.vc.mfc

Mark

Can anyone know how to write code for this application?

Thank a lot.
Apr 11 '08 #5
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 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]" <rb*@nospam.nospamwrote in message
news:Ow**************@TK2MSFTNGP05.phx.gbl...
Mark Salsbery [MVP] wrote:
>"Kelvin" <Ke****@discussions.microsoft.comwrote in message
>news:31**********************************@microso ft.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();
>
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++
>
>>
>Restore screen to normal display:
>>
>>>InvalidateRect(NULL, NULL, TRUE);
>>
>>
>BTW, there's an MFC newsgroup: microsoft.public.vc.mfc
>>
>Mark
>>
>>
>>>
>>Can anyone know how to write code for this application?
>>>
>>Thank a lot.
>
>
Apr 11 '08 #6
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" <Ke****@discussions.microsoft.comwrote in message
news:CF**********************************@microsof t.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:
>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]" <rb*@nospam.nospamwrote in message
news:Ow**************@TK2MSFTNGP05.phx.gbl...
Mark Salsbery [MVP] wrote:
"Kelvin" <Ke****@discussions.microsoft.comwrote in message
news:31**********************************@microso ft.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();

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++

Restore screen to normal display:

InvalidateRect(NULL, NULL, TRUE);
BTW, there's an MFC newsgroup: microsoft.public.vc.mfc

Mark

Can anyone know how to write code for this application?

Thank a lot.

Apr 11 '08 #7
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 me
on Vista :)

Mark

--
Mark Salsbery
Microsoft MVP - Visual C++
"Kelvin" <Ke****@discussions.microsoft.comwrote in message
news:CF**********************************@microsof t.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:
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]" <rb*@nospam.nospamwrote in message
news:Ow**************@TK2MSFTNGP05.phx.gbl...
Mark Salsbery [MVP] wrote:
>"Kelvin" <Ke****@discussions.microsoft.comwrote in message
>news:31**********************************@microso ft.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();
>
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++

>
>>
>Restore screen to normal display:
>>
>>>InvalidateRect(NULL, NULL, TRUE);
>>
>>
>BTW, there's an MFC newsgroup: microsoft.public.vc.mfc
>>
>Mark
>>
>>
>>>
>>Can anyone know how to write code for this application?
>>>
>>Thank a lot.
>
>
Jun 27 '08 #8
"Kelvin" <Ke****@discussions.microsoft.comwrote in message
news:82**********************************@microsof t.com...
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?


Hi Tim,

Sorry for the delayed reply. I was out of town all last week.

If you still need an example of creating a full screen colored window,
here's some code...

//-----------------------------------------------------
// FullScreenColorWnd.h
//-----------------------------------------------------

#pragma once
#include "afxwin.h"
// CFullScreenColorWnd

class CFullScreenColorWnd : public CFrameWnd
{
DECLARE_DYNAMIC(CFullScreenColorWnd)

public:
CFullScreenColorWnd();
virtual ~CFullScreenColorWnd();

protected:
DECLARE_MESSAGE_MAP()
virtual BOOL PreCreateWindow(CREATESTRUCT& cs);
public:
afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
afx_msg BOOL OnEraseBkgnd(CDC* pDC);
afx_msg void OnLButtonDown(UINT nFlags, CPoint point);

CBrush m_BkgndBrush;
};

//-----------------------------------------------------
// FullScreenColorWnd.cpp
//-----------------------------------------------------

#include "stdafx.h"
#include "FullScreenColorWnd.h"
// CFullScreenColorWnd

IMPLEMENT_DYNAMIC(CFullScreenColorWnd, CFrameWnd)

CFullScreenColorWnd::CFullScreenColorWnd()
{
m_BkgndBrush.CreateSolidBrush(RGB(0xFF,0x00,0x00)) ;
}

CFullScreenColorWnd::~CFullScreenColorWnd()
{
}
BEGIN_MESSAGE_MAP(CFullScreenColorWnd, CFrameWnd)
ON_WM_ERASEBKGND()
ON_WM_LBUTTONDOWN()
ON_WM_CREATE()
END_MESSAGE_MAP()

// CFullScreenColorWnd message handlers

BOOL CFullScreenColorWnd::PreCreateWindow(CREATESTRUCT& cs)
{
BOOL ret = CFrameWnd::PreCreateWindow(cs);

cs.style = WS_VISIBLE | WS_POPUP;
cs.dwExStyle = 0;

return ret;
}

int CFullScreenColorWnd::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CFrameWnd::OnCreate(lpCreateStruct) == -1)
return -1;

HDC ScreenDC = ::GetDC(NULL);
MoveWindow(0, 0, ::GetDeviceCaps(ScreenDC, HORZRES),
::GetDeviceCaps(ScreenDC, VERTRES));
::ReleaseDC(NULL, ScreenDC);

return 0;
}

BOOL CFullScreenColorWnd::OnEraseBkgnd(CDC* pDC)
{
CRect CliRect;
GetClientRect(&CliRect);
pDC->FillRect(&CliRect, &m_BkgndBrush);

return TRUE;
}

void CFullScreenColorWnd::OnLButtonDown(UINT nFlags, CPoint point)
{
DestroyWindow();
}

//-----------------------------------------------------
// Example creating the window - click on the window to destroy it
//-----------------------------------------------------

CFullScreenColorWnd *pFullScreenColorWnd = new CFullScreenColorWnd();
pFullScreenColorWnd->Create(NULL, _T(""));


Mark

--
Mark Salsbery
Microsoft MVP - Visual C++

Thanks,
Tim


Jun 27 '08 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: The Plankmeister | last post by:
Hi... Is there a way of calculating the pixel value of the width/height of a string, taking into account the font being used? For example, in Arial 14px, the following is 100 pixels wide and 10...
157
by: Dennis | last post by:
Is there some way --using, say, DOM or javascript-- to detect the current pixel width and/or height of a relatively sized table or of one of its columns or rows. I'm going to be writing javascript...
1
by: cefrancke | last post by:
I've been working with the Twips/Pixel issue and after reviewing the Acc.Dev.Hnd book and the groups, the standard seems to be ... 640x480 15 Twips/Pixel 800x600 12 Twips/Pixel 1024x768 12...
6
by: Craig Parsons | last post by:
Folks, I have an image of a circle, which I am trying to straighten out into a flat line. I am essentially wanting to look at the image, and read a straight line from the centre, and then plot...
2
by: dever | last post by:
I checked my color printers's Printersettings.SupportsColor, which all showed false. What is wrong that I could not use this property. Also, what other way to detect if a printer is color...
3
by: Vrijbuiter | last post by:
I want to detect a pixel color number when i move the mouse over de picturebox. I think the next line has the color but i don't now how i get it: System.Drawing.Point pt = new Point() ; pt.X...
6
by: sanjay | last post by:
Hi, Is there any tool that would do static detection (doesnt execute the application) of dead code for C++ application. Few tools do show which code flow would never get executed, but i am...
6
Thekid
by: Thekid | last post by:
How can I locate a particular pixel in an image? I need to find 'odd' pixels counts, which I can do but I don't know how to get that particular pixel ( if that makes sense): from PIL import...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.