|
Hi all,
How can remove this error "An unhandled exception of type 'System.AccessViolationException' occurred in Test.exe
Additional information: Attempted to read or write protected memory. This is often an indication that other memory is corrupt."
In my application is SDI type, i m use splitter here after using splitter in one view i m using a Treeview and in second view i m using a ListCtrl.
in List control for resizing i m using class ResizableFormView that is available on codeproject.
in list control on PreTranslateMessage(MSG* pMsg) function i m using this coding
CListCtrl m_list;
switch(pMsg->message)
{
case WM_KEYDOWN:
{
if (VK_RETURN == (INT)pMsg->wParam && ::GetFocus() == m_list.GetSafeHwnd())
{
int nIndex = m_list.GetNextItem(-1, LVNI_SELECTED);
CString strItem = m_list.GetItemText(nIndex, 0);
//open any dilog box here
}
}
}
return CResizableFormView::PreTranslateMessage(pMsg);//error occured here
for handle enter key on ListCtrl.
this function is done properly but after this the error is coming"An unhandled exception of type 'System.AccessViolationException' occurred in Test.exe"
please tell me what can i do for this.
thank in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
By using your debugger to see exactly what is happening. This can happen for a thousand of different reasons, so we can't provide any universal magical solution.
|
|
|
|
|
In my application is SDI type, i m use splitter here after using splitter in one view i m using a Treeview and in second view i m using a ListCtrl.
in List control for resizing i m using class ResizableFormView that is available on codeproject.
in list control on PreTranslateMessage(MSG* pMsg) function i m using this coding
<br />
CListCtrl m_list;<br />
switch(pMsg->message) <br />
{<br />
case WM_KEYDOWN:<br />
{<br />
if (VK_RETURN == (INT)pMsg->wParam && ::GetFocus() == m_list.GetSafeHwnd()) <br />
{<br />
<br />
int nIndex = m_list.GetNextItem(-1, LVNI_SELECTED);<br />
CString strItem = m_list.GetItemText(nIndex, 0);<br />
<br />
<br />
<br />
}<br />
}<br />
}<br />
return CResizableFormView::PreTranslateMessage(pMsg);<br />
for handle enter key on ListCtrl.
this function is done properly but after this the error is coming"An unhandled exception of type 'System.AccessViolationException' occurred in Test.exe"
please tell me what can i do for this.
thank in advance.
IN A DAY, WHEN YOU DON'T COME ACROSS ANY PROBLEMS - YOU CAN BE SURE THAT YOU ARE TRAVELLING IN A WRONG PATH
|
|
|
|
|
Did you read my previous reply ?
Where does your code crashes exactly ? Use the call stack if necerssary (if the crash doesn't occur in your code).
|
|
|
|
|
Hi,
I'm searching for C++ classes (MFC) gathering media infos in
JPG,GIF,BMP,PDF,MP3,MP4, etc...
To make it clear, I don't want to display or modify the files,
I'm simply interested in lightweight and fast routines to get the basic infos
like width/height/colors in images or number of pages in PDFs
(somewhat like the properties tab in Windows' Explorer).
I don't need big and high sophisticated projects with
hundreds of whistles and bells...
I remember there are books about file "standards" and formats
but I don't really want to reinvent the wheel and start from
scratch.
I'm now searching for days, but all things I found are to complex.
Don't let me be misunderstood, they're all great and kudos to the authors
but for the purpose I'd like to use somewhat 'over-dozed'.
If I succeed I'll make a article with the results, so the routines should
be free of royalties.
Could someone please give me a hint or lead me to some links?
greetings,
ralf.
|
|
|
|
|
I have a VC++ app that uses a progress dialog that contains a CProgressCtrl to indicate progress of a task. When the app kicks of a task, this dialog is launched as a modal dialog and progress of the task is indicated by the CProgressCtrl.
Issue
-----
For tasks that take extended period of time, the progress dialog blanks out (becomes a blank white rectangle) as soon as user selects a different app. But the processing continues as usual. The dialog is closed when the task is completed. Users are getting confused by this behavior since they are not sure if the app went into an infinite loop or is processing normally since there is no indication of progress in the dialog. They just have to give it time or kill it.
I am trying to figure out how to maintain the progress indication in this dialog irrespective of user switching apps. Any suggestions are very much appreciated.
So far, I tried the following, based on posts in this board, without success.
1. Force the dialog to stay on top of all windows in the desktop by including the following statement in OnInitDialog
SetWindowPos(&this->wndTopMost,0,0,0,0,SWP_NOMOVE|SWP_NOSIZE);
2. Calling a Refresh function in the dialog, containing the following statements, periodically during the progression of the task
SetForegroundWindow();
SetFocus();
|
|
|
|
|
|
Thank you for the link but it does not solve my issue.
|
|
|
|
|
I guess your application is single threaded and that is the problem. Once you enter in a function which takes long time GUI cannot be updated since there is only one thread and it is busy in the expensive function. The solution is to create another thread and do the processing in that thread.
-Saurabh
|
|
|
|
|
Thank you.
Can you refer to any topics in this board that would help triggering my functions in a different thread. I have not done any multi-threaded apps as yet.
|
|
|
|
|
Hi Experts
How can i read and write data from USB.Plz help me..
|
|
|
|
|
You don't do that directly. You have to communicate with one of the device sitting on the bus through its device driver, and you can't access the bus directly. Which device are you trying to communicate with ?
The way to go is to get a handle to the driver through CreateFile (you simply the device symbolic name) and then you can call ReadFile and WriteFile or exchange specific control codes by calling DeviceIOControl. All of those things are specific to the device you try to communicate with, so you need to have some documentation.
|
|
|
|
|
Thx's for reply can you give document or example code.If it is possible(document or code) then plz give me..
Thx's
|
|
|
|
|
No I can't because it is specific to the device you are trying to access. So, please answer my question: which device are you trying to communicate with ?
Normally, you should have some documentation supplied with the device.
|
|
|
|
|
ok iwant to access all device but first i want to access PenDrive.So plz help me
|
|
|
|
|
mirtu wrote: ok iwant to access all device
Why do you want to do that ? What do you want to do with those devices if you don't know how to communicate with them ?
mirtu wrote: but first i want to access PenDrive
You can simply access the files the standard way. The driver takes care of everything. The only thing a bit more tricky would be to know which driver letter is used by the device, but I don't know exactly how to do that. I guess you should check somewhere in the registry.
|
|
|
|
|
ok Plz tell me what information you want to know from me.
I got code from codeproject.com which is give information about USB Port Attached device.Link is this
[code]
http://www.codeproject.com/KB/system/HwDetect.aspx[^]
[/code]
So if it is possible then help me
|
|
|
|
|
|
Can anybody suggest me which book is good enough to cover Core User interface concepts in MFC.
Regards,
KDevloper
|
|
|
|
|
|
|
See here.
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I created a class derived from CStatic control. I used this class to create a control similar to a clock control in which a needle rotated continously to show some value. I used onPaint to draw the control's face and a timer to change the position of the needle. In the onTimer function, I used the CDC object to change the position of the line and I am calling the Invalidate function.
I used this control by adding a static control in a dialog in a application. and then created a member variable for the static control and changed member to be an object of my class.
Now when I run the application, my control works fine. But a small blink seems to appear when the needle changes position.
If anybody has suggestions to avoid the blink, Please tell me.
Thanks in Advance,
Mohan
|
|
|
|
|
manohar_balu wrote: I used the CDC object to change the position of the line and I am calling the Invalidate function.
If you are already changing the line position on DC why call invalidate again. Or else dont change just call Invalidate in Timer.
Regards,
Sandip.
|
|
|
|
|
This is because it is getting painted twice for every WM_PAINT it receives. The problem is the WM_ERASEBKGND message, which is sent every time we call BeginPaint. This isn't a problem really - Windows is doing us a favour, because the default action for WM_ERASEBKGND is to draw a nice window background for us (using the window's default background brush), which we can then paint on top of in the WM_PAINT handler.
However, our WM_PAINT handler also draws the control's background, so there is no point in this happening twice. Therefore, we need to prevent the default WM_ERASEBKGND behaviour from happending. As usual, there are a number of ways to do this.
Set the window's background brush to NULL. (Set the hbrBackground member of the WNDCLASS structure to zero when you register the window class).
Return non-zero in the WM_ERASEBKGND message handler.
-@SuDhIrKuMaR@-
|
|
|
|