|
Nyarlatotep wrote: My problem is not to parse the input string date.
My bad. I just assumed you had the math worked out, but was having difficulty with the parsing.
Nyarlatotep wrote: ...mktime() takes into account time zone and daylight saving so...
So what is the value of tm_isdst prior to calling mktime() ?
Nyarlatotep wrote: ...the time_t date obtained from mktime() is 01/06/2006 17:00:00
What are you using to convert the time_t value to a string?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I've set tm_isdst to 0.
However to convert the string into time_t I've used these functions (insted of mktime):
void FileTimeToUnixTime(LPFILETIME pft, time_t *t)
{
// Note that LONGLONG is a 64-bit value
LONGLONG ll;
ll = pft->dwHighDateTime;
ll <<= 32;
ll |= pft->dwLowDateTime;
ll = ll - 116444736000000000;
*t = ll / 10000000;
}
void SystemTimeToUnixTime(LPSYSTEMTIME pst, time_t *t)
{
FILETIME ft;
SystemTimeToFileTime(pst, &ft);
FileTimeToUnixTime(&ft, t);
}
the datetime string is parsed and a SYSTEMTIME struct is filled. Then SystemTimeToUnixTime() is used to convert from SYSTEMTIME to time_t.
---------------------------------------------------
To revert time_t to a string I've used these functions :
void UnixTimeToFileTime(time_t t, LPFILETIME pft)
{
// Note that LONGLONG is a 64-bit value
LONGLONG ll;
ll = Int32x32To64(t, 10000000) + 116444736000000000;
pft->dwLowDateTime = (DWORD)ll;
pft->dwHighDateTime = ll >> 32;
}
void UnixTimeToSystemTime(time_t t, LPSYSTEMTIME pst)
{
FILETIME ft;
UnixTimeToFileTime(t, &ft);
FileTimeToSystemTime(&ft, pst);
}
time_t is converted to a SYSTEMTIME by UnixTimeToSystemTime(). Then I've build a datetime string using SYSTEMTIME members.
These functions use internally FileTimeToSystemTime() and SystemTimeToFileTime() and no other OS functions.
I've thought that these two functions only convert SYSTEMTIME to FILETIME and vice versa without taking into account time zone and day light saving ...
|
|
|
|
|
I'm not sure what effect all of those other functions have on the date value, but I tried the following and got the correct output both times regardless of the value of tm_isdst :
struct tm now;
now.tm_sec = 0;
now.tm_min = 0;
now.tm_hour = 15;
now.tm_mday = 1;
now.tm_mon = 5;
now.tm_year = 106;
now.tm_wday = 5;
now.tm_isdst = 1;
printf("%s", asctime(&now));
time_t t2 = mktime(&now);
printf("%s", ctime(&t2)); I guess I'm just not understanding your problem well enough.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
How can I modify the Untitled "title" that apears in my SDI aplication? I modified AFX_IDS_APP_TITLE "My aplication". But on the right of it it apears Untitled like this:
Untitled= My aplication.
So???
|
|
|
|
|
What exactly is it that you are wanting? If you are not wanting "Untitled" in the caption, see here.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Serch for IDR_MAINFRAME in string table resource and insert the desired string between first and second '\n', like for example:
MyApp\nMY COOL NEW DOCUMENT\nMyApp\n\n\nMyApp.Document\nMyApp Document
-- modified at 9:01 Thursday 3rd August, 2006
PS. Tanar, tanar, dar de ce asa de nelinistit?
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
... and moreover, if you want to write in the caption anything your muscles want, override CFrameWnd::OnUpdateFrameTitle, like for example:
class CMainFrame : public CFrameWnd
{
public:
virtual void OnUpdateFrameTitle(BOOL bAddToTitle);
};
void CMainFrame::OnUpdateFrameTitle(BOOL bAddToTitle)
{
SetWindowText(_T("Asta-i pohta ce-am pohtit!"));
}
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
|
Mai Flaviu, vrei sa te calmezi putzin?
Please, explain what's really your problem.
You cannot find in a list an item which was not inserted?
Ovidiu Cucu
Microsoft MVP - Visual C++
|
|
|
|
|
Whats your prblem,exactly?
why you write a new thread for this object repeated?
|
|
|
|
|
What in the world are you asking here? Are you wanting to know how to populate a list control from a database? If so, there's an example of that here. If it's something else, please explain in more detail.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
|
It is not clear if your items -- loaded from FoxPro database -- are successfully inserted into your list control. If they appear in the list control, but FindItem apparently cannot find them, maybe they contain some additional spaces returned from FoxPro?
Maybe you should try something like this:
m_list.InsertItem(..., CString(text_from_database).Trim());
m_list.SetItemText(..., 1, CString(text_from_database).Trim());
I hope executing your program in step-by-step manner and providing reasonable details can help to solve the problem quickly.
|
|
|
|
|
I have to make an application which would access MS accesss datatbase .
I have some experience on VC++ 6 (MFC)but never worked in this field
Please if anyone could suggest me some articles or tutorials or sample codes
I would be grateful to all
|
|
|
|
|
|
SEARCH ON CODEPROJECT ARE MANY ARTICLES FOR DATABASE : CRECORDSET
AND IF YOU DONT FIND ANY WRITE ME ON bravoone@k.ro maybe i can help you ! maybe ...! i'm not so good on database ! i have problems to !!!
read my question ! and maybe you can help me to ...!!!
maybe we can help us! i dont speach english very well ! but i understend everything !
>>>>>>>>>>>>bravoone<<<<<<<<<<<
Bravoone
|
|
|
|
|
anjita wrote: I have to make an application which would access MS accesss datatbase .
See if this helps.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
i dont now what is wrong but nothing hapening when i push the buton !
(the data from list control are from a database in visualfox 6.0)
maybe help this ! i dont now !
void CNcontabile::OnTest2()
{
CString sRelatia ;
m_relatia.GetWindowText(sRelatia);
LVFINDINFO stInfo = {0};
stInfo.flags = LVFI_STRING;
stInfo.psz = sRelatia;
int nItem = m_list.FindItem( &stInfo );
if( nItem != -1 )
{
// the item is in the list control
CString csSecondColumnText = m_list.GetItemText( nItem, 1 );
// set the text to the second edit box
m_credit.SetWindowText( csSecondColumnText);
}
}
i dont use anything else but this in my code and in OnInitDialog :
m_list.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVFI_STRING | LVS_EX_FLATSB);
m_list.InsertColumn(0,"Cont",LVCFMT_LEFT,90);
m_list.InsertColumn(1,"Denumire",LVCFMT_LEFT,360);
Bravoone
|
|
|
|
|
Maybe instead of
m_list.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVFI_STRING | LVS_EX_FLATSB);
you should have
m_list.SetExtendedStyle(LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES | LVS_EX_FLATSB);
Can you put a break point inside the OnTest2 function and execute it in step-by-step manner? I hope this will help you to solve the problem.
|
|
|
|
|
IS STILL NOT WORKING HE FIND ONLY ITEMS INSERTED IN ONINITDIALOG !!!
YOU HAVE ANOTHER SOLUTION !? MAYBE BETHER !!!! THANKS A LOT !!!!!!
bravoone !!!! i wait your answer !!!!!!
and thanks again!!!!!!!!!!!!!
Bravoone
|
|
|
|
|
Flaviu_2006 wrote: stInfo.flags = LVFI_STRING;
What if you used LVFI_PARTIAL instead?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
LVFI_PARTIAL solv the problem THANKS GUYS !!!!!!!!!!!!!!!!!!!!!!!!!
ITS COOOOLLLLLLLLL !!!!!!!!!!!!
ITS WORKING !!!!!!!!!!!!!!!!!!!!!!!!!!!!!
TO EVRYONE WHO HAVE PATIANCE WITH ME => THANKS AND IN THE FUTURE MAYBE I CAN HELP YOU TO !!!!!!!!!!!!!!!!!!!!!!!!
THANKS OF LOT TO EVRYONE!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
SPECIALY TO ---> FRANK WHO HAVE THE IDEEA !!!!!!!!!!!!!!!!!THAKS!!!!
bravoone out !
p.s. - see you soon !!!!!!!!!! on www.codeproject.com
Bravoone
|
|
|
|
|
yes i cannot find in a list an item which was not inserted!
...but is loaded in list control from a database !!!!! visualfox pro 6.0
its a usefull tool if is someone who can do it !
>>>>>>>>>bravoone<<<<<<<<<<<<<
pls help urgent !!!!!!!!!
thanks a lot !!!!!!!!!!!!!
Bravoone
|
|
|
|
|
Hi All,
I have automated MSWord in VC++ and open an *.doc file and save it as a text file with the help of CodeProject. But I am getting Run time errors while I am try to close my application and documents .
*The error is
"Application has requested Run time to Terminate it in an unusual way"
My Code starts here
BOOL CLastApp::InitInstance()
{
if(!AfxOleInit()) // Your addition starts here
{
AfxMessageBox("Could not initialize COM dll");
return FALSE;
}
else
{
AfxMessageBox("Inint");
}
_Application app; // app is the Excel _Application object
if(!app.CreateDispatch("Word.Application"))
{
AfxMessageBox("Couldn't start Word");
}
else
{
//Make Word Visible and display a message
app.SetVisible(TRUE);
AfxMessageBox ("Word is Running!");
}
COleVariant
covTrue((short)TRUE),covFalse((short)FALSE),covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR),covFormat( short(7));
Documents docs = app.GetDocuments();
_Document doc = docs.Open(
COleVariant("D:\\ss.doc"),
covTrue, // Confirm Conversion.
covTrue, // ReadOnly.
covFalse, // AddToRecentFiles.
covOptional, // PasswordDocument.
covOptional, // PasswordTemplate.
covFalse, // Revert.
covOptional, // WritePasswordDocument.
covOptional, // WritePasswordTemplate.
covTrue,
covTrue,
covOptional,
covOptional,
covOptional,
covOptional);
doc.SaveAs(COleVariant("D:\\george\\win.txt"),
covFormat,covOptional,covOptional,
covOptional,covOptional,covFalse,covOptional,
covTrue,covFalse,covOptional, covOptional,covTrue,covOptional,covOptional,covOptional);
/**********IT IS WORKING UPTO HERE PROPERLY ************************/
//**********PROBLEM STARTS FROM HERE****************************//
doc.Close(covOptional,covOptional,covOptional);
docs.Close(covOptional,covOptional,covOptional); /*Error is coming from here if we comment it no error will come */
app.Quit();
}
//Programme Ends here
While am trying to close doc or docs its getting run time error. How I can properly Execute these statements.
Please help me
Thanks in Advance
George K Jolly
-- modified at 10:39 Thursday 3rd August, 2006
|
|
|
|
|
georgekjolly wrote: While am trying to close doc or docs its getting run time error.
Maybe one or the other does not need closed. What runtime error are you referring to?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|