|
You will have to enumerate all devices here is a link for some sample code hope that helps
Click ME[^]
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
How I can put my icon on Pushbuttons.
|
|
|
|
|
Here is a link to an article on codeproject might come in handy
Click ME[^]
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
Here's another article:
http://www.flounder.com/bitmapbutton.htm
A rich person is not the one who has the most, but the one that needs the least.
|
|
|
|
|
Does anyone know of an algorithm to calculate a complementary text color given a background color? By this I mean a text color so that the text can easily be read. I've scoured the Web but have not come up with anything useful.
I have low vision, and have difficulty reading the text on some of the controls being developed in my company where the text and background color don't contrast enough. If colors are hard-coded, there will always be some color scheme for which this will not work.
Any suggestions will be much appreciated.
Mihaly Zsadanyi
|
|
|
|
|
IMO all controls should use the system colours for their backgounds and text, that way the user can choose whatever colour they are most comfortable with. Use COLOR_WINDOW or COLOR_3DFACE for backgrounds, and COLOR_WINDOWTEXT or COLOR_BTNTEXT for foregrounds. Any other combinations may look cool, but are disrepectful of the end user.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
I'm using Visual C++ to program an application that reading from a .txt file at some time interval, let's say 10 seconds.How can i do this? Please help me. Thank you.
|
|
|
|
|
You have to Set a timer via . SetTimer function
then in the Timeout Handler Read the txt file (use CFile )
if you have a Dialog based Application
then in OnInitDialog
SetTimer(1,10000,NULL);
add handler for WM_TIMER event (via Class Wizard)
..... OnTimer(UINT nIDEvent)
{
}
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
Hi,
I need to use USB to interface between a hardware and PC. What command/tool should I use? Any sample code?
|
|
|
|
|
I don't realy know USB,but I think the hardware should provide that tool or the driver lib.
Thanks
Benben
|
|
|
|
|
Hi,
What is the difference between using CClientDC to draw graph and using CDC?
|
|
|
|
|
basicly nothing. The only difference is that CClientDC calls GetDC() on the supplied window in it's constructor, and calls ReleaseDC() in it's destructor. It just saves you some typing and debugging time.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
I had create a SDI with database. How do I maximize the dialog permanently?
I drawed some pictures on the dialog. When I maximize the dialog, there's a assertion error. What should I do?
|
|
|
|
|
|
hi,
I want to convert the string '\device\harddiskvolume1\windows\..' to the path 'c:\windows\..'
I get that string from the registry. I can replace the string
'\device\harddiskvolume1' to c:
'\device\harddiskvolume2' to d:
etc.
But I doubt there is a much better way using some API.
Can anyone please help ?
regards
hari
Hari Krishnan
|
|
|
|
|
How can i get the path of my dll on disk from within that dll?? Like.. a program loads my dll as a plugin but the dll itself doesnt care where it is. Is there a way to get the path to the dll from within the dll code?
Thanks
Kuniva
--------------------------------------------
|
|
|
|
|
Kuniva wrote:
but the dll itself doesnt care where it is
I wouldnt say that was 'accurate' .. there's a set path windows uses to locate dll's .. from memory, its (very roughly), assuming NT for the moment
1) The directory the calling exe was loaded from
2) C:\winnt
3) C:\winnt\system32
4) The Contents of the PATH Environment variable
so the dll has to be 'somewhere useful' .... so you could use the file find functions ... checking that the above list was accurate, of course ...
As far as I recall, the info isnt stored 'within' a dll... The only other way may be to enumerate processes and maybe the process stack shows where it was loaded from - www.sysinternals.com has some tools that may demonstrate this .. but thats way complex !!!
Most 'plugin' factories to use a better word should have a configurable parameter that says, 'my plugins are in here' and not assume they are anywhere, imho ..
hth
|
|
|
|
|
A guess:
Try GetModuleFileName() passing in the instance handle of the dll. The handle is the first parameter passed into your DllMain() function, or it can be retrieved using the AfxGetInstanceHandle() function if you are using MFC and your dll was linked with the USRDLL version of MFC.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
Hello,
I have the following simple code and I cant understand the results I am seeing
Note. This is a big hack in an old peice of code. It would not be like this if I had my way
void SomeFn(void)
{
//these are not hard coded they come from another API in string form
CString result = CalcMargin("0.7033", "0.7000");
}
CString CalcMargin(LPCTSTR exeRate, LPCTSTR rate)
{
double dExeRate, dRate, dMargin;
dExeRate = atof(exeRate);
dRate = atof(rate);
dMargin = dExeRate - dRate;
result.Format("%f", dMargin);
return result;
}
The returned value is "0.003300" and I wondered why i see the trailing zeros. It turnes out that the result of the subtraction is 0.0033000000000001
Can anyone tell me why?
Thanks
|
|
|
|
|
Try this
result.Format("%5.4lf", dMargin);
where 5 is the minimum width and 4 is the precision.
the lf is for double values.
|
|
|
|
|
Rounding error.
Floating-point numbers cannot be stored as the exact equivalent of their decimal representation, unless they all happen to be powers of two (2, 4, .125, etc.). So you should never check for strict equality when dealing with float /double values.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0! | RightClick-Encrypt
"Linux is good. It can do no wrong. It is open source so must be right. It has penguins. I want to eat your brain."
-- Paul Watson, Linux Zombie
|
|
|
|
|
Thanks but im not sure I understand completely. Would you expect "true" or "false" from the following code? It prints true when i run it.
double d1 = 5; //not a power of 2
double d2 = 2;
if( (d2 * 5.0 / 2.0) == d1)
printf("true");
else
printf("false");
|
|
|
|
|
You are using whole numbers. Try with fractions
double d1 = 1;
double d2 = 3;
double d3 = d1 / d2;
if (d3 == 0.333)
printf ("true");
else
printf ("false); No matter what number you use, you will never get true.
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
|
Hi there,
I'm relatively new to the C++ language. Recently I started with a database application in Visual C++6.
Here is my question:
After loading a couple of (lest's say four) Edit boxes from an MS Access database through the MFC ODBC, I would like to calculate the value of some of the boxes and have the sum in a fifth Edit box.
The database consist of both integer and floating numbers.
I use the GetFieldValue to copy database values into a variable using the CString class.
How do I get the variables recognized as numbers?
This is easy to do in VB6 but how is it done in Visual C++6. There must be a way!
I would really appreciate all the help I can get.
Thanks in advance
Lars
|
|
|
|