|
Thanks! I'll try this too.
|
|
|
|
|
How do you set the text color for a static label?
Why doesn't the following work?
CDC* dcMyLabel = GetDlgItem(IDC_MYLABEL)->GetDC();<br />
dcMyLabel->SetTextColor(RGB(255,0,0));
|
|
|
|
|
Have you looked into the WM_CTLCOLORSTATIC message?
"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
|
|
|
|
|
Is there some config option some place that I need to check?
I have OnCtlColor, but no OnCtlColorStatic.
|
|
|
|
|
littleGreenDude wrote: I have OnCtlColor...
In that method, check the second parameter (it's a CWnd* ) against the static control you are interested in. If they match, set the text color (using the DC's SetTextColor() method) and return a handle to the brush.
"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
|
|
|
|
|
Do you happen to have, or could you point me to a code sample of this?
|
|
|
|
|
See here and here for starters.
"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
|
|
|
|
|
I want to read a .txt file by my program, how can i do this? I have columns in my notepad file for e.g.
CUST. NO. X Y
0 71 69
1 53 57
3 69 12
4 58 12
5 63 45
6 25 109
7 100 81
8 .. ..
9 .. ..
10 .. ..
11
these are the 3 columns i have i.e. CUST. NO., X, and Y in my notepad file and i want my program to read it. The Cust No might go to thousands, means i dunno how much will it be. Also tell me what should i use to store these values or colums? simple arrays or linked lists or anything else?
Kindly help me in this regard by helping me in source code, ill be very thankful to u. Take care.
nOmI
|
|
|
|
|
nomi khan wrote: Kindly help me in this regard by helping me in source code,
What source code? What have you tried so far (that doesn't work)?
"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
|
|
|
|
|
Open the file as a std::ifstream .
When the ifstream is good, you can use getline to read the file line by line, and normal std::string function to parse each line.
Evilgrin
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
You can use of CFile class.
|
|
|
|
|
you can use CStdiofile for reading line by line. and can read the column values by space separator( as u shown here )
Define ur columns in a structure and use CArray for storing these values.
Ajay
|
|
|
|
|
aks. wrote: Define ur columns in a structure and use CArray for storing these values
tThe solution is fine. but i have little doubt over usage of CArray. i like stl class much then MFC colection class. cince data coming is in form of string. we could use more specialized container i.e. CStringArray!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You
|
|
|
|
|
u want to use stl? then u can use list
if u want to use CStringArray , then u have to store whole strings on a line to the array as one entry. on getting the values from CStringArray , u have to parse it for getting each vales of the column.
Ajay
|
|
|
|
|
Hi - I'm lost in an IO Network stream error -
because of something wrong in the socket -
and I can't figure out how to get the
WSA socket error associated with the IO error.
Is the error in the socket structure or
is there a function that will help me ????
Please help,,,,,,,,
|
|
|
|
|
Something like WSAGetLastError()
|
|
|
|
|
yes, I need something like that -
but - not running on server -
don't have all the right libs & dll's,
and header files - so - I was thinking
that there could be a function, perhaps
in the socket that would get that last
error ????????????????????
or somewhere ??????????
or should I just try & get ahold of
all the DLL, LIBs, & h files /?????/
|
|
|
|
|
There's no functions "in the socket".
What DO you have to work with? How are you debugging
without DLL, Libs, and h files?
You think an error is occurring on the server and you're debugging
from a client?
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Mark Salsbery wrote:
You need more than one of these, Mark, as I've no clue what he wants either.
"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
|
|
|
|
|
I didn't want to waste them....it's looking like I may need a lot of
them elsewhere
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have no experience with your situation or I have no idea what you are saying.
|
|
|
|
|
Hi people,
I’m having a problem while updating a CFormView. I switch a variable m_nStatus and depending on its value I do some things. My problems are in these lines:
case 4:
if (m_bWriteMode && !m_bReadMode)
m_cbTransfer.ShowWindow (TRUE);
else if (!m_bWriteMode && m_bReadMode)
m_cbRead.ShowWindow (TRUE);
break;
I know the problem is there, because if I comment them, all works ok.
What happens is that, when I have my application running on the top, works fine. If I switch to another program (i.e. back to VC++ to debug something) and come back, or using a timer all ok until the first WM_TIMER…
Then the FormView gets crazy and starts to update itself continuously, so quick, that the labels don’t appear. It stays so… till I move the window or something like that.
I guess that the ShowWindow () to make the buttons in/visibles is sending an internal UpdateWindow () or something like that. And it comes into a loop: show button, updatewindow, show button, updatewindow…
Is there any way to avoid this f… continous window update? I know I can make both buttons visible and play with the enable/disable, but I would like to do it as I have (without the problem of course).
Thanks
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
|
|
|
|
|
Why are you showing/hiding controls in the view's OnDraw() method? Why not do that wherever m_bWriteMode or m_bReadMode changes?
"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 process is the same for both modes. I have to ensure 3 points before making a connection (status 3 = connection allowed), do the connection (status 4) and then, depending on what the user wants to do (write / read) allow only one of them.
My boss wanted to have it like that because of "pretty appearance".
So he said to do it with changing button depending on job-mode and suggested me to do that.
I have thought 2 alternative possibilities. Just 2 buttons and enable/disable them as with the others (it gives no problems) or one button changing caption depending on write/read and with the functionality inside separated in two ifs. I will most probably use the second one (1 button with two captions / functions) to follow the "desires" of my boss.
But I asked it because of the flickering. I know that it is due to ShowWindow, but I don't know why. I guess an internal invalidate/updatewindow to make the control visible or not, am I right?
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
|
|
|
|
|
Nelek wrote: My boss wanted...
So why is he not doing the coding? His solution is obviously not going to work, so you are going to have to go against the grain and code it up correctly. When shown the final result, he'll hopefully forget about initially leading you astray.
"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
|
|
|
|