|
Here are one my solution about it. If you wont to get lighter color put white color otherwise black.
white -> RGB(255, 255, 255) // full light
black -> RGB(0, 0, 0) // light off
1) Make function like this:
a) For increase intensity:
int FindMax(int a, int b, int c)
{
if((double)a > (a+b+c)/3) return a;
if((double)b > (a+b+c)/3) return b;
if((double)c > (a+b+c)/3) return c;
if((double)a == (a+b+c)/3) return a; // for same color
return 255;
}
b) For decrease intensity:
int FindMin(int a, int b, int c)
{
if((double)a < (a+b+c)/3) return a;
if((double)b < (a+b+c)/3) return b;
if((double)c < (a+b+c)/3) return c;
if((double)a == (a+b+c)/3) return a;
return 0;
}
2) Make some variable int intensity = 0; // plus or minus
3) In your function put this code:
int dif;
if(intensity < 0)
{
dif = FindMin(myRGB[j][i].R, myRGB[j][i].G, myRGB[j][i].B);
if(dif > -intensity)
dif = intensity;
else
dif = -dif;
}
else
{
dif = FindMax(myRGB[j][i].R, myRGB[j][i].G, myRGB[j][i].B);
dif -= 255;
if(dif > intensity)
dif = intensity;
}
SetPixel(dc, x+j, y+i, RGB(myRGB[j][i].R+dif, myRGB[j][i].G+dif, myRGB[j][i].B+dif));
|
|
|
|
|
Hi,All. How to get Windows system Service Pack information using VC++? Thanks!
|
|
|
|
|
GetVersionEx()
OSVERSIONINFO structure will contain member szCSDVersion that indicates the latest Service Pack installed on the system.
SimasT.
|
|
|
|
|
Hi,
I am having more than one Network adapter in my machine, thru MFC Program how could i select the best adapter (highest Bandwidth) to bind?
Thanks in Advance
Rams
|
|
|
|
|
Does GetBestInterface() help? If not, there are other IP Helper functions available that may.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I do some drawing on client area of main window, but some controls on main window covered the drawing. I have tried to use non-clipchildren style, but it doesn't work. Does anyone know how to solve the problem?
Thanks
|
|
|
|
|
I don't think this is possible in any dependable way. If you want parts of the controls transparent, you might want to investigate SetWindowRgn . Hiding the controls under some circumstances might perhaps be another alternative?
|
|
|
|
|
Hello
I write an application (MFC Dialog), when i call GetTitleBarInfo, the compiler alway error: undeclare identifier
i know this function declare in winuser.h, and i already check,
i use VC6++, SP5, instal Platform SDK
Any one can help me.
Thanks alot
|
|
|
|
|
|
#define WINVER 0x0500 (Before including any windows headers)
And i tried this in Win 2000.
|
|
|
|
|
Hi
Could someone tell me how I can accomplish string case conversion using STL string, something like MakeUpper() and MakeLower() in CString?
Thanks!
|
|
|
|
|
Use foreach with a funtion that calls toupper on each character in the string.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Christian almost had it, but at least under my version of VC (.NET 7.0) toupper isn't passed the parameter by reference so you need to use std::transform
std::string str = "hello world";
std::transform(str.begin(),str.end(),str.begin(),::toupper);
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Hello..
i've got a problem with threads and modeless dialogs.
With modal dialogs i had no problems. This is a mfc app(VC++6.0), in the main view, i created a button, and when i clicked on it i created a thread (which opened a dialog), then waited for the user to close the dialog, and delete the thread:
<br />
void CHilosView::OnButton1() <br />
{<br />
<br />
hilo = new CThread(); <br />
delete hilo;<br />
}
when i did the new CThread, it would create the dialog, when the user clicked on the cancel button of the dialog, the dialog would close, then it would get to the delete hilo line and it would be ok.
But now with modeless dialogs my function has become:
<br />
void CHilosView::OnButton1() <br />
{<br />
<br />
hilo = new CAccionarHilo();<br />
hilo->dlg->CThread(130); (dlg is a dialog, 130 it's id)<br />
hilo->dlg->ShowWindow(1);<br />
//delete hilo;<br />
}<br />
and i can't delete the thread there, because i would never be able to see the dialog!!.
So i'd love to be able to call the delete from the new dialog (that is created everytime i press button1 in the main window) 'cancel' button.
i can close the dialog, but i never get to delete the hilo (or thread (it's spanish))
I can't call the delete method as :'hilo' : undeclared identifier, and i can't include the hilosView header in the dialog class, because i include the Cthread file in the hilosView class, and it includes the dialog class.
hope you can help me!!
thanks!!
|
|
|
|
|
It's usually not a good idea to put a window/dialog in a secondary thread. You should post a user-defined message back to the main GUI thread to perform this service for you. If you really, really need to have GUI objects operating from a thread, you must not use a worker thread. You must use a user-interface thread, which has a message pump.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
Hi,
I am have a program that uses serial port to transfer data from one machine to another. My program is actually running fine except for the problem that I have an intermittent scrambling of data received from the serial port. The bytes are actually interchanged position. Does anyone of you who knows this kind of problem ? Here is the sample data transmitted from the other machine. "test message" the data received by my program is like this "tets messgae"
then if I repeat it, sometimes the data is correct.
Any help is highly appreciated.!
Thanks,
Mar
Mar Solero Jr.
|
|
|
|
|
Thats impossible!
I think its a little bug in your code not a bug in serial comm.
Kamyar Souri
Booria CAD/CAM Systems
www.booria.com
|
|
|
|
|
i was just wondering how everyone gets there demo's and project's so small i just compiled a very small dialog it has 3 buttons 2 edits 1 combobox and 2 static text and its 2 mb i wanna know how to get it smaller
|
|
|
|
|
perhaps (in vb6.0)
project -> setting -> use MFC in a shared dll?
|
|
|
|
|
Did you compile it in debug mode?
|
|
|
|
|
1) VC++: Release < Debug build.
2) VC++: MFC: Shared Link < Static Link.
3) VC++: Win32 SDK < MFC.
4) Platform SDK Cmd-Prompt Build < VC++.
5) VC++ 7.x < VC++ 6.
Maxwell Chen
|
|
|
|
|
|
|
thanks mike that works wonders went from 2 mb to 236 kb
|
|
|
|
|
Whether the dialog has 3 controls on it, or 23, the net result will be almost the same. Debug compilation aside, there are a lot of factors that go into why a file is a certain size, and why the size is misleading most of the time. Read this article to get a better understanding.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|