Click here to Skip to main content
15,909,051 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: OpenFile Pin
prasad_som30-Jul-07 19:21
prasad_som30-Jul-07 19:21 
QuestionRe: OpenFile Pin
nitin330-Jul-07 19:57
nitin330-Jul-07 19:57 
AnswerRe: OpenFile Pin
Hamid_RT31-Jul-07 21:17
Hamid_RT31-Jul-07 21:17 
QuestionHow to change the size of the default scrollbar Pin
Nishad S30-Jul-07 18:39
Nishad S30-Jul-07 18:39 
AnswerRe: How to change the size of the default scrollbar Pin
Hans Dietrich30-Jul-07 20:07
mentorHans Dietrich30-Jul-07 20:07 
GeneralRe: How to change the size of the default scrollbar Pin
Nishad S30-Jul-07 20:15
Nishad S30-Jul-07 20:15 
QuestionReading Explorer.exe Address Bar work with 2K/XP but not Vista Pin
Hirakawa30-Jul-07 17:54
Hirakawa30-Jul-07 17:54 
QuestionRe: Reading Explorer.exe Address Bar work with 2K/XP but not Vista Pin
prasad_som30-Jul-07 19:23
prasad_som30-Jul-07 19:23 
AnswerRe: Reading Explorer.exe Address Bar work with 2K/XP but not Vista Pin
Hirakawa30-Jul-07 22:30
Hirakawa30-Jul-07 22:30 
GeneralRe: Reading Explorer.exe Address Bar work with 2K/XP but not Vista Pin
prasad_som30-Jul-07 22:55
prasad_som30-Jul-07 22:55 
GeneralRe: Reading Explorer.exe Address Bar work with 2K/XP but not Vista Pin
Hirakawa31-Jul-07 1:02
Hirakawa31-Jul-07 1:02 
GeneralRe: Reading Explorer.exe Address Bar work with 2K/XP but not Vista Pin
prasad_som31-Jul-07 2:48
prasad_som31-Jul-07 2:48 
AnswerRe: Reading Explorer.exe Address Bar work with 2K/XP but not Vista Pin
Naveen30-Jul-07 21:13
Naveen30-Jul-07 21:13 
GeneralRe: Reading Explorer.exe Address Bar work with 2K/XP but not Vista Pin
Hirakawa31-Jul-07 0:55
Hirakawa31-Jul-07 0:55 
QuestionRe: Reading Explorer.exe Address Bar work with 2K/XP but not Vista Pin
David Crow31-Jul-07 2:59
David Crow31-Jul-07 2:59 
AnswerRe: Reading Explorer.exe Address Bar work with 2K/XP but not Vista Pin
Hirakawa31-Jul-07 6:38
Hirakawa31-Jul-07 6:38 
QuestionFinding and comparing an image! Pin
ksjetski30-Jul-07 17:47
ksjetski30-Jul-07 17:47 
AnswerRe: Finding and comparing an image! Pin
Abdellatif_El_Khlifi13-Aug-07 15:59
Abdellatif_El_Khlifi13-Aug-07 15:59 
QuestionDisable and grey out menu item Pin
Johpoke30-Jul-07 11:28
Johpoke30-Jul-07 11:28 
AnswerRe: Disable and grey out menu item Pin
Michael Dunn30-Jul-07 12:10
sitebuilderMichael Dunn30-Jul-07 12:10 
AnswerRe: Disable and grey out menu item Pin
led mike30-Jul-07 12:42
led mike30-Jul-07 12:42 
AnswerRe: Disable and grey out menu item Pin
Mark Salsbery30-Jul-07 13:58
Mark Salsbery30-Jul-07 13:58 
QuestionRe: Disable and grey out menu item Pin
Johpoke30-Jul-07 21:54
Johpoke30-Jul-07 21:54 
Questionunexistent MailSlots doesn't return error. Pin
r3dqu33n30-Jul-07 10:13
r3dqu33n30-Jul-07 10:13 
QuestionMemory read error on Win2K, but not on XP Pin
Joe Smith IX30-Jul-07 7:15
Joe Smith IX30-Jul-07 7:15 
Hi,

I use a CButton-derived ThemeButton (http://www.codeproject.com/buttonctrl/WowButtons.asp[^]) in my project. It works on XP, but crashes on Windows 2000 with the following error:
"The instruction at '0x00000000' referenced memory at '0x00000000'. The memory could not be 'read'."

I traced it and it happened in the following function:

void ThemeButton::DrawItem(LPDRAWITEMSTRUCT lpDrawItemStruct)
{
  HDC     hDC    = lpDrawItemStruct->hDC;
  CDC*    pDC    = CDC::FromHandle(hDC);
  CRect   rc     = lpDrawItemStruct->rcItem;
  CString sText    (_T(""));
 
  ::CopyRect(&m_pGDSData->rcClip,rc);
  ::CopyRect(&m_pGDSData->rcDest,rc);
  m_pGDSData->hDC = hDC;
 
   if( !(lpDrawItemStruct->itemState & (ODS_DISABLED|ODS_SELECTED)) )
  {
    if( !m_tracking )
    {
      if( lpDrawItemStruct->itemState & ODS_FOCUS )
      ::CopyRect(&m_pGDSData->rcSrc,m_rcDefault);
      else
      ::CopyRect(&m_pGDSData->rcSrc,m_rcNormal);
    }
    else
      ::CopyRect(&m_pGDSData->rcSrc,m_rcHot);
  }
  else
  {
    if( lpDrawItemStruct->itemState & ODS_SELECTED )
      ::CopyRect(&m_pGDSData->rcSrc,m_rcPressed);
    if( lpDrawItemStruct->itemState & ODS_DISABLED )
      ::CopyRect(&m_pGDSData->rcSrc,m_rcDissabled);
  }
 
  <big>(*GdiDrawStreamFunc)(hDC,sizeof(GdiDrawStreamStruct),m_pGDSData); // THIS CRASHES ON WIN2K</big>
 
  ...
}
 
 

BOOL ThemeButton::InitControl(...)
{
...
  m_pGDSData = new GdiDrawStreamStruct;
  ZeroMemory(m_pGDSData,sizeof(GdiDrawStreamStruct));
 
  m_pGDSData->...      = ...;
  m_pGDSData->...       = ...;
...
}	


in the .h file:
PGdiDrawStreamStruct m_pGDSData;
 
 
typedef struct GdiDrawStreamStruct_tag
{
  DWORD   signature;     // = 0x44727753;//"Swrd"
  DWORD   reserved;      // Zero value.
  HDC     hDC;           // handle to the device object of windiw to draw.
  RECT    rcDest;        // desination rect of window to draw.
  DWORD   unknown1;      // must be 1.
  HBITMAP hImage;        // handle to the specia bitmap image.
  DWORD   unknown2;      // must be 9.
  RECT    rcClip;        // desination rect of window to draw.
  RECT    rcSrc;         // source rect of bitmap to draw.
  DWORD   drawOption;    // option flag for drawing image.
  DWORD   leftArcValue;  // arc value of left side.
  DWORD   rightArcValue; // arc value of right side.
  DWORD   topArcValue;   // arc value of top side.
  DWORD   bottomArcValue;// arc value of bottom side.
  DWORD   crTransparent; // transparent color.

} GdiDrawStreamStruct, *PGdiDrawStreamStruct;


Can anyone help me see how it could behave differently in XP and 2K?
Thanks.

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.