|
Is it possible that your control is a 'time only' control (check the dialog properties Styles/Format)? According to the docs, you will get an assert trying to access the date members in debug mode. Otherwise you need to set the style in the Create function.
Steve
|
|
|
|
|
No, I have it setted as 'short date' style. Can you give me an example code as you have initialized it?
Thanks
|
|
|
|
|
in the View Class:
...
CDateTimeDlg dlg;
CTime timeNewDateTime;
dlg.m_DateTime = CTime::GetCurrentTime();
if(dlg.DoModal() == IDOK)
timeNewDateTime = dlg.m_DateTime;
======================
in the CDateTimeDlg class:
in the .h file:
...
public:
CDateTimeDlg(CWnd *pParent = NULL);
CTime m_DateTime;
enum { IDD = IDD_DATETIME_DLG };
CDateTimeCtrl m_cDateTime;
in the .cpp file:
...
void CDateTimeDlg::DoDataExchange(CDataExchange* pDX)
{
CDialog::DoDataExchange(pDX);
DDX_Control(pDX, IDC_DATETIME, m_cDateTime);
}
BEGIN_MESSAGE_MAP(CDateTimeDlg, CDialog)
ON_NOTIFY(DTN_DATETIMECHANGE, IDC_DATETIME, OnDatetimechangeDateTime)
END_MESSAGE_MAP()
...
BOOL CDateTimeDlg::OnInitDialog()
{
CDialog::OnInitDialog();
m_cDateTime.SetFormat("MM/dd/yyyy HH:mm:ss");
m_cDateTime.SetTime(&m_DateTime);
return TRUE;
}
void CDateTimeDlg::OnDatetimechangeDateTime(NMHDR *pNMHDR, LRESULT *pResult)
{
m_cDateTime.GetTime(m_DateTime);
*pResult = 0;
}
Steve
|
|
|
|
|
Thank you, very much.
I'll try it.
|
|
|
|
|
It works fine in debug mode, also.
Thanks!!!!
|
|
|
|
|
Happy to have helped you solve your problem.
Steve
|
|
|
|
|
Is there an easy way to access controls fron another applications dialog? I need the ability to pick up data from an application that runs concurrently with my app, however I'm not the author of the other application. I'd like to be able to find the control field ID's and pickup what the user keyed, and dump that data into my application to save key strokes (ie. Name, Address, City, State, Zip).
|
|
|
|
|
The best thing to do would be to write a hook DLL and inject it into that applications address space for hooking the messages if you want to save keystokes and such like that. I wouldn't suggest doing this though unless you are very experienced. Another alternative is to use FindWindow() to find the dialog, then use GetWindow() with the GW_CHILD option until you find the specific control. Once you find that control, call SendMessage() on that HWND and send the WM_GETTEXTLENGTH and WM_GETTEXT messages to get the window text from it.
-- Rocky Dean Pulley
|
|
|
|
|
Thanks Rocky, I'll give this a try.
|
|
|
|
|
I have dialog based application with menu. The problem is that after starting the application the menu is drawn by dark color, not black until I move the window outside the screen and back or force the repaint by another way.
The menu is working, it's not disabled and the font does not have gray shadow effect like disabled menu items.
Any idea why ? (Tested on Win XP and Win 2000)
Thank you.
rrrado
|
|
|
|
|
How are you implementing the Menu? Are you using a CMenu creation directly, or did you use a resource?
|
|
|
|
|
Is there anyway to insert a CButton control in a CListCtrl cell.
Thanks in advance,
Ron
|
|
|
|
|
There is always a way, but it doesn't seem practical for a CListCtrl. What you probably want is to use some type of grid control instead. There are a lot of them on this site and I think most of them support embedded controls.
-- Rocky Dean Pulley
|
|
|
|
|
Thanks for the reply. I'll look at one of the grid controls. I was just trying to save an existing app.
Thanks again,
Ron
|
|
|
|
|
hello , i am a new vc++ programmer , i want to create an xml file using msxml3.0 in vc++.
THe msdn code i had used , but i receive several errors in that.
error C2872: 'IXMLDocumentPtr' : ambiguous symbol
error C2065: 'IDOMDocumentPtr' : undeclared identifier
error C2065: 'myDOMPtr' : undeclared identifier
error C2228: left of '.CreateInstance' must have
Error executing cl.exe.
Can i need have the proper code 4 that.
Rahul Agarwal
|
|
|
|
|
Hi Rahul,
Please Check that you correctly imported msxml3.dll in your project or not.
Please post your COM related query in there specialized forums for COM[^] and forATL[^] , as there you can find programmer which are specialized in COM/ATL and they help you to sort out your query more quickly
OK
"I Think this Will Help"
<h5
alok gupta="" <br=""> visit me at http://www.thisisalok.tk
|
|
|
|
|
for example i have such string C:\asdf\fdsa
I want to check out if they exist, if not then create them
|
|
|
|
|
|
There is a fundamental problem with only using the _access method described earlier, it is POSSIBLE that you are looking at a FILE with the name 'fdsa' in the 'asdf' folder! You should ALWAYS verify that it exists AND it is a directory, if that is your true requirement!
<br />
DWORD dwAttributes = GetFileAttributes("C:\\asdf\\fdsa");<br />
<br />
if( dwAttributes != (DWORD)-1 ){<br />
<br />
if( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ){<br />
} else {<br />
}<br />
<br />
} else {<br />
<br />
dwAttributes = GetFileAttributes("C:\\asdf");<br />
<br />
if( dwAttributes != (DWORD)-1 ){<br />
if( dwAttributes & FILE_ATTRIBUTE_DIRECTORY ){<br />
} else {<br />
} <br />
} else {<br />
}<br />
}<br />
...and you wanted to write robust software...
|
|
|
|
|
bool dirExists
(CString strDirectory)
{
TCHAR* fullPath = _tfullpath (NULL, strDirectory, 0);
if (fullPath == NULL)
return (false);
TCHAR szCurrDir [_MAX_PATH];
_tgetcwd (szCurrDir, _MAX_PATH - 1);
long nStatus = _tchdir (fullPath);
_tchdir (szCurrDir);
free (fullPath);
if (nStatus == 0)
return (true);
return (false);
} /ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
|
hi,
can any one help me in adding a new display mode in Win98...like iwant to add a reverse mode like say 600 x 800 ,I did the changes in the registry but the change is not seen the right click \ properties \settings \..the slider to change the the resolution......
I was able to do it in Win2k by setting the mode prunning to 1...
is there any way for win98...ist really making me crazy for the last two days...
Any help would be gratefully appreciated...
thnx in advance..
udaykumar
|
|
|
|
|
hai all,
i want to no how to pack all my bitmap images into a dll by using Visual C++6.0,
do i need to follow any specific steps...
regards
expl
|
|
|
|
|
vc++ 6.0->Insert->Bitmap->Import
suhredayan There is no spoon.
|
|
|
|
|
I use a datagram socket to receive UDP message. Now a new requirement is to automatically reply to the messages senders. Application messages doesn't containt the IP address and the Port of the sender. How can I know who have I to reply ? Is it possible to retrieve the sender information with low level functions ? or have I to use a RAW socket ?
Thanks a lot.
|
|
|
|