|
It's a well known bug: The Month Calendar returns a false Date...
Does somebody know a bugfix or a workaround for this problem? (I'm sorry if a thread already exists but the search found nothing that looked good...)
|
|
|
|
|
What's the bug? Have a link?
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Just try this little code:
void CTodolisteDlg::OnSelectkalender(NMHDR* pNMHDR, LRESULT* pResult){
UpdateData(true);
m_tag = m_datetime.Format( "%A, %B %d, %Y" );
UpdateData(false);
}
(m_tag is the membervariable (string) of a textbox and m_datetime is the membervariable (CTime) of the Month Calendar)
In your textbox will be written an other date then you have selected...
-- modified at 14:23 Thursday 21st June, 2007
|
|
|
|
|
It works for me but I'm on VS 2003 (MFC 7.1). I suppose the bug was/is in CTime somewhere?
For a workaround, maybe use the actual SYSTEMTIME of the NMSELCHANGE struct passed in the
notification and use a "better" date/time class...
void CTodolisteDlg::OnSelectkalender(NMHDR* pNMHDR, LRESULT* pResult)
{
NMSELCHANGE *pNMSelChange = (NMSELCHANGE *)pNMHDR;
COleDateTime OleDateTime(pNMSelChange->stSelStart);
<code>
m_tag = OleDateTime.Format( "%A, %B %d, %Y" );
UpdateData(false);
}
-- modified at 14:47 Thursday 21st June, 2007
*edit* Ooops
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Sorry, i'm a "noob" in MFC...
I don't understand how to use this example above, but when I compile it simply it doesn't works cause now is m_datetime not changed...
that means that the selected date is fix set to the inital-value of m_datetime...
Are there alternative calendars that works well for VC++?
|
|
|
|
|
See the fixed code - I messed it up and left your variable in there.
Sorry about that
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I don't understand your Code but it works!
Can you explain what those lines do:
NMSELCHANGE *pNMSelChange = (NMSELCHANGE *)pNMHDR;
COleDateTime OleDateTime(pNMSelChange->stSelStart);
(Cause i want to learn something^^)
Thank you!
You saved my project^^
|
|
|
|
|
// Cast the passed NMHDR pointer to a NMSELCHANGE pointer, which is the type
// of structure passed in a MCN_SELECT notification
NMSELCHANGE *pNMSelChange = (NMSELCHANGE *)pNMHDR;
// Create a COleDateTime object from NMSELCHANGE.stSelStart (which is a SYSTEMTIME struct)
// using the COleDateTime(SYSTEMTIME&) constructor
COleDateTime OleDateTime(pNMSelChange->stSelStart);
// use the COleDateTime::Format() method to create a CString representation of the date
...
I don't have access to the MFC code for version 4.x (VC 6) so I'm not sure what the actual bug is.
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi All,
I am trying to implement the behavior of SysListView32 using ListView.
When a folder is selected in TreeView, i'm retrieving visible columns for current selection
using the following code:
<br />
SHELLDETAILS sd;<br />
LPTSTR pszHeader=NULL;<br />
CString sColumns;<br />
for(int i=0;SUCCEEDED(m_ShellDetails.GetDetailsOf(NULL,i,&sd));i++)<br />
{<br />
GetShellPidl().StrRetToStr(sd.str,&pszHeader,NULL);<br />
if (pszHeader)<br />
{<br />
TRACE1("Column found %s\n",pszHeader); <br />
if (!sColumns.IsEmpty())<br />
sColumns += _T("|");<br />
sColumns += pszHeader;<br />
GetShellPidl().Free(pszHeader);<br />
pszHeader= NULL;<br />
}<br />
}<br />
return sColumns;<br />
Because normal file system folders have columns like Name, Size, Type and Date Modified,
while Control Panel has columns like Name and Comments.
I am successfully enumerating ALL the columns, but i need to know how to determine whether to make a particular column visible or not. Because a user may determine which columns he/she want to view.
Please Help.
---------------
Never loose hope...
|
|
|
|
|
a_b_pathak wrote: I am trying to implement the behavior of SysListView32 using ListView.
What exactly do you mean? The underlying window class of CListView is SysListView32 .
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi,
Not really, I'm using various Shell Interfaces like IShellFolder etc. to enumerate
Shell objects and showing them in a ListView (List Control to be precise).
But the problem is that I can't determine which columns should be shown when a particular Folder (be it Normal File System Folder or Special Folder like Control Panel or Network Neighborhood) is selected, I'm able to enumerate all the columns for a particular Folder though.
How can I determine if they should be visible or not?
--------
You never forget anything... You just can't recall it....
|
|
|
|
|
According to Microsoft's documentation, this function prototype is the following:
BOOL QueryPerformanceCounter(
LARGE_INTEGER *lpPerformanceCount
);
My question is, what would be the range of values that *lpPerformanceCount would come out as? I'm curious to know if a value of 0 would be invalid or not, or if it might even be possible to go into the negatives. I'm guessing that accessing a hardware counter would mean that 0 is a valid performance count.
|
|
|
|
|
Cyrilix wrote: My question is, what would be the range of values that *lpPerformanceCount would come out as?
Hint: Have you looked to see what a LARGE_INTEGER is?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
From this site, it is a signed 64-bit integer, which means that it can have negative values, but just because it can have negative values does not mean that when passed into a given function, and querying a hardware counter, you will ever get negative values, and hence my question.
|
|
|
|
|
See here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I see -- I'll stick with being safe just to be sure nothing wrong happens in 95 years.
Thanks.
|
|
|
|
|
From the looks of DavidCrow's link, you can just add code to exit your app if it runs longer than
90 years and you won't have to worry about it!
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Actually, the only time I have to call for a check on QPC is when I'm running it for the first time, since I'm using a "last count" and "current count" variables to do timing differences between each frame. On the first timing, all it has to do is set the last count -- everything else will follow standard routine, so in this case, even if my uptime is 95 years, it'll still be OK (I would imagine something would go wrong before then).
|
|
|
|
|
Is there a better way to count files in a directory than by using ::FindFirstFile and ::FindNextFile?
In my code to determine the number of items to process in a progress meter, I can get the count using these methods but I was hoping there was a function that already wraps this somehow.
I noticed previous questions in this forum seem to indicate that the above functions are the best way but I thought I'd check, just in case.
|
|
|
|
|
bob16972 wrote: Is there a better way to count files in a directory than by using ::FindFirstFile and ::FindNextFile?
None that I'm aware of.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
|
|
|
Hi All!
I have a problem with MFC class CSocket, same times the OnReceive method is not called ...
Any idea for fix this issue...
Too many plans make the health badly!!
|
|
|
|
|
please be clear in your question?
how i can help you without any explanation?
|
|
|
|