an application to detect dead pixels of LCD pixel

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • =?Utf-8?B?S2Vsdmlu?=

    #1

    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.

  • Mark Salsbery [MVP]

    #2
    Re: an application to detect dead pixels of LCD pixel

    "Kelvin" <Kelvin@discuss ions.microsoft. comwrote in message
    news:3129128E-8B56-4877-BADC-1ED3AF889334@mi crosoft.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.Atta ch(::GetDesktop Window());
    CWindowDC DesktopDC(&Desk topWnd);
    CBrush RedBrush(RGB(0x FF,0x00,0x00));
    CRect DesktopRect;
    DesktopWnd.GetW indowRect(&Desk topRect);
    DesktopDC.FillR ect(&DesktopRec t, &RedBrush);
    DesktopWnd.Deta ch();

    Restore screen to normal display:

    ::InvalidateRec t(NULL, NULL, TRUE);


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

    Mark

    --
    Mark Salsbery
    Microsoft MVP - Visual C++

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

    Comment

    • Ben Voigt [C++ MVP]

      #3
      Re: an application to detect dead pixels of LCD pixel

      Mark Salsbery [MVP] wrote:
      "Kelvin" <Kelvin@discuss ions.microsoft. comwrote in message
      news:3129128E-8B56-4877-BADC-1ED3AF889334@mi crosoft.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.Atta ch(::GetDesktop Window());
      CWindowDC DesktopDC(&Desk topWnd);
      CBrush RedBrush(RGB(0x FF,0x00,0x00));
      CRect DesktopRect;
      DesktopWnd.GetW indowRect(&Desk topRect);
      DesktopDC.FillR ect(&DesktopRec t, &RedBrush);
      DesktopWnd.Deta ch();
      Don't try to draw on the desktop window, create your own fullscreen window.
      >
      Restore screen to normal display:
      >
      >>InvalidateRec t(NULL, NULL, TRUE);
      >
      >
      BTW, there's an MFC newsgroup: microsoft.publi c.vc.mfc
      >
      Mark
      >
      >
      >>
      >Can anyone know how to write code for this application?
      >>
      >Thank a lot.

      Comment

      • Mark Salsbery [MVP]

        #4
        Re: an application to detect dead pixels of LCD pixel

        "Ben Voigt [C++ MVP]" <rbv@nospam.nos pamwrote in message
        news:Ow6wkbzmIH A.3532@TK2MSFTN GP05.phx.gbl...
        Mark Salsbery [MVP] wrote:
        >"Kelvin" <Kelvin@discuss ions.microsoft. comwrote in message
        >news:3129128 E-8B56-4877-BADC-1ED3AF889334@mi crosoft.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.Att ach(::GetDeskto pWindow());
        >CWindowDC DesktopDC(&Desk topWnd);
        >CBrush RedBrush(RGB(0x FF,0x00,0x00));
        >CRect DesktopRect;
        >DesktopWnd.Get WindowRect(&Des ktopRect);
        >DesktopDC.Fill Rect(&DesktopRe ct, &RedBrush);
        >DesktopWnd.Det ach();
        >
        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:
        >>
        >>>InvalidateRe ct(NULL, NULL, TRUE);
        >>
        >>
        >BTW, there's an MFC newsgroup: microsoft.publi c.vc.mfc
        >>
        >Mark
        >>
        >>
        >>>
        >>Can anyone know how to write code for this application?
        >>>
        >>Thank a lot.
        >
        >

        Comment

        • =?Utf-8?B?S2Vsdmlu?=

          #5
          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.nos pamwrote in message
          news:Ow6wkbzmIH A.3532@TK2MSFTN GP05.phx.gbl...
          Mark Salsbery [MVP] wrote:
          "Kelvin" <Kelvin@discuss ions.microsoft. comwrote in message
          news:3129128E-8B56-4877-BADC-1ED3AF889334@mi crosoft.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.Atta ch(::GetDesktop Window());
          CWindowDC DesktopDC(&Desk topWnd);
          CBrush RedBrush(RGB(0x FF,0x00,0x00));
          CRect DesktopRect;
          DesktopWnd.GetW indowRect(&Desk topRect);
          DesktopDC.FillR ect(&DesktopRec t, &RedBrush);
          DesktopWnd.Deta ch();
          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:
          >
          >>InvalidateRec t(NULL, NULL, TRUE);
          >
          >
          BTW, there's an MFC newsgroup: microsoft.publi c.vc.mfc
          >
          Mark
          >
          >
          >>
          >Can anyone know how to write code for this application?
          >>
          >Thank a lot.

          Comment

          • =?Utf-8?B?S2Vsdmlu?=

            #6
            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.Atta ch(::GetDesktop Window());
            CWindowDC DesktopDC(&Desk topWnd);
            CBrush RedBrush(RGB(0x FF,0x00,0x00));
            CRect DesktopRect;
            DesktopWnd.GetW indowRect(&Desk topRect);
            DesktopDC.FillR ect(&DesktopRec t, &RedBrush);
            DesktopWnd.Deta ch();

            }

            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]" <rbv@nospam.nos pamwrote in message
            news:Ow6wkbzmIH A.3532@TK2MSFTN GP05.phx.gbl...
            Mark Salsbery [MVP] wrote:
            >"Kelvin" <Kelvin@discuss ions.microsoft. comwrote in message
            >news:3129128 E-8B56-4877-BADC-1ED3AF889334@mi crosoft.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.Att ach(::GetDeskto pWindow());
            >CWindowDC DesktopDC(&Desk topWnd);
            >CBrush RedBrush(RGB(0x FF,0x00,0x00));
            >CRect DesktopRect;
            >DesktopWnd.Get WindowRect(&Des ktopRect);
            >DesktopDC.Fill Rect(&DesktopRe ct, &RedBrush);
            >DesktopWnd.Det ach();
            >
            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:
            >>
            >>>InvalidateRe ct(NULL, NULL, TRUE);
            >>
            >>
            >BTW, there's an MFC newsgroup: microsoft.publi c.vc.mfc
            >>
            >Mark
            >>
            >>
            >>>
            >>Can anyone know how to write code for this application?
            >>>
            >>Thank a lot.
            >
            >

            Comment

            • Mark Salsbery [MVP]

              #7
              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@discuss ions.microsoft. comwrote in message
              news:CF98DEB5-243E-43DF-B502-FE043B919EC4@mi crosoft.com...
              My code is follow:
              >
              void CTestScreenDlg: :OnButtonStart( )
              {
              // TODO: Add your control notification handler code here
              CWnd DesktopWnd;
              DesktopWnd.Atta ch(::GetDesktop Window());
              CWindowDC DesktopDC(&Desk topWnd);
              CBrush RedBrush(RGB(0x FF,0x00,0x00));
              CRect DesktopRect;
              DesktopWnd.GetW indowRect(&Desk topRect);
              DesktopDC.FillR ect(&DesktopRec t, &RedBrush);
              DesktopWnd.Deta ch();
              >
              }
              >
              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]" <rbv@nospam.nos pamwrote in message
              news:Ow6wkbzmIH A.3532@TK2MSFTN GP05.phx.gbl...
              Mark Salsbery [MVP] wrote:
              >"Kelvin" <Kelvin@discuss ions.microsoft. comwrote in message
              >news:3129128 E-8B56-4877-BADC-1ED3AF889334@mi crosoft.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.Att ach(::GetDeskto pWindow());
              >CWindowDC DesktopDC(&Desk topWnd);
              >CBrush RedBrush(RGB(0x FF,0x00,0x00));
              >CRect DesktopRect;
              >DesktopWnd.Get WindowRect(&Des ktopRect);
              >DesktopDC.Fill Rect(&DesktopRe ct, &RedBrush);
              >DesktopWnd.Det ach();
              >
              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:
              >>
              >>>InvalidateRe ct(NULL, NULL, TRUE);
              >>
              >>
              >BTW, there's an MFC newsgroup: microsoft.publi c.vc.mfc
              >>
              >Mark
              >>
              >>
              >>>
              >>Can anyone know how to write code for this application?
              >>>
              >>Thank a lot.
              >
              >

              Comment

              • =?Utf-8?B?S2Vsdmlu?=

                #8
                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 me
                on Vista :)
                >
                Mark
                >
                --
                Mark Salsbery
                Microsoft MVP - Visual C++
                >
                >
                "Kelvin" <Kelvin@discuss ions.microsoft. comwrote in message
                news:CF98DEB5-243E-43DF-B502-FE043B919EC4@mi crosoft.com...
                My code is follow:

                void CTestScreenDlg: :OnButtonStart( )
                {
                // TODO: Add your control notification handler code here
                CWnd DesktopWnd;
                DesktopWnd.Atta ch(::GetDesktop Window());
                CWindowDC DesktopDC(&Desk topWnd);
                CBrush RedBrush(RGB(0x FF,0x00,0x00));
                CRect DesktopRect;
                DesktopWnd.GetW indowRect(&Desk topRect);
                DesktopDC.FillR ect(&DesktopRec t, &RedBrush);
                DesktopWnd.Deta ch();

                }

                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]" <rbv@nospam.nos pamwrote in message
                news:Ow6wkbzmIH A.3532@TK2MSFTN GP05.phx.gbl...
                Mark Salsbery [MVP] wrote:
                >"Kelvin" <Kelvin@discuss ions.microsoft. comwrote in message
                >news:3129128 E-8B56-4877-BADC-1ED3AF889334@mi crosoft.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.Att ach(::GetDeskto pWindow());
                >CWindowDC DesktopDC(&Desk topWnd);
                >CBrush RedBrush(RGB(0x FF,0x00,0x00));
                >CRect DesktopRect;
                >DesktopWnd.Get WindowRect(&Des ktopRect);
                >DesktopDC.Fill Rect(&DesktopRe ct, &RedBrush);
                >DesktopWnd.Det ach();
                >
                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:
                >>
                >>>InvalidateRe ct(NULL, NULL, TRUE);
                >>
                >>
                >BTW, there's an MFC newsgroup: microsoft.publi c.vc.mfc
                >>
                >Mark
                >>
                >>
                >>>
                >>Can anyone know how to write code for this application?
                >>>
                >>Thank a lot.
                >
                >

                Comment

                • Mark Salsbery [MVP]

                  #9
                  Re: an application to detect dead pixels of LCD pixel

                  "Kelvin" <Kelvin@discuss ions.microsoft. comwrote in message
                  news:82FB1AD9-8D31-471D-89C4-46ACDD6F38B3@mi crosoft.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...

                  //-----------------------------------------------------
                  // FullScreenColor Wnd.h
                  //-----------------------------------------------------

                  #pragma once
                  #include "afxwin.h"


                  // CFullScreenColo rWnd

                  class CFullScreenColo rWnd : public CFrameWnd
                  {
                  DECLARE_DYNAMIC (CFullScreenCol orWnd)

                  public:
                  CFullScreenColo rWnd();
                  virtual ~CFullScreenCol orWnd();

                  protected:
                  DECLARE_MESSAGE _MAP()
                  virtual BOOL PreCreateWindow (CREATESTRUCT& cs);
                  public:
                  afx_msg int OnCreate(LPCREA TESTRUCT lpCreateStruct) ;
                  afx_msg BOOL OnEraseBkgnd(CD C* pDC);
                  afx_msg void OnLButtonDown(U INT nFlags, CPoint point);

                  CBrush m_BkgndBrush;
                  };



                  //-----------------------------------------------------
                  // FullScreenColor Wnd.cpp
                  //-----------------------------------------------------

                  #include "stdafx.h"
                  #include "FullScreenColo rWnd.h"


                  // CFullScreenColo rWnd

                  IMPLEMENT_DYNAM IC(CFullScreenC olorWnd, CFrameWnd)

                  CFullScreenColo rWnd::CFullScre enColorWnd()
                  {
                  m_BkgndBrush.Cr eateSolidBrush( RGB(0xFF,0x00,0 x00));
                  }

                  CFullScreenColo rWnd::~CFullScr eenColorWnd()
                  {
                  }


                  BEGIN_MESSAGE_M AP(CFullScreenC olorWnd, CFrameWnd)
                  ON_WM_ERASEBKGN D()
                  ON_WM_LBUTTONDO WN()
                  ON_WM_CREATE()
                  END_MESSAGE_MAP ()



                  // CFullScreenColo rWnd message handlers



                  BOOL CFullScreenColo rWnd::PreCreate Window(CREATEST RUCT& cs)
                  {
                  BOOL ret = CFrameWnd::PreC reateWindow(cs) ;

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

                  return ret;
                  }

                  int CFullScreenColo rWnd::OnCreate( LPCREATESTRUCT lpCreateStruct)
                  {
                  if (CFrameWnd::OnC reate(lpCreateS truct) == -1)
                  return -1;

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

                  return 0;
                  }

                  BOOL CFullScreenColo rWnd::OnEraseBk gnd(CDC* pDC)
                  {
                  CRect CliRect;
                  GetClientRect(& CliRect);
                  pDC->FillRect(&CliR ect, &m_BkgndBrus h);

                  return TRUE;
                  }

                  void CFullScreenColo rWnd::OnLButton Down(UINT nFlags, CPoint point)
                  {
                  DestroyWindow() ;
                  }



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

                  CFullScreenColo rWnd *pFullScreenCol orWnd = new CFullScreenColo rWnd();
                  pFullScreenColo rWnd->Create(NULL, _T(""));




                  Mark

                  --
                  Mark Salsbery
                  Microsoft MVP - Visual C++

                  Thanks,
                  Tim
                  >
                  >

                  Comment

                  Working...