|
Then get a pointer/handler to your view and call the methode from the other place.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
A menu isn't a dialog, calling GetDlgItem() on a menu is meaningless. UPDATE_COMMAND_UI is what you use to disable commands in the menu and toolbar.
|
|
|
|
|
Hi!
I'm working in a VC++ Project under VC++ 2005. In Release mode,it runs fine. It shows me an exception only under Debug mode. Here it is:
Unhandled exception at 0x00448b61 in test1.exe: 0xC0000005: Access violation reading location 0xcdcdcdcd.
When I break this exception, the pointer goes to a file ref_ptr which is not defined by me. It's a Delta3D Engine's(Simulation Engine)file. What to do to resolve this exception?
|
|
|
|
|
This mean you are trying to access a pointer that has been deleted. Since this is happening in external library code it might mean either there is a bug in the library or more likely you program has a bug.
-Saurabh
|
|
|
|
|
What to do make the program run,
(i)if the problem is with external library?
(ii)if my program has a bug?
Regards,
Rathakrishnan.T
|
|
|
|
|
T.RATHA KRISHNAN wrote: (i)if the problem is with external library?
Report it to the library vendor (if there's a scope) or if you have the source code for that library, fix it yourself. If you don't have the library code, well, try to dodge this bug; find out how this issue occurs and if there's a way to prevent this bug from crashing your program.
T.RATHA KRISHNAN wrote: (ii)if my program has a bug?
Fix it.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Simplest way is to step through your program and check where is the crash. Then try to find out why a pointer was used after it was deleted.
-Saurabh
|
|
|
|
|
T.RATHA KRISHNAN wrote: When I break this exception, the pointer goes to a file ref_ptr which is not defined by me. It's a Delta3D Engine's(Simulation Engine)file. What to do to resolve this exception?
Open the call stack. That will help you locate the problem in your code. Then, you'll be able to put breakpoints a bit before the crash occurs in your code and check if everything looks as expected.
|
|
|
|
|
how to add a integer value in a listbox???
Raja
|
|
|
|
|
CString strTemp;
strTemp.Format("%d",iValue);
m_ListBox.AddString(strTemp);// Or m_ListBox.InsertString(-1,strTemp);
Regards,
Sandip.
|
|
|
|
|
is it possible to add strings horizontally???
for example,
event 2000 3000
name 4000 3000
Raja
|
|
|
|
|
See replies to your previous question here[^]
Regards,
Sandip.
|
|
|
|
|
I think its better you try to it then you can see its possible or no?
|
|
|
|
|
Adding can be added if you concatenate the strings for every line, but you are not going to be able to select the different "sub strings" only the whole line. If you want to make every "sub string" able to be selected, you should better use the CListCtrl in report mode
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
how to use clistctrl???what method should be used for adding strings horizontally??
Raja
|
|
|
|
|
Take a look into codeproject to have an idea about how it works is better than if I give you the solution.
Rows are ITEMS, columns are SUBITEMS.
You have to create the CListCtrl and determine how many columns are going to be there, for that... take a look into function SetExtendedStyle (...), struct LV_COLUMN, functions DeleteColumn (), InsertColumn ()...
then you have to insert the contents of each subitem (column) in one item (row), and when you have it, then add the row to the control, for that take a look into the struct LVITEM and function SetItem (), DeleteItem () or DeleteAllItems ().
Hope it helps
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
TCHAR tch[10];
_itot(33, tch, 10);
m_list.AddString(tch);
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
1.In my application, i have a window which shows the image of clock and as per the system timing the needle in the clock image is moving by using Lineto() function.
2.I used one dialog that by presssing button in that dialog im displaying system time for every second in List ctrl.
My problem is..When the button is pressed, the clock shows the correct needle position..But when Listctrl showing system timings reached 55 seconds, the needles in clock in the main window get distorted and drawing needle line somewhere else in the clock image.
Im using OnTimer() for clock class(View class) for displaying clock with needle and for Button(Dialog class) fro diplaying timins in listctrl.
I dont know why this get crashed.Its all seperate OnTImer function.
Anu
|
|
|
|
|
Did you try to debug?
Check the variables that you use to draw the hands of the clock.
It won't be OnTimer though that would be causing the crash. you could be using some uninitialized variable or accessing some array value that wouldn't be existing.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Please paste your code snippet
Regards,
Sandip.
|
|
|
|
|
DrawFatHand(register HDC hDC, INT pos, HPEN hPen, BOOL hHand)
{ register INT m;
INT n;
INT scale;
POINT tip;
POINT stip;
SetROP2(hDC, R2_COPYPEN);
SelectObject(hDC, hPen);
scale = hHand ? 7 : 5;
n = (pos+15)%60;
m = (INT)((((LONG)clockRadius*scale) / 200));
stip.y = (INT)((LONG)(CirTab[n].cos) * m / CLKSCALE);
stip.x = (INT)((LONG)(CirTab[n].sin) * m / CLKSCALE);
scale = hHand ? 65 : 80;
tip.y = (INT)((LONG)(CirTab[pos].cos) * (((LONG)clockRadius * scale) / 200) / CLKSCALE);
tip.x = (INT)((LONG)(CirTab[pos].sin) * (((LONG)clockRadius * scale) / 200) / CLKSCALE);
MoveToEx(hDC, clockCenter.x+stip.x, clockCenter.y+stip.y, NULL);
LineTo(hDC, clockCenter.x+tip.x, clockCenter.y+tip.y);
}
THis is code to draw hand of clcok.When debugging i found that clockCenter.x+tip.x and clockCenter.y+tip.y is getting varied to some other values after that 55 seconds in dialog.
But im confused why its drawing very well when im not invoked the button in dialog. When i invoked button, after 55th seconds the needle get distorted.Why its particulalry after 55seconds.
For the above function,i called it from OnTImer() as DrawFatHand(pDC, nMin, hpenForeground, MHAND);
Anu
|
|
|
|
|
Hi all,
Say I want to find the number of elements of an array. So I do this.
<br />
int numbers[3];<br />
int items = sizeof(numbers)/sizeof(int);<br />
What your comments on it.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Yes. It's the right way. but just to generalize:
int items = sizeof(numbers)/sizeof(numbers[0]);
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
That's cool, isn't it. No need to worry about that array type.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Yes this is correct but since this is possible only for fixed size arrays I will recommend this
const int ITEMS = 3;
int numbers[ITEMS];
-Saurabh
|
|
|
|