|
If you can use an STL container, do so and then you can use the sort and unique methods.
|
|
|
|
|
Make a new array for the initial list of numbers then
use a for loop to start adding the numbers to the array, use an embedded for loop to check whether the number has already been added.
for(int i=0; l <7; i++) {<br />
<br />
list[i].number = 0;<br />
list[i].occurences = 0;<br />
<br />
}<br />
int ListIndex = 0;<br />
<br />
for(i=0; i <7; i++) {<br />
<br />
int index = i;<br />
bool IsRepeat = false;<br />
<br />
for(int j=0; j <7; j++) {<br />
<br />
if(array[index] == list[j].number) {<br />
<br />
IsRepeat = true;<br />
list[j].occurences++;<br />
}<br />
}<br />
<br />
if(!IsRepeat) {<br />
<br />
list[ListIndex].number = array[i];<br />
list[ListIndex].occurences = 1;<br />
ListIndex++;<br />
}<br />
}
I just stuck that togeather now, if it don't work, then don't complain about it
-- modified at 6:27 Friday 10th November, 2006
The code does work, im so happy
|
|
|
|
|
thanks, thats great
i got a bit confused when I first saw your code, but.......
it works!!!
THANKS !!!!!!!
|
|
|
|
|
Just so long as you make sure you understand it, all will be good
|
|
|
|
|
hi,
i want to know how to load a bitmap on to a dialog without loss of color?
thanks
|
|
|
|
|
Why are you losing color ? What are you doing ? How do you load it ?
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
it doesn't get imported saying it contains more than 256 colors. and when i try to copy paste, and use the bitmap id its working fine. but when pasting it on the dialog using picture control, there is color loss. is there a way to load it dynamically. please give me the code for it.
thanks
|
|
|
|
|
Preeti Mishra wrote: it doesn't get imported saying it contains more than 256 colors.
Look at the messagebox carefully it says its imported *correctly* the ide just cannot display it in design mode.
Import a bitmap ignore the msgbox add a picture control on the dialog goto properties and specify the bitmap id.
Used on me in a bar: Have you considered suing your brains for non-support?
|
|
|
|
|
thanks... it worked.
now tell me how to handle a progress bar?
|
|
|
|
|
Preeti Mishra wrote: now tell me how to handle a progress bar?
Man that was quick...
Attach a CProgressCtrl Variable with the progress control through classwizard then
m_ProgressCtrl.SetRange32(0,100);
m_ProgressCtrl.SetStep(1);
....
m_ProgressCtrl.StepIt();
thats all there is to it i think
Then it comes to be that the soothing light at the end of your tunnel
Is just a freight train coming your way
|
|
|
|
|
thanks a lot... i got it!
|
|
|
|
|
hi,
i have put buttons on the dialog box and given them keyboard functionality. i'm unable to do it for the right and left arrow keys. can you help me out!
thanks
|
|
|
|
|
You can use of LoadImage or CImage class
|
|
|
|
|
i am new to mfc. please tell me the code to load the image dynamically
thanks
|
|
|
|
|
<br />
HBITMAP hBit;<br />
hBit=(HBITMAP)LoadImage(NULL,Str,IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE|LR_CREATEDIBSECTION|LR_LOADFROMFILE);<br />
/***************************************************/
<br />
#include AtlImage.h<br />
CImage m_Image;<br />
m_Image.Load(yourfile);
....<br />
void CAnswerView::OnPaint()<br />
{<br />
CPaintDC dc(this);
Image.BitBlt(dc.m_hDC,0,0,640,480,0,0,SRCCOPY);<br />
}<br />
|
|
|
|
|
Hi all,
i have attached service to my VC++ debugger, but i'am not able to debug it,break point is showing with Question mark, can any one help me regarding this
mpk1979
|
|
|
|
|
I am not fully sure but i have done once like this moons ago
Go to Project settings ->Debug tabe -> Give the destination (where the service exe is really deployed )path of service exe .
Same to do with Link tab . Rebuild the project .
if the path of service exe is different from /debug , then copy .pdb file to the destination folder alongside the service exe . Now I hope debugging works
redindian
|
|
|
|
|
try http://support.microsoft.com/?scid=kb%3Ben-us%3B824344&x=11&y=22
|
|
|
|
|
Hi
i got an urgent requirement, i have to hook a tool bar to a messenger.
could any one help me in this regard.
i have to develop it in VC++, ATL. So plz give me some idea or any links, that will help me in this regard.
Any help will be greatly appreciated.
Thanks in Advance .
Gopinath MV
|
|
|
|
|
Hi
i got an urgent requirement, i have to hook a tool bar to a messenger.
could any one help me in this regard.
i have to develop it in VC++, ATL. So plz give me some idea or any links, that will help me in this regard.
Any help will be greatly appreciated.
Thanks in Advance .
Gopinath MV
|
|
|
|
|
gloriousgopi wrote: i got an urgent requirement, i have to hook a tool bar to a messenger.
could any one help me in this regard.
Well what do you mean by "hook a toolbar" what do you want them to be able to do?
|
|
|
|
|
Thanks for you interest in this matter.
Actually i have to include a tool bar to an existing messenger for eg MSN Messenger. then how can i do that. i know how to develop a tool bar in VC++.
But how can i include it to that messanger (No source code). which is already existing and running.
Gopinath MV
|
|
|
|
|
Ok you want to attach a toolbar to an existing window... this can be done but it will be a very messy code... it don't know if MSN Messenger exposes any functionality to attach a toolbar you have to check that out, if it doesn't then
Create a HOOK DLL to inject into the MSN messenger then when the DLL initializes create a Toolbar window with the parent window being the MSN window.
The original point and click interface was a Smith & Wesson.
|
|
|
|
|
hi friend,
i think your requirement is to add a menu in a remote application. Kind of code injection mechanism. you can achieve this in a simple way.
1. get handle for target window (use find window, with class name and title or you can any other method)
2. once you have a valid handle you can get the main menu handle of target window.
3.with a valid menu handle you can attach a new menu , submenu any where in the current menu.
Hope you can try this, I am not mentioning the API’s .
Thanks
|
|
|
|
|
Thanks for u r suggestion. i will try in that way.
Gopinath MV
|
|
|
|