|
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
|
|
|
|
|
Ya, quite similar way I following normally.
Why I ask that question is, I like to pass less number of arguments to methods. Say just I can pass the array and if I want I can find number of elements on it. I think you cleared what I say.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Thats is possible but it is more error prone because the function cannot know if array was fixed size or dynamically allocated. So if someones passes a dynamically allocated array then size array using this method will always be 1. So you have to be very careful that about calling such function.
-Saurabh
|
|
|
|
|
I'm confused. At the time of passing the array, array size(number of elements) are fixed. I'm not going to use like in a looping function to pass. In such a case as you said I'm in a big trouble.
Whats your comments.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Okay I might be wrong but I think when you said you don't want to pass size of array as an argument, this is what you want to do.
void foo(int* array)
{
int x = sizeof(array)/sizeof(array[0]);
//
// Process array here.
//
}
So I was wrong in other post and the problem is that x will always be 1.
-Saurabh
|
|
|
|
|
If you created the array yourself, you now its size. So I don't really understand the point. Could explain why you want to calculate the size instead of just using the same number you put in your array (if you defined it as a constant for example) ?
On a side note, you might want to look at existing container classes like std::list or std::vector.
|
|
|
|
|
Just fine, as you said I feel that vectors are specially useful than arrays. I just try to find it.
Came to my mind this is, in Java(I've much familiar than C++) using a single line I can get this.
I appreciate your help all the time...
CodingLover
|
|
|
|
|
Recent Platform SDKs have a _countof macro that you can use instead of defining your own.
|
|
|
|
|
Hi all.
Need some help. I'm not long in MFC.
How to get size of dialog in template?
I'm deriving from CFormView and I need to know what is the size of dialog in template.
I can do this before or after window creation, but I don't know how in both times.
Thanks
|
|
|
|
|
progDes wrote: I need to know what is the size of dialog in template.
You can use CDialogTemplate member functions GetSizeInDialogUnits and GetSizeInPixels .
Here is a note from MS on this class' parent file (afxpriv.h)...
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
|
Hi all,
i m working on VC++ 2005, MFC-SDI type application. I m using .chm file as a help file.
when i click on Menu of application then help file is opened.
In help file 3 more category present like Contents,Index,Search,Favorite and more.
I want all these categories are shown in Menu bar and when i click on puricular menu item then help file should be opened according it.
For example: When i click on Contents menu item then help file should be opened on content tab of help file, same for other.
Please tell me how can i do this.
I m waiting for ur valuable suggestions.
Thanks 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
|
|
|
|
|
I've been working on MPI system where the compiler does not support vasprintf. Is there anyway i can get around this problem? Is there anyway that I can replace vasprintf with vsprintf or sprintf? Thanks
|
|
|
|
|
hi, i want to access all the notification items in the notification area(system tray)... i was searching in msdn and i couldn't find any...
what is the interface or functions to access the notification area... it is to see all the running programs there... and to hide some icons if needed... i am using win32 api's... and not mfc... .
|
|
|
|
|
Jach Mullan wrote: i want to access all the notification items in the notification area(system tray)... i was searching in msdn and i couldn't find any...
what is the interface or functions to access the notification area... it is to see all the running programs there... and to hide some icons if needed... i am using win32 api's... and not mfc... .
An article by Nishant on this topic -> http://www.codeproject.com/KB/applications/ShellTrayInfo.aspx[^]
Nibu thomas
Microsoft MVP for VC++
Code must be written to be read, not by the compiler, but by another human being.
Programming Blog: http://nibuthomas.wordpress.com
|
|
|
|
|
in winxp, the directory name length limit is 244
in win98, the directory name length limit is 250
why isn't 255? why file name length limit is 255?
in FAT32 file system, FAT directory structure's DIR_Name cannot use 0x22, 0x2a, 0x2b,0x2c,0x2e,0x2f,0x3a,0x3b,0x3c,0x3d,0x3e,0x3f,0x5b,0x5c,0x5d,0x7c,
FAT Long directory Entries 's LDIR_Ord cannot use also???
How many long file name or long directory name can use FAT Long directory Entries structureS?
sorry my bad english.
Thanks.
|
|
|
|