Why DrawText() fails?
-
Hi, I am using "DrawText(HDC hDC,LPCTSTR lpchText,int nCount,LPRECT lpRect,UINT uFormat)" in my project, it returns 0 means function fils. In which case this function will fail and whether there is error code for this function? I have gone through MSDN but they didn't mentioned the reason for failing. Thanks in Advance, Ratheesh
-
Hi, I am using "DrawText(HDC hDC,LPCTSTR lpchText,int nCount,LPRECT lpRect,UINT uFormat)" in my project, it returns 0 means function fils. In which case this function will fail and whether there is error code for this function? I have gone through MSDN but they didn't mentioned the reason for failing. Thanks in Advance, Ratheesh
Have you tried
GetLastError()
?"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
-
Have you tried
GetLastError()
?"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
-
Hi, I am using "DrawText(HDC hDC,LPCTSTR lpchText,int nCount,LPRECT lpRect,UINT uFormat)" in my project, it returns 0 means function fils. In which case this function will fail and whether there is error code for this function? I have gone through MSDN but they didn't mentioned the reason for failing. Thanks in Advance, Ratheesh
The problem isn't with the
DrawText
call itself. Apparently something isNULL
inDrawText(HDC hDC,LPCTSTR lpchText,int nCount,LPRECT lpRect,UINT uFormat)
An access violation occurs in unmanaged or unsafe code when it attempts to read or write to memory that has not been allocated, or to which it does not have access. Not all reads or writes through bad pointers lead to access violations, so an access violation usually indicates that several reads or writes have occurred through bad pointers, and that memory might be corrupted. [This] might shed some light.
-
Hi, I am using "DrawText(HDC hDC,LPCTSTR lpchText,int nCount,LPRECT lpRect,UINT uFormat)" in my project, it returns 0 means function fils. In which case this function will fail and whether there is error code for this function? I have gone through MSDN but they didn't mentioned the reason for failing. Thanks in Advance, Ratheesh
Try showing the actual code from your program, and make sure that all the parameters are valid.
Unrequited desire is character building. OriginalGriff I'm sitting here giving you a standing ovation - Len Goodman
-
The problem isn't with the
DrawText
call itself. Apparently something isNULL
inDrawText(HDC hDC,LPCTSTR lpchText,int nCount,LPRECT lpRect,UINT uFormat)
An access violation occurs in unmanaged or unsafe code when it attempts to read or write to memory that has not been allocated, or to which it does not have access. Not all reads or writes through bad pointers lead to access violations, so an access violation usually indicates that several reads or writes have occurred through bad pointers, and that memory might be corrupted. [This] might shed some light.
TopCoder23 wrote:
An access violation occurs
Where exactly did they say they experienced an access violation? They could have simply passed in an invalid parameter option for format or the function could have simply checked for a NULL parameter and returned indicating failure based on that branch statement.