|
COleDateTime dt(1600,3,31,15,30,10);
CString datetimestr = dt.Format(_T("%d %B %Y - %X"));
I run the same code that cause the error in visual studio 2005 but in vc6 it works.
|
|
|
|
|
I was testing on VS 2005 and it works. You've included ATLComTime.h, right?
You should be able to tell from the assertion why it's not working.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
hi
_tcsftime(lpszTemp, strDate.GetLength(), pFormat, &tmTemp) has an assertion tm_year >= 0 so for every year less than 1900 it will throw assertion
////////////////////////////////////////////////////////////////////////
IN COleDateTime::Format(LPCTSTR pFormat) follwing Code is there
struct tm tmTemp;
tmTemp.tm_sec = ud.st.wSecond;
tmTemp.tm_min = ud.st.wMinute;
tmTemp.tm_hour = ud.st.wHour;
tmTemp.tm_mday = ud.st.wDay;
tmTemp.tm_mon = ud.st.wMonth - 1;
tmTemp.tm_year = ud.st.wYear - 1900;
tmTemp.tm_wday = ud.st.wDayOfWeek;
tmTemp.tm_yday = ud.wDayOfYear - 1;
tmTemp.tm_isdst = 0;
CString strDate;
LPTSTR lpszTemp = strDate.GetBufferSetLength(256);
_tcsftime(lpszTemp, strDate.GetLength(), pFormat, &tmTemp);
////////////////////////////////////////////////////////////////////////
Viknaraj
|
|
|
|
|
I just traced into that method with the same code.
Although tmTemp.tm_year is negative at the call to _tcsftime(), it still formats a proper string.
No assertion.
Also, you didn't show any code that has ASSERT in it.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Thanks for your valuable cooperation. The follwing code shows is assertion message box
File : strftime.c
Line:783
Expression :(timeptr->tm_year>=0)
case('Y'): /* year w/ century */
{
assertion is occured b>_VALIDATE_RETURN( ( timeptr->tm_year >=0 ), EINVAL, FALSE)
temp = (((timeptr->tm_year/100)+19)*100) +(timeptr->tm_year%100);
/* pass alternate_form as the no leading zeros flag */
_store_num(temp, 4, string, left, alternate_form);
break;
}
|
|
|
|
|
It seems years <1900 do not work (for Format()) in VC 6. In VC 8 it works fine.
I'm not sure what else to tell you besides it works as documented.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
In my SDI application (VC 2003), I get the start point from LButton Down and eEnd point from LButton Up and draw a line using MoveTo and LineTo. I add the line info (from and to points) onto a CTypePtrArray list.
All I want is if I hover over a drawn line, I should have a tooltip giving me
info pertaining to that line.
I think, the approach that I should follow is generate a small region surrounding( a rectangle) the line and if the mouse hovers over that area, I run through the Line array list and see if the current mouse position is with the specified area of a line and if yes display the tooltip info about that line.
Could anybody guide me with respect to the above requirment?
|
|
|
|
|
|
I dont think I can do the same as in the example that was found in the link that WhiteSky has posted.
I can assign tooltip to controls on a dialog but I dont think I can assign tooltip info to a line which I draw and then display it when I hover over that line.
|
|
|
|
|
There are three parts to your question...
1/ when am a vaguely near the line?
You can do this by making a bounding rectangle from the end points, inflating a little (unless you expect hyper precision), and checking if the mouse point is within that.
2/ OK, I'm in the rectangle, but am I near the line?
Look at http://geometryalgorithms.com/Archive/algorithm_0102/algorithm_0102.htm[^] for the equations to measure the points distance from the line. If its not within (eg) 8 pixels, move on.
3/ OK, I'm near - now display a tooltip.
I'm assuming you can do this already!
Its up to you whether you do a bounding check first or not... but as the maths are simple, it's probably worth doing on a large collection, and not worth the extra coding for only a few lines...
The website above was very handy to me in the past!
Iain.
|
|
|
|
|
In my program of creating an editor i need to display calltips that is while debugging if keep the cursor over the variable it should show u the vale of the variable...
but i don't know how to create a calltip itself in scintilla..
even then i used SCI_CATTTIPSHOW,SCI_CALLTIPACTIVE AND I'M not getting any calltip displayed...
can anyone suggest me the basic procedures of how to get a calltip in scintilla based editor...
|
|
|
|
|
Hello,
I have a class derived from CRichEditCtrl.Now I want to handle the OnKeyDown message for my class.
class CRICH : public CRichEditCtrl
{
protected :
afx_msg void OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags);
}
void CRICH::OnKeyDown(UINT nChar, UINT nRepCnt, UINT nFlags)
{
CRichEditCtrl::OnKeyDown(nChar, nRepCnt, nFlags);
CString str;
GetWindowText(str);
CRichText = str;
}
In the above code in str I want the exact text that is entered in the edit box but what I get is one character less.
i.e if the editbox has te value entered as Delhi
I get str = Delh; nChar = i ;
What must be the problem and will I have to join str and nChar?
Thanks
Pithaa
|
|
|
|
|
Can it be because of the "\0" at the end? Sometimes has to be counted as well.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Why don't you transfer this code to OnKeyUp ?
Prasad
MS MVP - VC++
|
|
|
|
|
As prasad said, transfer this to OnKeyUp.
Think about it... Imagine you held a button down: you get one WM_KEYDOWN, and lots of WM_KEYUPS.
You get credit for letting the richedit box handle the message first though!
Another approach. Isn;t the richedit a fancy version of the edit control? and won't it send a EN_CHANGE / EN_UPDATE to its parent window. It's easier to handle that...
Iain.
|
|
|
|
|
Hello,
I have a child window with minimize, maximize and restore buttons.
But which which windows message has to be used to activate the restore minimize buttons.i.e if the button is pressed on the minimize button which message is generated.
Thanks,
Prithaa
|
|
|
|
|
See,CWnd::OnSize .
It's first parameter is to distinguish, which action is been taken. In your case, you might be interested in SIZE_RESTORED .
Prasad
MS MVP - VC++
|
|
|
|
|
The actual message for those items is the WM_SYSCOMMAND message. (wParam & 0xFFF0) will identify which syscommand has been requested SC_MINIMIZE, SC_MAXIMIZE, SC_RESTORE.
|
|
|
|
|
Hi guys,
I would like to ask how to enable input parameter request upon debugging/executing an application in visual studio? I am trying to debug my c++ application and since I am used to running an application in the command line, I have no idea how to do this in visual studio.
If in the command line, usual stuff would be: test 1 -> where test is the application and 1 is the parameter.
Is there any way where a request for input parameter would be enabled in visual studio?
Sorry, I am not that used to VS.
I would appreciate any help. Thanks!
-waxie-
|
|
|
|
|
Which version of visual studio you are using.
You can specify command line arguments while debugging, by using following options,
1. On VC 6.0 , project settings-->debug-->program arguments .
2. On VS2005 , Project settings-->Config. properties-->debugging-->command arguments.
Prasad
MS MVP - VC++
|
|
|
|
|
How can i make a countdown timer in VC++! Ex: timer is 2' and count down 1:59, 1:58...0, and print a message: Time is up! Can you help me! I am a newbie! Thanks!
|
|
|
|
|
With Windows GUI, just call SetTimer(1000) .
"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
|
|
|
|
|
Dear all!
Now, I'm creating a activeX use MSHTML. I want to resize a cell in object table. This is my solution:
I received the mouse moving on the edge of the cell. I change the type of cursor and than Click mouse and mouse moving I change the size of cell (width or height of cell). But I can't discriminate when dose the mouse move on the vertical edge of the cell, when dose the mouse move on the horizontal edge.
Can you help me this problem.
If you have a solution that to resize the cell in the table, can you tell me!
Thanks you very much!
|
|
|
|
|
I'm writing a DLL that can be accessed by multiple applications. The DLL talks to hardware (through a third-party driver). I need to block all other calls to the DLL while the DLL is talking to the hardware. What is the best synchrounization method - critical section, mutex,...?
Also, I think the synchronization object in the DLL needs to be global so it can be accessed by multiple processes. How do I do that?
Thanks,
VF
|
|
|
|
|
A critical section seems taylor-made for your requirements.
No need to worry about where to allocate the synchonisation object: Your routines in the DLL do this before accessing the Hardware.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|