|
Gofur Halmurat wrote: ...but i need enabled Cedit control...
You need it enabled but read-only, is that right?
Gofur Halmurat wrote: what happens if i change z-order?
Nothing, when there is only one control.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
So what is the purpose of this read-only control?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
The purpose is to show some text on it, that is all
|
|
|
|
|
Then why not just use a static control, or a disabled edit control?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Because the Cedit control supports a link, or colored text, that is why i am using it, or what else would u recomment?
|
|
|
|
|
Gofur Halmurat wrote: Because the Cedit control supports a link, or colored text, that is why i am using it, or what else would u recomment?
You can have colored text just as easily with a standard static control.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yeah, i just found an article about it, here is the link
I am gonna use CStatic instead of CEdit, but i am still wondering, why can not we hide caret?.....
anyway the topic is open to discuss!!!
Thanks David.
|
|
|
|
|
Hey all,
What is the easiest way to convert a char[] to an int[]so that the elements of the int array are the combination of 4 char elements?
Here is an example of what I mean;
if
<code>
char tempChar[8] = {0};
int tempInt[2] = {0};
tempChar[0] = 0x00;
tempChar[1] = 0x11;
tempChar[2] = 0x22;
tempChar[3] = 0x33;
tempChar[4] = 0x44;
tempChar[5] = 0x55;
tempChar[6] = 0x66;
tempChar[7] = 0x77;</code>
how do I get
<code>
tempInt[0] = 0x00112233;
tempInt[1] = 0x44556677;</code>
Thanks!
|
|
|
|
|
One possible way is to add the most significant char to the int and move the bits to the left with <<, then the next one and so on.
Greetings.
--------
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
|
|
|
|
|
thank you for the reply...
I was trying to see which is the fastest way to do this if I say have 100 elements in the int[]?
|
|
|
|
|
You can also use an union:
#include <iostream>
using namespace std;
union Char2int
{
unsigned char tempChar[8];
unsigned int tempInt[2];
};
int _tmain(int argc, _TCHAR* argv[])
{
Char2int c2i;
c2i.tempChar[0] = 0x33;
c2i.tempChar[1] = 0x22;
c2i.tempChar[2] = 0x11;
c2i.tempChar[3] = 0x00;
c2i.tempChar[4] = 0x77;
c2i.tempChar[5] = 0x66;
c2i.tempChar[6] = 0x55;
c2i.tempChar[7] = 0x44;
for (int i = 0; i < 2; ++i)
wcout << std::hex << c2i.tempInt[i] << endl;
return 0;
}
"We make a living by what we get, we make a life by what we give." --Winston Churchill
-- modified at 11:45 Wednesday 31st October, 2007
|
|
|
|
|
Thanks George and everyone else for their help....this is exactly what I was looking for in order to save processing time.
|
|
|
|
|
As I interpret your initial post, you may not get what you want with the proposed union solution.
NYTSX wrote:
tempChar[0] = 0x00;
tempChar[1] = 0x11;
tempChar[2] = 0x22;
tempChar[3] = 0x33;
tempChar[4] = 0x44;
tempChar[5] = 0x55;
tempChar[6] = 0x66;
tempChar[7] = 0x77;
This would in all systems, regardless of byte ordering, generate the following memory contents:
00 11 22 33 44 55 66 77
If you convert the memory contents above to two adjacent 32-bit integers you will, on a little-endian system like most systems running windows, get 0x33221100 and 0x77665544.
NYTSX wrote: how do I get
tempInt[0] = 0x00112233;
tempInt[1] = 0x44556677;
My point is that the union solution will work on a big-endian system, but not on a little-endian system in terms of how I interpret your question.
To make a portable solution you would have to walk through the char array, one element at a time, and shift the integer value like Nelek suggested.
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Remember that the code above is not portable, and you should comment your code that it is so!
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
George L. Jackson wrote: Remember that the code above is not portable...
But since this forum is for VC++ code, and nothing was even remotely mentioned about portability, does it matter?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Your right. The poster is happy. I am happy he is happy. So, don't worry. Be happy!
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
A simple casting should do the trick:
int* tempInt = (int*)tempChar;
But be carefull with byte ordering ! As the bytes are stored in an inverted way in memory. It means that if you have those bytes in memory:
0x00 0x00 0x00 0x01
And you interprete those bytes as an integer (like you will do with the cast), the resulting integer value won't be one (but 0x01000000).
|
|
|
|
|
Cedric Moonen wrote: As the bytes are stored in an inverted way in memory
partially right. all depends of the system.
but one should always care about bytes order anyway
|
|
|
|
|
union is the best, because you can save some processin time the shift operator would consume...
|
|
|
|
|
int *tip;
tip = (int *) tempChar;
|
|
|
|
|
I a CDialog based application which has approx 30 CBitmapButtons and 30 CStatic text boxes. I'm receiving data at about 20hz which is causing the screen to flicker badly when these are getting repopulated. I've looked at the usual ways of stopping/reducing the flicker (overloading OnEraseBkgnd, using InvalidateRect ( rect, FALSE ), Invalidate (FALSE), etc...) with no luck. Does anyone have any ideas how I can overcome this? One idea I've had is buffering the entire dialog before painting it, however I can only find examples on how to do this with bitmap controls rather than an entire dialog with controls.
TIA,
Andy
|
|
|
|
|
I would look into updating the controls without redrawing the entire dialog
(especially its background) every time data is updated.
Also limiting the update region(s) to just areas that change helps alot.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Hi Thanks for your reply. I've delved further into this now and have found that the flickering is due (or at least appears to be due) to the fact that I have controls on top of each other, an example is that I will have a Group Box with a CEdit control inside of it, when they are seperate they don't flicker when combined they do. I'm using the Group box to provide a border effect to the CEdit control as none of the built in border styles are suitable, so if I can get an identicle border in another way then my problem may be sorted! Do you have any ideas on how to do this?
cheers,
Andy
|
|
|
|
|
well sort of the answer, further to my above post, I've got rid of the group boxes and changed the style of the CEdit controls to have the Border, Modal Frame and Static Edge set to TRUE. Although this border is thicker than I wanted it is better to look at than a flickering screen!
Any suggestions on how to make this border thinner would be great
Andy,
|
|
|
|