|
Hi I want to use th eslider control to increment/decrement a variable between a lo and hi value. The thing is I have no idea on how to dp it . I'd like some step by step help on how to use the slider control. I'm using VC6 Not .NET
|
|
|
|
|
Put a slider control on the dialog template. Use ClassWizard to create a member control variable. In the dialog's OnInitDialog() method, set the slider control's range with SetRange() . You can extract the slider value from the control by calling the GetPos() member method.
MSDN has several example projects that use a slider control: CMNCTRL1, CMNCTRL2, CTRLTEST, and FIRE.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Hi,
Is there a more efficient way of converting an integer value into a char array representation. Hence, the char array would be set to size four because there are 4 bytes in an integer.
|
|
|
|
|
|
No, more like binary rep only in char. I'm sending a stream of bytes.
|
|
|
|
|
Alternatively (to Ian's suggestion) if you mean to treat an
integer as a four byte character array you can do so by casting:
int i = getValue();
char* p = reinterpret_cast<char*>(i);
However, that is a pretty scary thing to do, since obviously the
string will not be guaranteed to be null terminated (unless
i&0xFF is 0 on a big endian machine, or i&0xFF000000 is zero
on a little endian machine, and also assuming that sizeof(int) == 4)
Not recommended. Perhaps you could tell us what you are actually
trying to do.
|
|
|
|
|
I'm trying to convert an integer value into an array of bytes. Char array is used cause it's exactly one byte. I have library func which sends bytes over a stream if given a pointer to char array head.
|
|
|
|
|
There are couple of issues you should be concerned with here.
First of all, you need to send the integer in a representation
that all readers will accept. As you probably know, different
processor achitectures represent integers in different ways,
consequently, most likely the best representation would be a
simple ASCII stringL
void convertMe(int i)
{
char s[MAX_CHAR];
itoa(i, s, 10);
sendBytes(s);
}
where sendBytes is your sending function. If you don't care about
endian-ness, you could also send the bytes directly like this:
sendBytes(reinterpret_cast<char*>(&i), sizeof(i));
However this assumes that sendBytes is not designed to send a string,
but a block of memory (hence the second parameter which is the length
of the block to send.) If it is designed to send strings it will
fail quite often since any zero byte within the integer will terminiate
the string.
|
|
|
|
|
Something like this comes to mind:
int nNum;
char cBytes[4];
cBytes[0] = (nNum >> 24) & 0xff;
cBytes[1] = (nNum >> 16) & 0xff;
cBytes[2] = (nNum >> 8) & 0xff;
cBytes[3] = nNum & 0xff;
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
Does anyone know any good FREE Chart Component is can use on ASP
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
What function can I call to display the coordinates of the point?
|
|
|
|
|
what point ? the mouse position ?
have a look at GetCursorPos
Maximilien Lincourt
"Never underestimate the bandwidth of a station wagon filled with backup tapes." ("Computer Networks" by Andrew S Tannenbaum )
|
|
|
|
|
hi,,,,,,
Is there any tool available which will read the .h file and give me the class
information such as a listing of all the member functions, etc ?
Any help is appreciated.
Thanks in advance.
saleem
|
|
|
|
|
|
Hello, how do I access the element which resides in a vector of set. The codes are show below.
vector< set<int> > objSetVt;
set<int> objSet1;
objSet1.insert(2);
objSet1.insert(4);
objSet1.insert(2);
objSet1.insert(7);
set<int> objSet2(objSet1);
set<int> objSet3(objSet1);
objSetVt.push_back(objSet1);
objSetVt.push_back(objSet2);
objSetVt.push_back(objSet3);
vector< set<int> >::iterator objVtItr;
for(objVtItr = objSetVt.begin(); objVtItr < objSetVt.end(); objVtItr++)
{
//??? How to access the element now
//objVtItr[0][0] <-- this give compile error
}
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
In the example, objVtItr is an iterator, but inside the loop you are access the actual containers via [] operator.
One solution is to access the container directly.
std::set<<...>>::const_iterator iData = objSetVt[x].begin();
Kuphryn
|
|
|
|
|
Hai,
I think the problem is simple. That for a vector class, "[]" operator is overloaded. But for set the "[]" operator is not overloaded.
So access the member of vector by using [] operator and then use iterators to traverse throught the set.
|
|
|
|
|
guys..
As i wrote earlier..my control doesnot show up when i host the control in the test container...now this is only happening in the UIDeactivated mode..
how can i set my control to draw itself and show in the UIDeactivated mode inside the test container..?
thanks again
|
|
|
|
|
hi there..
guys i wanted to know if u have a control and u place it in a container, but the control doesnt show rather just a boundary rectangle is visible..but when i execute the container with the control..the container is visible..
is it something to do with designmode or something or something else??
thanks
|
|
|
|
|
In the OnPaint of ur ActiveX Control you have to draw seperatly for Design mode as well
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
class c{
public:
a();
b();
};
main()
{
class c *pc = 0;
pc->a() //works
}
class c{
int i;
public:
c(0):i=0;
a();
b();
};
main()
{
class c *pc = 0;
pc->a(); //doesn't work fires exception
}
why?
|
|
|
|
|
Because you are invoking a function (a() ) on a pointer that was specifically made invalid (set to 0 ).
Who is 'General Failure'? And why is he reading my harddisk?!?
|
|
|
|
|
What's the definition of function a()?
Contrary to popular belief, while you can call a member function through a null pointer, it only works if you don't need to access any member variables or virtual functions (essentially, you don't need to dereference this ).
If a() uses the i integer in the second example, then you are trying to access a variable through a dereferenced null pointer, which obviously will fall over.
--
Ian Darling
"The moral of the story is that with a contrived example, you can prove anything." - Joel Spolsky
|
|
|
|
|
Bravo
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
Can U clarify on the matter of this. Please, I know what U told is correct but not able to understand 'you don't need to dereference this'.
|
|
|
|