|
Ok i have my answer. The rawoffset of the Timezone object cud be used to co relate with the Bias & hence i can achieve what i want
Thanks for ur help
Dimple
|
|
|
|
|
Look at the Bias member of TIME_ZONE_INFORMATION structure.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
but how will that help me. I have done study of all the structures of c++.
|
|
|
|
|
DimpleSurana wrote:
but how will that help me.
See here.
DimpleSurana wrote:
I have done study of all the structures of c++.
Apparently not, or you would know that that structure is used by GetTimeZoneInformation() .
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
yup i do know that too but the data i have in hand is a TimeZone id which is java specific.
How do i use that value to update my COleDateTime object
|
|
|
|
|
DimpleSurana wrote:
How do i use that value to update my COleDateTime object
You don't (or maybe the id you have from Java's TimeZone class is a requirement, in which case I'm not sure of a solution). The Bias member of the TIME_ZONE_INFORMATION structure tells you how far from UTC you are and in what direction. Here is one solution:
TIME_ZONE_INFORMATION tza;
COleDateTime today = COleDateTime::GetCurrentTime();
GetTimeZoneInformation(&tza);
cout << "The local time is " << (LPCTSTR) today.Format("%H:%M:%S") << endl;
today.m_dt = today.m_dt + (tza.Bias / 1440.0);
cout << "UTC time is " << (LPCTSTR) today.Format("%H:%M:%S") << endl;
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
I have some problems using the new HTML editing classes.
I found a very intresting article about it here on Codeproject, sadly it could'nt help me with my problem.
I wan't to use the IDM_HYPERLINK MSHTML identifier to insert a hyperlink in a html doc. But the function hyperlink(LPCTSTR szUrl = NULL) won't accept my links, it returns an HRESULT error.
Am I supposed to make my URL's look in a special way?
I've tried http://www.adress.com and URL:http://www.adress.com,
but none of them works.
Could someone please help me?
/Markus
P.S the one writing the article was Chris Maunder, sadly I couldn't find any ways of contacting him directly. I hope that at least he knows the answer to my question...
|
|
|
|
|
I'm using time.h, to get time of the day. In my code it is converted into number so it is possible to read the time. But I will have it in ascii format.
I dont know how to do to get hour, min and sec into ascii. I will not have them converted into numbers.
My code:
time_t tid;
tm * ptm;
time(&tid);
ptm = gmtime(&tid);
struct timeval *Tps;
struct timezone *Tzp;
Tps = (struct timeval* ) malloc(sizeof(struct timeval));
Tzp = 0;
gettimeofday(Tps, Tzp);
hour = ptm->tm_hour; //become integers, will have ascii
min = ptm->tm_min;
sec = ptm ->tm_sec;
//Stefan
|
|
|
|
|
Try sprintf(buffer, "%02d:%02d:%02d", hour, min, sec);
<b>Maxwell Chen</b>
|
|
|
|
|
yes, I can use it, but then there will be digits. I will have it in ascii format, because it take less space in a file.
|
|
|
|
|
For saving space issue, I would use this way...
Seven bytes for the whole date and time.
unsigned char sDateTime[7] = { 20, 03, 2, 19, 16, 17, 55 };
int iYr, iMon, iDay, iHr, iMin, iSec;
// To extract from buffer...
iYr = sDateTime[0] * 100 + sDateTime[1];
iMon = sDateTime[2];
iDay = sDateTime[3];
iHr = sDateTime[4];
iMin = sDateTime[5];
iSec = sDateTime[6];
<b>Maxwell Chen</b>
|
|
|
|
|
Hi!
Your solution were good. It made me think in another way. But there is one problem.
How will I solve microseconds (6 digits)?? Two digits is one byte, so six digits willbe 3 byte??
|
|
|
|
|
styve wrote:
I will have it in ascii format, because it take less space in a file
Any ways if you want to store 'A' in the file what do you want to store
'A' or '65' (65 is ascii for 'A') which one takes more space ???
"When death smiles at you, only thing you can do is smile back at it" - Russel Crowe (Gladiator)
|
|
|
|
|
One letter or one digit that is stored to a file is one byte.
If I only store A, the file is one byte.
If I store 65, the file is two byte.
It was that I meant
|
|
|
|
|
styve wrote:
If I store 65, the file is two byte.
Not necessarily. Consider this:
FILE *f;
char letr = 'A';
fwrite(&letr, sizeof(char), 1, f);
letr = 65;
fwrite(&letr, sizeof(char), 1, f); The size of the file in both cases will be one byte.
char *ltrs = "65";
fwrite(ltrs, sizeof(char), 2, f); Now the size of the file will be two bytes.
int num = 65;
fwrite(&num, sizeof(int), 1, f); Now the size of the file will be four bytes.
"The pointy end goes in the other man." - Antonio Banderas (Zorro, 1998)
|
|
|
|
|
hi
i have inserter ms web browser acticeX in my project. mr.Sargoytchev told me that if i want to get the source code of the html that is showing by this activeX u should do the following steps:
1. Use the IWebBrowser2::Document property to obtain an IDispatch interface to the DOM document. <br />
<br />
2. Query the obtained IDispatch for IHTMLDocument3. <br />
<br />
3. Use the IHTMLDocument3::createTextNode() method to convert the root node to text.
first how can i get IWebBrowser2 pointer for my ActiveX window.
for example my activeX class is CExplorer1. and my variable is : CExplorer * web1;
here is my code for step one (Correct me if i'm wroing):
IWebBrowser2* pWebBrowser;
IDispatch* pHtmlDoc = NULL;<br />
HRESULT hr = pWebBrowser->get_Document( &pHtmlDoc );
but i cant write the code to Query the obtained IDispatch for IHTMLDocument3.
any idea ?
thanx.
|
|
|
|
|
hello
I have created a windows application with visual c++ 6.0 which connects to a database.
The application executes SQL queries and I want to set some triggers or the insert, update and delete queries.
However, Where should i place my triggers?
sDsn.Format("ODBC;DRIVER={%s};DSN='';DBQ=s",sDriver,sFile);
TRY
{
CDatabase ComboDatabase;
// Open the database
ComboDatabase.Ope(NULL,false,false,sDsn);
// Build the SQL statement
SqlCommand = "INSERT INTO BandSetting "
"VALUES('" + str25 + "'" ",'" + str1 + "'" ",'" + str2 + "'"
",'" + str3 + "'" ",'" + str4 + "'" ",'"+ str5 + "'" ",'"+ str6 + "'" ",'" + str7 + "'" ",'" + str8 + "'" ",'"+ str9 + "'" ",'" + str10 + "'" ",'" + str11 + "'" ",'"+ str12 + "'" ",'" + str13 + "'" ",'" + str14 + "'" ",'" + str15 + "'" ",'" + str16 + "'" ",'" + str17 + "'" ",'"+ str18 + "'" ",'" + str19 + "'" ",'" + str20 + "'" ",'"+ str21 + "'" ",'" + str22 + "'" ",'" + str23 + "'" ", + str24 + "'" ")" ;
ComboDatabase.ExecuteSQL(SqlCommand);
// Close the database
ComboDatabase.Close();
}
where do i put the trigger???
hope you guys can help me out on this! thanks (^_^!!)
|
|
|
|
|
Now ppl this is funny!
int var=10;<br />
cout<< (var++ * var++) ;
it should print 110 but it actually doesn't. it prints 100
but it works correctly (prints 110) on c#, java compilers and other c++ compilers.
|
|
|
|
|
i get 102 when i run it
|
|
|
|
|
With VC++ 6.0, the result here is
100. (One hundred.)
And I think "One hundred" is a correct result. Because when such an expression:
int var = 10;
cout << (var++ * var++);
is equal to:
int var = 10;
cout << (var * var);
var = var + 1;
var = var + 1;
// var = 12 now.
<b>Maxwell Chen</b>
|
|
|
|
|
Yes even i do get 100
Cos v++ is equivalent to a post increment so the answer should be v*v & the value of v is then updated to 12
|
|
|
|
|
No I don't think so, the results should be 110 because unary operators has higher precedence over binary operators, the correct steps will be as follwing:
At the beginning var is 10.
1, calc the first "var++ ", result is 10 and var becomes 11.
2, calc the second "var++ ", result is 11 and var becomes 12.
3, calc the product of the first result(10) and the second result(11), which is 110.
At the end var is 12.
|
|
|
|
|
Maxwell Chen is right. The result should be 100.
Post-Increment means "Increment this variable after the operation the post-increment is used in".
So a = b++ means "A = B. Increment B."
and a= b++ * c++ means "A = B multiplied with C. Increment B. Increment C."
Cheers
Sebastian
|
|
|
|
|
u know * is Preeminent than ++ so at first RESULT will set to (Var * Var).
but var++ will not change the result
so result = (10*10) = 100
and val will updated to 12
|
|
|
|
|
You might be confused...
Regarding to the example:
cout << (var++ * var++);
The meaning of "precedence" is, to take the expression as:
cout << ((var++) * (var++));
// Means that parsing the postfix ++ token first.
// Not means that counting the result of postfix ++ operation.
rather than
cout << ((var++) (*var)++); // Wrong.
since operator * (Multiplicative) has lower precedence than operator ++ (postfix).
<b>Maxwell Chen</b>
|
|
|
|
|