|
Flaviu2 wrote: if(cValues)
{
TRACE1("\nNumber of values: %d\n", cValues);
What is the value of cValues ?
Flaviu2 wrote: is reading only first and last file in CComboBox...
So is the problem with reading from the registry or reading from the combobox?
What is the value of retCode each iteration of the second loop?
"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
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
The number of cValues is 3. Of course, the is registry reading, not combo vales. I didn't test retCode ... my mistake.
modified on Tuesday, August 9, 2011 11:29 AM
|
|
|
|
|
When you enumerate the key-values you need to reset the value of cbData to 4096 after each call. This is because each time a value is returned its length is stored in this field, so any values larger than a previous one will not be returned as the RegEnumValue() function thinks that the buffer is not large enough.
|
|
|
|
|
Thank you all guys, you help me a lot ! Richard, that was the problem. Best wishes ! You do a great think here !
modified on Tuesday, August 9, 2011 1:43 PM
|
|
|
|
|
Hi all,
I'm developing an application which helps to manage car park by recognizing the car's plate number. I use VC++, OpenCV, Windows SDK and DirectX in this app. But I am now having a little trouble with it.
Let me introduce a bit about how my system works so that you guys can understand about it:
When a car enters the park, we scan one card with a card reader. Right after the card is read, our camera will take a picture of the car's plate and our system will recognize the plate number and assign it to the scanned card's id. And the car will then be allowed to get into the park.
When the car gets out of the park, the same process happens. If the plate number of the car and the card's id are the same with those in database, the car will be allowed to get out.
Here is my trouble: When I start the application, it works fine and no errors happen like the below picture.
_http://s1.postimage.org/266bl4fsy/image.jpg[^]
But the "Debug assertion failed" error happen when I scan a card with our card reader. The specific error is in the below image.
_http://s2.postimage.org/270yeip2a/image.jpg[^]
Can any one help me to fix this annoying error? Many thanks to you all.
|
|
|
|
|
Click 'Retry', check the comments around the ASSERT and the call stack. We won't be able to tell you much more without actually seeing some code and/or knowing in more detail what you are doing.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> If it doesn't matter, it's antimatter.<
|
|
|
|
|
Nguyen Huy Tuan wrote: But the "Debug assertion failed" error happen when I scan a card with our card reader. So have you looked at line 906 of wincore.cpp ?
"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
"Some people are making such thorough preparation for rainy days that they aren't enjoying today's sunshine." - William Feather
|
|
|
|
|
In my opinion, there might be some wrong environment configurations with DirectX, or Window SDK, or ActiveX Control, not somthing which relates to wincore.cpp or any source code file of the project, since the project worked fine before, but I don't know what exactly it is. I'm getting crazy with this. It's messing me up....
|
|
|
|
|
Hi all,
i am create a html file with text color,background color and other image formatting.
now i want to extract only text information of this page without any html tags.
please help me how can i do this.
thanks in advance.
|
|
|
|
|
Le@rner wrote: i am create a html file with text color,background color and other image formatting.
now i want to extract only text information of this page without any html tags.
please help me how can i do this.
thanks in advance.
If you are aware of IHTMLElement interface, it might able to help you read more here[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
how can i use this?
there is any example for this.
|
|
|
|
|
Le@rner wrote: there is any example for this
clickit[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
I have been trying to hunt down the reason my program compiles fine, but has a problem in runtime with bitmaps. The program has been tracked down to a pointer that seems to have its value changed to NULL at some point during this call:
void CWinSTMView::OnImageAutoPlane()
{
CWinSTMDoc *pDoc = CreateNewDoc(GetDocument()); and
pDoc->CopyDoc(pNewDoc,m_MyChannel);
CATCH_ALL(e)
{
lResult = AfxProcessWndProcException(e, &pThreadState->m_lastSentMsg);
TRACE(traceAppMsg, 0, "Warning: Uncaught exception in WindowProc (returning %ld).\n",
lResult);
DELETE_EXCEPTION(e);
}
I have set breakpoints all around the location where the problem seems to be happening, but I keep stepping into what seems to be windows libraries and code that I probably shouldn't change (it is write protected). The bitmap also loads fine (and initializes) when I first open the file, it is only after I try the 'autoplane' function above that it encounters the exception. Any ideas on how I can go about fixing this? I have no problems with using the debugger and stepping through the code if more information is needed. (Please ask, I am not sure what would be helpful)
solved here:Debug Assertion Error Visual Studio 2010[^]
modified on Thursday, August 25, 2011 3:44 PM
|
|
|
|
|
Which pointer had its value changed to NULL? What exception is thrown? Are you getting an ASSERT() exception or something else?
|
|
|
|
|
The pointer is called m_bitmap and I think it holds the memory location to the saved bitmap since it is called in the following
bool CWinSTMBmp::Init(int sizex, int sizey, RGBQUAD* Pal)
{
if (m_Bitmap != 0)
DeleteObject(m_Bitmap);
if (m_Bitmap == NULL)
{
ZeroMemory ( &m_ImageInfo, sizeof (BITMAPINFO) );
m_ImageInfo.bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
m_ImageInfo.bmiHeader.biWidth = sizex;
m_ImageInfo.bmiHeader.biHeight = -sizey;
m_ImageInfo.bmiHeader.biPlanes = 1;
m_ImageInfo.bmiHeader.biBitCount = 32;
m_ImageInfo.bmiHeader.biCompression = BI_RGB;
m_ImageInfo.bmiHeader.biSizeImage = 0;
m_Bitmap=CreateDIBSection ( NULL, &m_ImageInfo, DIB_RGB_COLORS, (void **)&m_BmpBits, NULL, NULL );
}
memcpy(m_RGB,Pal,sizeof(RGBQUAD)*256);
m_SizeX = sizex;
m_SizeY = sizey;
return true;
} I have verified the this is called in the program and the bitmap is initialized when I open the file (does it need to initialize again?). The only information I can give on the exception is that it says DEBUG ASSERTION FAILED! and when I continue to try to debug it causes a break at this line
ENSURE(SUCCEEDED(hr));
Add(psi, strAppID);
#endif
does this help at all?
|
|
|
|
|
AndrewG1231 wrote: does this help at all?
Not really, you don't seem very sure about the usage of m_bitmap , and you fail to indicate exactly where the assertion occurs, and what variables and values cause it. Try to gather all information and copy any messages word for word.
|
|
|
|
|
This seems like a common response, and I keep trying to find exactly where the assertion occurs but apparently not very successfully. Here is what keeps happening...I run the program in the debugger and execute the commands that lead to the error. I have put breakpoints all around the code where I think the problem has been occurring and I continue to walk through and try to identify the exact problem, however, I keep walking through different code sources that aren't program written (like the WndProc()). When I hit the error, I get a the Debug Assertion Failed and it gives me the path of some file on an f: drive I don't have (I think f: is just the c++ notation)...then it asks me to abort, retry, or ignore...retry, i get the message that my program has triggered a breakpoint and it goes right to the last section of code.
I have been tracking m_bitmap because it seems to hold the information from the CreateDIBSection() which I think is where all the bitmap information is stored.
I wish I knew what I could post to be more informative, but this is a large program with lots of classes....I have happily worked with all the suggestions on the site (which are awesome!) and will continue to try to get more information and hopefully get the program to work correctly.
modified on Tuesday, August 9, 2011 1:26 PM
|
|
|
|
|
AndrewG1231 wrote: and it gives me the path of some file on an f: drive I don't have (I think f: is just the c++ notation)
No, it's not C++ notation, it is the path to some object or source module built into your application. If you do not know where your source and object modules come from then it's unlikely that anyone here will be able to make any useful guesses. It seems to me that you are trying to run/debug some code that has been developed elsewhere but you are not fully familiar with.
|
|
|
|
|
I understand, the thoughts on here have been very helpful with figuring out where to look. Here is the exact message (I think I just posted this in another thread..sorry)
Program: C:\Users\Jeffrey\Desktop\WinSTM\.\Debug\WinSTM.exe
File: f:\dd\vctools\vc7libs\ship\atlmfc\src\mfc\filelist.cpp Line:225
This refers to the following code
ENSURE(SUCCEEDED(hr));
Add(psi, strAppID);
#endif
You are right, it is inherited code...and I am doing my best to figure out what is going wrong with it. I also apologize if some of the questions seem naive/amateurish.
|
|
|
|
|
If the ENSURE(SUCCEEDED(hr)) failed at filelist.cpp line 225, then it means that the call to ShellCreateItemFromParsingName() failed.
This is part of the CRecentFileList::Add method.
Whenever debugging assertions, use the callstack. What was calling whom? Walk up the stack to see what's going on.
What's the value of hr ? I bet that will offer a huge clue.
/* Charles Oppermann */
http://weblogs.asp.net/chuckop
|
|
|
|
|
The value of hr is E_INVALIDARG of type HRESULT...this does seem to be telling me something, but I am not sure which argument it is referring to in my stack. After the the assertion when I press retry to continue to debug the program breaks and here is my call stack:
mfc100d.dll!CRecentFileList::Add(const char * lpszPathName, const char * lpszAppID) Line 225 + 0x25 bytes C++
mfc100d.dll!CWinApp::AddToRecentFileList(const char * lpszPathName) Line 84 C++
mfc100d.dll!CDocument::SetPathName(const char * lpszPathName, int bAddToMRU) Line 296 C++
mfc100d.dll!COleDocument::SetPathName(const char * lpszPathName, int bAddToMRU) Line 183 C++
WinSTM.exe!CWinSTMDoc::CopyDoc(CWinSTMDoc * pDocNew, int chan) Line 485 + 0x3b bytes C++
WinSTM.exe!CWinSTMView::CreateNewDoc(CWinSTMDoc * pDoc) Line 2715 C++
WinSTM.exe!CWinSTMView::OnImageAutoPlane() Line 4786 + 0x11 bytes C++
However, I think there is a problem going on here based on tracking m_Bitmap, but this occurs before the exception is thrown (the following call stack occurs when I hear a sound that seems to indicate a problem with the bitmap):
HBITMAP CWinSTMBmp::GetHBitmap(void)
{
return HBITMAP(m_Bitmap);
}
WinSTM.exe!CWinSTMBmp::GetHBitmap() Line 68 C++
WinSTM.exe!CWinSTMView::DrawImage(CDC * pDC) Line 774 + 0xe bytes C++
WinSTM.exe!CWinSTMView::OnDraw(CDC * pDC) Line 457 C++
mfc100d.dll!CView::OnPaint() Line 189 C++
mfc100d.dll!CWnd::OnWndMsg(unsigned int message, unsigned int wParam, long lParam, long * pResult) Line 2354 C++
mfc100d.dll!CWnd::WindowProc(unsigned int message, unsigned int wParam, long lParam) Line 2067 + 0x20 bytes C++
mfc100d.dll!AfxCallWndProc(CWnd * pWnd, HWND__ * hWnd, unsigned int nMsg, unsigned int wParam, long lParam) Line 248 + 0x1c bytes C++
|
|
|
|
|
It's difficult to figure out, but are you sure the m_Bitmap member is valid?
One thing to remember is that you have to stash bitmap handles in the class, or they are destoyed after processing of the of the message, in this case WM_PAINT.
/* Charles Oppermann */
http://weblogs.asp.net/chuckop
|
|
|
|
|
It is a valid pointer the first time it is called, but the second time it is initializes something is going wrong (it is remaining NULL when it should contain the information for the bitmap). However, they are destroyed after processing in my code. Here is the part of the bitmap processing code with the constructor/destructor through the "render" member where the flag of (m_Bitmap==NULL) becomes true and I get the message "Bitmap not init" (note, the 'a' in the code is my signal that this is code section telling me something is going wrong). Still, it works when the bitmap is first opened by the program, but not when I try to manipulate the image that results in the document being copied to a new window(CopyDoc is called).
CWinSTMBmp::CWinSTMBmp(void)
{
ZeroMemory(&m_HistogramData,sizeof(int)*256);
m_ImageMode = IMAGE_MODE_HORIZONTAL;
m_Inversion = false;
m_Derivative = false;
m_LineDC = false;
m_Render = false;
m_Bitmap = NULL;
m_BmpBits = NULL;
m_SizeX = 0;
m_SizeY = 0;
}
CWinSTMBmp::~CWinSTMBmp(void)
{
if(m_Bitmap != NULL)
DeleteObject(m_Bitmap);
}
bool CWinSTMBmp::Init(int sizex, int sizey, RGBQUAD* Pal)
{
if (m_Bitmap != NULL)
{
DeleteObject(m_Bitmap);
m_Bitmap=NULL;
}
if (m_Bitmap == NULL)
{
ZeroMemory ( &m_ImageInfo, sizeof (BITMAPINFO) );
m_ImageInfo.bmiHeader.biSize = sizeof (BITMAPINFOHEADER);
m_ImageInfo.bmiHeader.biWidth = sizex;
m_ImageInfo.bmiHeader.biHeight = -sizey;
m_ImageInfo.bmiHeader.biPlanes = 1;
m_ImageInfo.bmiHeader.biBitCount = 32;
m_ImageInfo.bmiHeader.biCompression = BI_RGB;
m_ImageInfo.bmiHeader.biSizeImage = 0;
m_Bitmap=CreateDIBSection ( NULL, &m_ImageInfo, DIB_RGB_COLORS, (void **)&m_BmpBits, NULL, NULL );
}
memcpy(m_RGB,Pal,sizeof(RGBQUAD)*256);
m_SizeX = sizex;
m_SizeY = sizey;
return true;
}
HBITMAP CWinSTMBmp::GetHBitmap(void)
{
return HBITMAP(m_Bitmap);
}
BITMAPINFO* CWinSTMBmp::GetBmpInfo(void)
{
return &m_ImageInfo;
}
bool CWinSTMBmp::Render(int* Data,int Min, int Max)
{
if(Data == NULL)
{
AfxMessageBox("Passing in a NULL Data Ptr");
return false;
}
if(m_Bitmap == NULL)
{
AfxMessageBox("aBitmap has not been init");
return false;
}
Do you happen to know what the
return HBITMAP(m_Bitmap);
is doing?
|
|
|
|
|
Couple of ideas:
m_Bitmap=CreateDIBSection ( NULL, &m_ImageInfo, DIB_RGB_COLORS, (void **)&m_BmpBits, NULL, NULL );
That could be failing and not setting m_Bitmap correctly.
return (HBITMAP)(m_Bitmap);
Is casting m_Bitmap to a HBITMAP (bitmap handle).
What is m_Bitmap defined as? A CBitmap?
/* Charles Oppermann */
http://weblogs.asp.net/chuckop
|
|
|
|
|
There may be a problem with the first line, but I can't figure out why it initializes the first time I open the file but not when I try to use it. Regarding the second line..is that the same as the HBITMAP(m_Bitmap)? Is what you have shown the proper way to code the line?
As far as I can tell in the header file m_Bitmap is of type HBITMAP, see below:
class CWinSTMBmp
{
public:
CWinSTMBmp(void);
~CWinSTMBmp(void);
bool Init(int sizex, int sizey, RGBQUAD* Pal);
void SetLineDC(bool enable);
void SetInversion(bool enable);
void SetDer(bool enable);
void UpdatePallet(RGBQUAD* Pal);
HBITMAP GetHBitmap(void);
BITMAPINFO* GetBmpInfo(void);
RGBQUAD* GetBmpBits(void);
void SetProperties(bool Derivative, bool LineDC, int Direction, bool Invert);
void DeleteBmp(void);
bool Render(int* Data, int Min, int Max);
bool RenderUI(unsigned short* Data, int Min, int Max);
bool RenderMetaBmp(int * Data, int Min = 0, int Max = 0);
int* GetHistogramData(void);
bool m_Render;
bool m_Derivative;
bool m_LineDC;
bool m_Inversion;
RGBQUAD m_RGB[256];
HBITMAP m_Bitmap;
RGBQUAD *m_BmpBits;
BITMAPINFO m_ImageInfo;
int *m_DataPtr;
int m_HistogramData[256];
int m_SizeX,
m_SizeY;
int m_ImageMode;
int m_Max,
m_Min;
void NewLUT(RGBQUAD* newRGB);
};
|
|
|
|
|