Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to Get LPDRAWITEMSTRUCT from CWnd pointer?

How to Get LPDRAWITEMSTRUCT from CWnd pointer?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestion
2 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    RuiSantiago
    wrote on last edited by
    #1

    Hi! I'm using owner draw buttons, and i have the need of making them disabled in some situations, i have this function: void CMyButton::Activa(CWnd *pWnd, BOOL bEnable) { int iCtrl=0; CString sTexto; pWnd->EnableWindow(bEnable); m_ToolTip.DelTool(pWnd, 0); iCtrl=pWnd->GetDlgCtrlID(); pWnd->GetWindowText(sTexto); } This is called by the form class where the button is. With pWnd i would also like to call its LPDRAWITEMSTRUCT, so i can call void CMyButton::DrawButton(int nIDCtl, LPDRAWITEMSTRUCT pDI, CString sTexto) and redesing the button for that situation, i'm not sure if this is the best solution for the propose but its the only i know! Thank you for your time! rui

    R 1 Reply Last reply
    0
    • R RuiSantiago

      Hi! I'm using owner draw buttons, and i have the need of making them disabled in some situations, i have this function: void CMyButton::Activa(CWnd *pWnd, BOOL bEnable) { int iCtrl=0; CString sTexto; pWnd->EnableWindow(bEnable); m_ToolTip.DelTool(pWnd, 0); iCtrl=pWnd->GetDlgCtrlID(); pWnd->GetWindowText(sTexto); } This is called by the form class where the button is. With pWnd i would also like to call its LPDRAWITEMSTRUCT, so i can call void CMyButton::DrawButton(int nIDCtl, LPDRAWITEMSTRUCT pDI, CString sTexto) and redesing the button for that situation, i'm not sure if this is the best solution for the propose but its the only i know! Thank you for your time! rui

      R Offline
      R Offline
      RuiSantiago
      wrote on last edited by
      #2

      How can i assign a value to the LPDRAWITEMSTRUCT struct parameters? I tried : void CMyButton::Activa(CWnd *pWnd, BOOL bEnable) { CRect rc; pDIS->itemAction = ODA_DRAWENTIRE; <-error pDIS->hwndItem = pWnd->GetSafeHwnd(); <-error pDIS->hDC = (HDC)pWnd->GetDC(); <-error pWnd->GetWindowRect(rc); pDIS->rcItem = rc; <-error CString sTexto; //desactiva a o botao e os seus tooltips pWnd->EnableWindow(bEnable); m_ToolTip.DelTool(pWnd, 0); //vai buscar ourtros dados do botao iCtrl=pWnd->GetDlgCtrlID(); pWnd->GetWindowText(sTexto); //passa o estado do botao para uma member variavel bDisabled=bEnable; DrawButton(iCtrl, pDIS, sTexto); } having BOOL bDisabled; int iCtrl; LPDRAWITEMSTRUCT pDIS; as member variables Thank you

      1 Reply Last reply
      0
      Reply
      • Reply as topic
      Log in to reply
      • Oldest to Newest
      • Newest to Oldest
      • Most Votes


      • Login

      • Don't have an account? Register

      • Login or register to search.
      • First post
        Last post
      0
      • Categories
      • Recent
      • Tags
      • Popular
      • World
      • Users
      • Groups