|
Hi,
I have created MSI package using VS 2005, but whenever i install the msi package it is asking for me where to install, but i want it to ask only at the first installation, if am installing second time it should not ask me, it should go to default folder which i have selected previously
Manjunath S
GESL
Bangalore
|
|
|
|
|
Hi,
I need to change the color of the CStatic text. How can i do that ?
Thanks
Bye
|
|
|
|
|
sakthimuthu wrote: I need to change the color of the CStatic text. How can i do that ?
See here[^].
|
|
|
|
|
Use OnCltColor .
HBRUSH CMylg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor)
{
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);
if (pWnd->GetDlgCtrlID() == IDC_STATIC)
{
pDC->SetTextColor(RGB(255, 34, 0));
pDC->SetBkMode(TRANSPARENT);
}
return hbr;
}
|
|
|
|
|
if i do so, I am getting error like,
"m_brush Undecalred Identifier"
How do i resolve this ?
Thanks
|
|
|
|
|
sakthimuthu wrote: "m_brush Undecalred Identifier"
You just delete that line.
That brush variable stands for backfground color for text, if you want different.
|
|
|
|
|
Where is m_brush on your code?
|
|
|
|
|
It was there, considered as member variable of dialog class. Refer MSDN example of OnCtlColor .
|
|
|
|
|
hi,
I have added this "OnCtrlColor" on my code. But, When i do debugging it the program control does not come to this "OnCtrlColor" fn.
Why ?
Can you help me ? Kindly
bye
|
|
|
|
|
Did you insert WM_CTLCOLOR of peroperty window to your project or insert OnCtrlColor to your code
|
|
|
|
|
Hi,
I have CMapStringToString object as a static member variable of a class and using it in static method of that class, but the linker doesn't recognise that object, can any one knows what's the problem?
Warm Regards,
Mushq
|
|
|
|
|
Probably you forgot to write its defintion. Static variables should be used this way,
class MyClass
{
static CMapStringToString obj;
};
CMapStringToString CDlg6Dlg::obj;
|
|
|
|
|
Thanks Prasad
prasad_som wrote: CMapStringToString CDlg6Dlg::obj;//this is needed, other wise linker will give error
but why it is necessary to redeclare that in cpp.
|
|
|
|
|
Its not redeclaration, its definition\initialization. And its by rule.
Read C++ documentation for static keyword.
|
|
|
|
|
hi all, i am coding a routine where i need to know about the status of network which got connected through cyberoam client. i need to get notification when cyberoam fails and connects.i have used IsNetworkAlive but cud able to get notification when the network is disabled or enabled but cudnt get when cyberoam disables or enables!!!!
plz help
regards and thanks in advance
sudhir
|
|
|
|
|
I'd written keyboard hook dll in MFC.
i am able to convert keys like "a" into any of the alphabets of 'b' to 'z'.
But when i am trying to assign it virtual key value of gujarati fonts i am not getting the things right can you help me what is wrong?
sdfggdsgdssdgdsfg
sdfgds
-- modified at 6:11 Monday 19th February, 2007
|
|
|
|
|
Hey guys,
Im doing a progamming project which computes your age in days but my calculation is off by 200 days or so any input would be greatly appreciated.
[code]
//Program Name: Days On Earth
//Author: Charles Covington
//Date:
//Description :
#include <iostream>
#include <windows.h>
#include <string>
using namespace std;
//begin main program
int main () {
//declare variables
SYSTEMTIME st; //declare the date/time structure
int year, month, day;
float daysInYear = 365.25;
cout <<"Enter your year of birth. " <<endl;
cin="">> year;
cout << "Enter your month of birth. " <<endl;
cin="">> month;
cout << "Enter your day of birth. " <<endl;
cin="">> day;
int GMT_CONVERSION = 5; //local time is GMT-5
GetSystemTime(&st);
cout << "Current Year= " << st.wYear <
|
|
|
|
|
Charles Covington wrote: age_days= age_years*daysInYear + st.wDay;
I believe you're adding the days from the years, and you're then adding the day of the week, when what you want to do is calculate the days in the months that have passed since the last birthday.
Also, 365.25 is not 100% accurate, but I'm sure you know that. It depends on when the first leap year was from the birthdate, and there's also an extra leap year every 100 years, I think.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
"I am working on a project that will convert a FORTRAN code to corresponding C++ code.I am not aware of FORTRAN syntax" ( spotted in the C++/CLI forum )
|
|
|
|
|
I noticed you are using GetSystemTime() and calculating the time zone, wouldn't it be easier to use GetLocalTime()
|
|
|
|
|
Charles Covington wrote: but my calculation is off by 200 days or so
Mercy, you can get closer than that with something as crude as:
2007/02/18
YYYY/MM/DD
wherein if you borrow from the month, you add 30 to the day, and if you borrow from the year, you add 12 to the month. Doing this gives my age as 38Y 5M 12D, when my actual age is 38Y 5.4M. That's close enough for government work!
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
If you were using MFC, this would be easy (and only 4 lines of code).
COleDateTime dtDOB(1,1,1960,0,0,0);
COleDateTime dtToday = COleDateTime::GetCurrentTime();
COleDateTimeSpan dtDiff = dtToday - dtDOB;
int nDays = dtDiff.GetDays();
This is typed from memory, so you may have to adjust some stuff, but you get the idea.
---------------------------------------------------------------------
If you absolutely cannot use MFC, look at this article here on CP:
http://www.codeproject.com/datetime/datetimedisc.asp[^]
"Why don't you tie a kerosene-soaked rag around your ankles so the ants won't climb up and eat your candy ass..." - Dale Earnhardt, 1997 ----- "...the staggering layers of obscenity in your statement make it a work of art on so many levels." - Jason Jystad, 10/26/2001
|
|
|
|
|
Ok I modified a few things but I believe that it is still off...
[code]
//Program Name: Days On Earth
//Author: Charles Covington
//Date:
//Description :
#include <iostream>
#include <windows.h>
#include <string>
using namespace std;
//begin main program
int main () {
//declare variables
SYSTEMTIME st; //declare the date/time structure
int year, month, day;
float daysInYear = 365.25;
int months = 30.4375;
cout <<"Enter your year of birth. " <<endl;
cin="">> year;
cout << "Enter your month of birth. " <<endl;
cin="">> month;
cout << "Enter your day of birth. " <<endl;
cin="">> day;
int GMT_CONVERSION = 5; //local time is GMT-5
GetSystemTime(&st);
cout << "Current Year= " << st.wYear <
|
|
|
|
|
If it's worth doing, it's worth doing right.
Don't use an approx. daysInYear.
Caclulate the Julian day for the current day and the birth date.
Subtract one from the other to get age in days.
See:
http://en.wikipedia.org/wiki/Julian_day[^]
(calculating the JD from YMD is 4 lines of code, no excuse not to use it)
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Good day to you all! I have a program where a CSTRING contains a string of hex value then turn it to INT. The way I convert basically is to use a for loop and convert each char one-by-one till I get the result. Now, this for me is a problem since I am doing a char per char conversion which takes long to process especially when I am having a huge hex value. I would like to know if there is a better way of doing a hex to int conversion.
for(nindex = 0;nindex < nlength; nindex++)<br />
{<br />
ctemp = buffstrdata.GetAt(nindex);<br />
ntemp = GetIntValue(ctemp);
result = result + (int)pow(16, nlength - 1 - nindex) * ntemp;<br />
}
Thanks a lot for the time and help!
|
|
|
|
|
what about:
char *p;
int i = strtol(pHexString, &p, 16);
|
|
|
|