|
Hi all,
i have a SYSTEMTIME that represents the hour '03:02:25 PM' i want to
represent this time as STRING!
i am not using MFC, i use ATL/Win32API
can any1 help?
thanks in advanced,
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
strftime will probably do what you ask.
Michael
'War is at best barbarism...Its glory is all moonshine. It is only those who have neither fired a shot nor heard the shrieks and groans of the wounded who cry aloud for blood, more vengeance, more desolation. War is hell.' - General William Sherman, 1879
|
|
|
|
|
thanks for the reply!
this is what i use:
void CSimpleDlg::SetStartTime(SYSTEMTIME& stStart)
{
wchar_t* wcStartTime = new wchar_t[MAX_SIZE_STRING_TIME];
wcsftime(wcStartTime,MAX_SIZE_STRING_TIME,L"%H:%M:%S",&stStart);
}
i get a compilation error regarding last parameter should be of 'tm' struct.how do i convert from SYSTEMTIME to tm?
thanks again
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
you might also do it that way:
<br />
wchar_t* wcStartTime = new wchar_t[MAX_SIZE_STRING_TIME];<br />
swprintf(wcStartTime, "%i:%i:%i", stStart.wHour, stStart.wMinute, stStart.wSecond);<br />
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
thanks a lot man, you really helped me.....
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
You're welcome!
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi again,
i need another help....
i want the system to conver the time to string as given from the SYSTEMTIME
(i.e - if the SYSTEMTIME was 03:02:03 AM then the string should be 03:02:03 AM and if the SYSTEMTIME was 15:02:03 then the string should be accordingly 15:02:03)
can u help me again plz?
thanks
Yaron
Ask not what your application can do for you,
Ask what you can do for your application
|
|
|
|
|
Repeat the question... I'm a novice speaking english, but what you've written have nosense... (I think)
|
|
|
|
|
The values in the SYSTEMTIME structure are in no particular format. It's up to you to format them into a variable. For example:
char str[32];<br />
SYSTEMTIME st;<br />
GetSystemTime(&st);<br />
sprintf(str, "%02u:%02u:%02u", st.wHour, st.wMinute, st.wSecond);
|
|
|
|
|
The WIN32 api has some powerful functions for formatting SYSTEMTIME vars. See GetDateFormat and GetTimeFormat in the docs.
onwards and upwards...
|
|
|
|
|
Hello,
I have a problem ... I want to capture the desktop and save it in a 24Bit bitmap ... my desktop can be 256, 16bit or 32bit color.
How can I do that ? It works fine if the desktop is in 24bit ... but I want to convert a HBITMAP from 256, 16bit, 32bit to 24bit ... I hope I will not have to convert it manualy by saveing it byte by byte .... I hope there is something in windows that can take care of it ... because I saw 15Bit color and God knows many these types can be and I hope I don't have to take care of all... Please if anone can help me... !!! thanks !!!
|
|
|
|
|
|
it's cool .... !
thanks .... !!!
|
|
|
|
|
Hi
Recently I installed Visual Studio .NET for testing purposes, but kept Visual Studio 6 on my HDD. Now I uninstalled VS .NET and VS6 doesn't handle files like .dsw,.cpp,.h etc anymore. How do I restore the file associations with VC6 again?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Either reinstall, or set the associations manually. VS6 doesn't include any tools for redoing the associations.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Ok thanks, seem like it's gonna be a lot of work. Do I lose my VC settings like colors, fonts, include/lib folders etc. if I reinstall?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Greg S. wrote:
Do I lose my VC settings like colors, fonts, include/lib folders etc. if I reinstall?
Yeah, but you can backup that part of the registry first (just export to a .reg file, and import again after the install)
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|
|
Anybody know how to use the Marshal.GetObjectsForNativeVariants function.I want to transfer the data from Unmanaged Win32 DLL to C# DLL.but the restriction is that I can only use IntPtr as passing param.
Like
Win32 DLL
I created One SafeArray
SAFEARRAY *pSA;
//Some code
pSA = SafeArrayCreate(VT_BSTR...);
SafeArrayPutElement(pSA...,String here );//safearray is full of BSTR Strings
then I called the C# DLL function
pData->ISetIntData((long)pSA);
And in C# DLL
public void ISetIntData(IntPtr Val)
{
Object[] MyObj=Marshal.GetObjectsForNativeVariants(Val,2);
String str=(String)MyObj[0];
MessageBox.Show(str);
//Here It is crashing...
}
Is this a right way Or I am doing some crazy Stuff?
Vikram
Vikram
|
|
|
|
|
I created a class with serialzation support. But then I store class all Ok, but then I try to load class compilation don't pass. Copliler writes:
binary '>>' : no operator defined which takes a right-hand operand of type 'class SnytVolRelOrder *' (or there is no acceptable conversion);
Maybe anyboby knows that's the problem is ?
Sorry for my English.
|
|
|
|
|
You can't serialize this type. Only following types works:
CObject* | SIZE und CSize |float
----------------------------------------
WORD | CString | POINT und CPoint
DWORD | BYTE | RECT und CRect
double | LONG | CTime und CTimeSpan
int | COleCurrency | COleVariant
COleDateTime | COleDateTimeSpan
You must override Serialize for each class that you intend to serialize. The overridden Serialize must first call the Serialize function of its base class.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vclib/html/_mfc_cobject.3a3a.serialize.asp
|
|
|
|
|
I've already done this. The problem is my class normaly loads but then i try to story compliter write an error.
SnytVolRelOrd ord; or SnytVolRelOrd *ord = new SnytVolRelOrd();
CArchive ar(...);
....
ar<<ord; <-----------ok.="" compiler="" passed="" this="" place
ar="">>ord;<------Comiler write an error.
Life is not a programm.
|
|
|
|
|
I have no idea, which kind of problem it is. But, if I serialize my own classes i call the serialize() Function. Like this in DocClass:
void CEmvDoc::Serialize(CArchive& ar)
{
if (ar.IsStoring())
{ // Save
m_tProjDate=CTime::GetCurrentTime();
ar << m_sProjName << m_tProjDate;
}
else
{ // Load
ar >> m_sProjName >> m_tProjDate;
}
m_oaInterfaces.Serialize(ar);
SetModifiedFlag(false);
}
|
|
|
|
|
May be i didn't say some details. A use CArchive with CSocketFile. I create
two CArchive arIn and arOut(before i create CSocket,CSocketFile ) and if y want to send data to i will write arOut<<..
and the i want to get data i write arIn>>.. and in this place error occures.
Sorry tor my English
|
|
|
|
|
Hi
I had a line like this:
<br />
#if defined _CIP || (_STANDALONE && (_KA || _UDV)) || _OTN9<br />
<include something><br />
#endif<br />
One of these defines are no longer needed so I changed it into:
<br />
#if defined (_STANDALONE && (_KA || _UDV)) || _OTN9<br />
<include something><br />
#endif<br />
But this gives a warning / error
aaa.cpp(288) : warning C4004: incorrect construction after 'defined'
aaa.cpp(288) : fatal error C1012: unmatched parenthesis : missing '('
But I'm beginning to suspect it should have been
<br />
#if (defined _STANDALONE && (defined _KA || defined _UDV)) || defined _OTN9<br />
instead
This gives no compiler warnings / errors
What I want is to include some lines if one of the following combination are true
_STANDALONE && _KA
_STANDALONE && _UDV
_OTN9
Would this changes how things would be handled in the preprocessor stage ?
Remark:
I don't use #define to define these, but using "preproccesor settings" under "project settings" , that is the /D switch
Using VC6
|
|
|
|
|
to_be_unknown wrote:
#if (defined _STANDALONE && (defined _KA || defined _UDV)) || defined _OTN9
This is the correct syntax, and will work as you require. The original syntax that you used would work, but only if the defines had the value 0 or 1, or if they were not defined (the preprocessor assumes a definition to have the value 0 if it is not defined). If they had any other value, it would not work correctly.
The reason you were getting compiler errors was because the defined operator operates on an identifier, not on an expression.
Ryan
Being little and getting pushed around by big guys all my life I guess I compensate by pushing electrons and holes around. What a bully I am, but I do enjoy making subatomic particles hop at my bidding - Roger Wright (2nd April 2003, The Lounge)
Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late - John Nichol "Point Of Impact"
|
|
|
|