|
Wrong. Please don't suggest casts as the first solution, without knowing what they're doing.
From the question, you can tell that the program is being built for Unicode (otherwise CString would convert to LPCSTR automatically since LPCTSTR == LPCSTR in MBCS builds). In a Unicode build, casting LPCTSTR to char* will be disastrous.
|
|
|
|
|
PasNad wrote: can anybody tell how to convert CString to LPCSTR
If you have UNICODE build environment ( i.e _UNICODE is defined )then you will have to do the following
USES_CONVERSION;
LPCSTR lpcstrNonUnicode = W2A(( LPCTSTR )csStringToConvert ); If you have a non UNICODE ( i.e. _UNICODE not defined ) build environment
Then just a simple assignment is needed...
LPCSTR lpcstrNonUnicodeString = csStringToConvert;
|
|
|
|
|
|
I am trying to write a program to get list of files in a folder sorted by created Date and Time. Is there a function to do the same.
Can anyone reply me on this......
Thanks
|
|
|
|
|
Does WIN32_FIND_DATA suits your needs;
typedef struct _WIN32_FIND_DATA {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved0;
DWORD dwReserved1;
TCHAR cFileName[MAX_PATH];
TCHAR cAlternateFileName[14];
} WIN32_FIND_DATA, *PWIN32_FIND_DATA;
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Coder8725 wrote: I am trying to write a program to get list of files in a folder sorted by created Date and Time. Is there a function to do the same.
Can anyone reply me on this......
There is an API CompareFileTime . Along with this API you can use GetFileTime API to get the time of the two files.
Take a look at qsort for sorting.
|
|
|
|
|
I get txt files to upload into my system
say
1) 00002.txt 01/11/2006 11:00 AM
2) 00001.txt 01/11/2006 10:00 AM
3) 00003.txt 01/11/2006 11:10 AM
I need to pick files by time and upload in the order 2) then 1) then 3)
Number of files is not limited.
I am currently using FindFirstFile and FindNextFile and the DWORD as mentioned in the other post. But this sorts by FileName.
|
|
|
|
|
Coder8725 wrote: I am currently using FindFirstFile and FindNextFile and the DWORD as mentioned in the other post. But this sorts by FileName.
Not necessary, you can use FindFirstFile and FindNextFile to get file information ( which is better than GetFileTime ). Then sort them based on the file creation time.
Use CompareFileTime .
qsort also helps. You can specify a custom compare function callback and just return the value returned by CompareFileTime from this callback function because that is what qsort expects.
|
|
|
|
|
i am using the IMessenger2 interface, when i try to get my contacts, i see the number returned is 0 (it doesn't happened on every computer , it occured 3 out of 10 i've tested).
why is that? i must add that my messenger is online and i have plenty of contacts...
can any1 help?
thanks
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
|
Is WM_CTLCOLORBTN helpfuls
|
|
|
|
|
WhiteSky wrote: Is WM_CTLCOLORBTN helpfuls
This won't work for buttons...
|
|
|
|
|
|
Thank you so much for all the replys. As said by Nibu babu thomas, WM_CTLCOLORBTN cannot be used for command(push) buttons. So, can anyone enlighten me.
|
|
|
|
|
codesen wrote: So, can anyone enlighten me.
The only way to go about this is to owner draw this button.
|
|
|
|
|
Thanx for ur reply. I guess there is no other way than to use the one that i posted in the beginning of this thread (ColorButton). Thanx a lot.
|
|
|
|
|
Hi All,
I am creating one shared memory. In that I can create it using CreateFileMapping() in one process and i can write datas on that memory.
but How can i read its contents from another process or application?
Kindly Help me .
|
|
|
|
|
Have a look on this.
Link[^]
Appu..
"If you judge people, you have no time to love them."
|
|
|
|
|
I have used new ATL object to do OLE DB connection,bywhich i got table.h header file,and now i want to insert data in msaccess table by using following code...can anybody help me to solve my problem can you just tell me one thing first whether this way of using to insert data is correct or not...
and what changes should i make it here to correct it
.
//BOOL m_bInserting; // addedd for database
m_TQuote.Open(); // addedd for database
m_bInserting = FALSE; // addedd for datbase
DoModal();
//GetDlgItemText(IDC_EDIT1 ,m_MainEdit);
GetDlgItemText(IDC_EDIT1,m_TQuote.m_DateTimeStamp);
GetDlgItemText(IDC_EDIT1,m_TQuote.m_MarketNo);
GetDlgItemText(IDC_EDIT1,m_TQuote.m_Bid);
GetDlgItemText(IDC_EDIT1,m_TQuote.m_MarketName);
GetDlgItemText(IDC_EDIT1,m_TQuote.m_Ask);
GetDlgItemText(IDC_EDIT1,m_TQuote.m_MarketState);
HRESULT hr = 0;
if (m_bInserting)
{
hr = m_Set.Insert(); // add new row
}
else
{
hr = m_Set.SetData(); //update row
}
m_bInserting = FALSE;
|
|
|
|
|
|
|
|
What is m_TQuote ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
CTquote is class
CTQuote m_TQote
|
|
|
|
|
So what is CTQuote ?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|