|
The NULL Developer wrote:
Maybe you should call UpdateData(FALSE) before using the associated variable.
Just a little Correction.. there is no need of use UpdateData(FALSE) on CDateTimeCtrl
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Thank you Alok
in the MSDN samples just search for floder named "cmnctrl1"
open the project and in the file "datetime.cpp" replace the function as below
<br />
<br />
<br />
void CDateTimePage::OnDTNotify(NMHDR *pHdr, LRESULT * pRes)<br />
{<br />
CTime ct;<br />
CString st;<br />
<br />
switch( pHdr->code)<br />
{<br />
<br />
case DTN_CLOSEUP:<br />
m_lbNotifyList.AddString(_T("DTN_CLOSEUP"));<br />
<br />
break;<br />
case DTN_DATETIMECHANGE:<br />
<br />
m_lbNotifyList.AddString(_T("DTN_DATETIMECHANGE"));<br />
(m_DateTime.GetMonthCalCtrl())->GetCurSel(ct);<br />
ct.GetMonth ();<br />
m_DateTime.UpdateData (TRUE);<br />
st.Format(_T(" --- %02d/%02d/%2d ---%2d"),ct.GetMonth(),ct.GetDay(),ct.GetYear(),((ct.GetDay())-12 ));<br />
m_lbNotifyList.AddString(st);<br />
break;<br />
<br />
case MCN_SELECT:<br />
m_lbNotifyList.AddString(_T("asdf"));<br />
break;<br />
<br />
case DTN_DROPDOWN:<br />
m_lbNotifyList.AddString(_T("DTN_DROPDOWN")); <br />
break;<br />
case DTN_FORMAT:<br />
m_lbNotifyList.AddString(_T("DTN_FORMAT"));<br />
break;<br />
case DTN_FORMATQUERY:<br />
m_lbNotifyList.AddString(_T("DTN_FORMATQUERY"));<br />
break;<br />
case DTN_USERSTRING:<br />
m_lbNotifyList.AddString(_T("DTN_USERSTRING"));<br />
break;<br />
case DTN_WMKEYDOWN:<br />
m_lbNotifyList.AddString(_T("DTN_WMKEYDOWN"));<br />
break;<br />
}<br />
<br />
}<br />
The code in between the //->---- ... ... . //->-----
is added by me actully according to the theory it should display
the data in the datetime control but it displays a wrong date that
is 12 days before .
I found a solution to directly get the text from the date time control
with GetWindowText ();
but i have to parse it by my self & cannot use the direct function like GetMonth(),GetDay(),GetYear(),etc.
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
vikas amin wrote:
I found a solution to directly get the text from the date time control
with GetWindowText ();
What about calling
DWORD CDateTimeCtrl::GetTime(
CTime& timeDest
) const;
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
actually alok
I have used DateTime control as an acitveX in my MFC project.
the control is placed on on DialonBar
I got the handle to the control by using this code
CWnd* pCtrl1 = m_dlgbar.GetDlgItem(IDC_DTPICKER1);
ASSERT(pCtrl1 != NULL);
Then i tried to get the text from the Datetime control by using the
code
pCtrl1->GetWindowText (st);
but it retives not data .Do u hav any idea why
i tested this code on a Dlgbase project
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
i actully wanted to get the window text of a control
so i created a pointer to that control .
CDateTimeCtrl * pwnd =(CDateTimeCtrl *) m_dlgbar.GetDlgItem(IDC_DATE_PICKER);
now i tired to get the window text by this but
CString st;
pwnd->GetWindowText (st);
I dont understand why this dont work ..........
do u have any idea.
Yeh actuly i got the date and time by using the
pwnd->GetTime(ct);
Thank u
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
vikas amin wrote: I get everthing fine but the date retrived
is wrong.
What do you mean by "wrong?" What does the code look like?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
Thank you David
in the MSDN samples just search for floder named "cmnctrl1"
open the project and in the file "datetime.cpp" replace the function as below
<br />
<br />
<br />
void CDateTimePage::OnDTNotify(NMHDR *pHdr, LRESULT * pRes)<br />
{<br />
CTime ct;<br />
CString st;<br />
<br />
switch( pHdr->code)<br />
{<br />
<br />
case DTN_CLOSEUP:<br />
m_lbNotifyList.AddString(_T("DTN_CLOSEUP"));<br />
<br />
break;<br />
case DTN_DATETIMECHANGE:<br />
<br />
m_lbNotifyList.AddString(_T("DTN_DATETIMECHANGE"));<br />
(m_DateTime.GetMonthCalCtrl())->GetCurSel(ct);<br />
ct.GetMonth ();<br />
m_DateTime.UpdateData (TRUE);<br />
st.Format(_T(" --- %02d/%02d/%2d ---%2d"),ct.GetMonth(),ct.GetDay(),ct.GetYear(),((ct.GetDay())-12 ));<br />
m_lbNotifyList.AddString(st);<br />
break;<br />
<br />
case MCN_SELECT:<br />
m_lbNotifyList.AddString(_T("asdf"));<br />
break;<br />
<br />
case DTN_DROPDOWN:<br />
m_lbNotifyList.AddString(_T("DTN_DROPDOWN")); <br />
break;<br />
case DTN_FORMAT:<br />
m_lbNotifyList.AddString(_T("DTN_FORMAT"));<br />
break;<br />
case DTN_FORMATQUERY:<br />
m_lbNotifyList.AddString(_T("DTN_FORMATQUERY"));<br />
break;<br />
case DTN_USERSTRING:<br />
m_lbNotifyList.AddString(_T("DTN_USERSTRING"));<br />
break;<br />
case DTN_WMKEYDOWN:<br />
m_lbNotifyList.AddString(_T("DTN_WMKEYDOWN"));<br />
break;<br />
}<br />
<br />
}<br />
The code in between the //->---- ... ... . //->-----
is added by me actully according to the theory it should display
the data in the datetime control but it displays a wrong date that
is 12 days before .
I found a solution to directly get the text from the date time control
with GetWindowText ();
but i have to parse it by my self & cannot use the direct function like GetMonth(),GetDay(),GetYear(),etc.
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
vikas amin wrote: st.Format(_T(" --- %02d/%02d/%2d ---%2d"),ct.GetMonth(),ct.GetDay(),ct.GetYear(),((ct.GetDay())-12 ));
m_lbNotifyList.AddString(st);
...
but it displays a wrong date that
is 12 days before .
Do you suppose it has to do with the 12 that is being subtracted from GetDay() ?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
hi,can you tell me how to use Class matrix in VC++,and will implement so kind of operation like mulitply,contradictorily and so on
|
|
|
|
|
You can use CMatrix[^] class also , it supports all methods and operations you may need while working with matrices.
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
can you give me some examples about how to use this Class CMatrix,Thank you very much.if you can provide some program about this Class ,you will make me very happy
|
|
|
|
|
Ok I'll try to make you very happy
#1. Include the "matrix.h" file in you project
#2. Now for example if you want to add two matrices do following :
int main()<br />
{<br />
CMatrix a(3,3);<br />
CMatrix b(3,3);<br />
CMatrix c(3,3);<br />
<br />
for(int i=0;i<3;i++)<br />
for(int j=0;j<3;j++){<br />
a.SetElement(i,j,i+j);
b.SetElement(i,j,i-j);
}<br />
<br />
c = a+b;<br />
<br />
for(int i=0;i<3;i++){<br />
for(int j=0;j<3;j++)<br />
printf("%.f ",c.GetElement(i,j));<br />
printf("\n");<br />
}<br />
return 0;<br />
}
All other operations you can implement similar to this , just take a good look to the link I posted .
"Success is the ability to go from one failure to another with no loss of enthusiasm." - W.Churchill
|
|
|
|
|
Thank you dear Giorgi,it's very kind of you,you are so wonderful.as I go over
the arithmetic of CMatrix,I found some of the functions are so abstract to understand.especially,the invert arithmetic is hard to understand,can you describe its idea for me.
|
|
|
|
|
hi all
i need to read pixel values displayed in the monitor or Red, Green Blue values displayed and i need a method to write the altered pixel or color values back to the video memory so that ill be able to change the display of the monitor......... if someone out there knows answer in VC++ or in VB or in any other language for this functionality please give me some tips and ideas
Madhu
|
|
|
|
|
u need to use the low level
hardware interrupts
U can refer the yashwant kanitkars
book "Let us C"
try to fine the soft copy online
geting the pixel value from memory is
explained in last chapters of that book
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
|
With all respect to the previous replies, you certainly do not need to use assembler, and you definitely do not need to use DirectX!
Assuming you are using some Microsoft C variant, you can use the getpixel() and setpixel() functions - look them up in the help files.
To use getpixel and setpixel functions you need an hDC (handle to device context to the window or monitor), etc. Look for examples on the Microsoft MSDN site.
|
|
|
|
|
OK, some more information!
I suggest you download and have a look at the Colour Finder application, which is at http://www.codeproject.com/miscctrl/ColorFindercp1.asp[^]
To quote from the article, first a handle to the desktop device context is obtained using the API GetDCEx . This handle is then converted to a CDC class pointer using CDC::FromHandle. Then color is retrieved using the CDC method GetPixel.
I have not looked at the Colour Finder in detail, but it could be a good basis for what you want to do, and it's always easier to start with a working application, even if you throw away large bits (like tracking mouse movement, etc.) and add some bits (like changing the colour at a particular location.)
|
|
|
|
|
thanks for all your suggestions ill try em.... i tried using directX but... directX mode is initializing a blank screen and im not able to read the actual display.... ok ill try and if any one can give me some sample assembly code please get me
thanks
Madhu
|
|
|
|
|
I have kept some ActiveX like a Button,
Check Box, & DateTime Control.
i get the events for the button but not
for the datetime control i dont get any
event notification or message(windows message).
Do anyone has any idea.
thank u
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Can anybody show me how to create a program that will create a duplicate of your own program please? I can't figure it out. Maybe there's an API for this. thanx
|
|
|
|
|
benjnp wrote: I can't figure it out.
ya me too.
Every man should marry. After all, happiness is not the only thing in life.
--[v]--
|
|
|
|
|
you mean the application?
Every man should marry. After all, happiness is not the only thing in life.
--[v]--
|
|
|
|
|
duplicate of my own program ?
copy it ?
----------------------------
Jerry yu
Chinese
programming fans
|
|
|
|
|