|
hi friend,
pls let me know your actual requirement.
|
|
|
|
|
Which IDE you are using?
In caseof VS2005, you need to dilog class from class view right click on its properties, and then add/edit required message/overidables.
|
|
|
|
|
Hello
GO to class wizard ->Object IDs as your dialog class ->"Add Function" for WM_CLOSE /WM_DESTROY And edit the code in ~dlg.cpp
redindian
|
|
|
|
|
In the properties window you can declare their on your program Is it your purpose?
|
|
|
|
|
I would like to know how to detect the socket was blocked?
Also how to detect the network is disabled?
Please help!
|
|
|
|
|
Connect... and see if it returns with an error or if the connect attempt times out.
|
|
|
|
|
hey guys,
I was wondering what the most efficient way of finding the number of occurences in a list is.
Say I have a list....
struct data{
int number;
int occurences;
};
data list[7];
list[0].number = 5;
list[1].number = 6;
list[2].number = 6;
list[3].number = 8;
list[4].number = 9;
list[5].number = 9;
list[6].number = 9;
how would i sort in such a way that I eliminate the numbers that occur more than once like this,
list[0].number = 5;
list[1].number = 6;
list[2].number = 8;
list[3].number = 9;
and saves the number of occurence for each number
list[0].occurences = 1;
list[1].occurences = 2;
list[2].occurences = 1;
list[3].occurences = 3;
I thought of every possible way,
I can do it for numbers that appear twice but three times, i duno how to deal with it.....
Someone please help me out
|
|
|
|
|
Why did you use the name 'list' for a variable which is an array ?
Could you post your current algorithm to correct it ?
|
|
|
|
|
Am i missing soemthing? Why not call an array a list, thats basically what it is.
|
|
|
|
|
The Undefeated wrote: Why not call an array a list, thats basically what it is.
I'd like to be shown where 'Array' publically derives from ("is-a") 'List'.
Also, in C++, 'Array' has the distinct connotation of 'contiguous memory'.
A 'List' has definitly not. If he would have called his std:vector 'Array'...
While on a very zoomed-out, global point of wiew you are right, for a beginner it is definitely better to separate the concepts of the two container types.
"We trained hard, but it seemed that every time we were beginning to form up into teams we would be reorganised. I was to learn later in life that we tend to meet any new situation by reorganising: and a wonderful method it can be for creating the illusion of progress, while producing confusion, inefficiency and demoralisation."
-- Caius Petronius, Roman Consul, 66 A.D.
|
|
|
|
|
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 />
|
|
|
|