|
Hello,
Thanks for your reply
But I have a handler in MainFrame in OnCommand(WPARAM wParam, LPARAM lParam)
Priya
|
|
|
|
|
Have you added the ON_UPDATE_COMMAND_UI() macro in the appropriate message map?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
There are two pointers, both points on controls of type
IDC_DATETIMEPICKER.
COleDateTime* pIN = (COleDateTime*)
GetDlgItem(IDC_DATETIMEPICKER1);
The second control is on another dialog window
COleDateTime* pDest = (COleDateTime*)
(m_pParent->GetDlgItem(IDC_DATETIMEPICKER1));
The first pointer to point date ’27.05.1953’
How do with help the second pointer receive date ’27.05.1953’ ?
Thank you.
|
|
|
|
|
Is this your real code ? Because you cannot cast a CDateTimeCtrl (which is the control on your dialog) to a COleDateTime. You can't do something like that, you will end up will something totally invalid (it strange that it didn't even crash). So, cast it to a CDateTimeCtrl instead of a COleDateTime.
|
|
|
|
|
There is control on the dialog window
DDX_DateTimeCtrl(pDX, IDC_DATETIMEPICKER1, m_date);
COleDateTime m_date;
CString m_sBD;
m_sBD have format ‘dd.mm.yyyy’
for example m_sBD = L”19.05.1849”;
How do show date into control
that identifier is IDC_DATETIMEPICKER1?
|
|
|
|
|
If dd.mm.yyyy was the date format in your regional settings, you could just do this:
m_Date = COleDateTime(m_sBD);
UpdateData(FALSE);
If not, you need to parse the string yourself:
int year, month, day;
_tscanf((LPCTSTR)m_sBD, "%d.%d.%d", &day, &month, &year);
m_Date = COleDateTime(year, month, day);
UpdateData(FALSE);
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I didn't know that you could associate a COleDateTime variable with a CDateTimePicker but after testing it, it seems possible.
So, what you will need to do is set the new date in your m_date object and then update your dialog to show the changes.
The first step can be done by calling COleDateTime::ParseDateTime[^]
The second step can be done by calling UpdateData(FALSE) in your dialog class.
|
|
|
|
|
Hi,
I have a USB device (SDM modem) that uses a usb port to connect to a computer running any version of windows. I want to be able to figure out what port the device is on and read information from it. Which is the Windows API i need to use? In device manager, it gets listed with name as "USB COM Port (COMX)", where X is the COM port number available.
Thanks in advance,
SYAMLAL
|
|
|
|
|
SyamlalS wrote: "USB COM Port (COMX)"
So, your USB device is USB-to-serial device ? If yes, you will need to retrieve the COM port number from the registry (but I never did that myself , so I can't really help there), and then you can open it like any other COM port (CreateFile, ReadFile, WriteFile, ... ). Then of course you need to know the protocol that your device is using (so, what to send,...)
If it is not a virtual COM port, the procedure is a bit different.
|
|
|
|
|
Hi, I just need to know the number X in COMX. That is sufficient for me to go further. I guess, there will be APIs to fetch the number from this particular string in device manager!!
SYAMLAL
|
|
|
|
|
What about the 'trial and error' experimental approach (iterate on ports, trying to open them and start communicating with your device)? It might not work if there are bad-behaving-virtual-COM-drivers on your system, though.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
The fastest method is to read from registry -> [HKEY_LOCAL_MACHINE\HARDWARE\DEVICEMAP\SERIALCOMM]
|
|
|
|
|
Into event NM_CLICK
Of modal dialog window chose row into control CListCtrl
int row; For example row = 6;
Modeless window is opened. In event WM_LBUTTONDOWN
( on surface of modeless) set:
CMainDlg2 dlgModal; // modal
m_sWorkModeless.Format(L"row = %d",dlgModal.row);
MessageBox(m_sWorkModeless);
Result: row = 0 , but must be = 6
How to receive 6?
|
|
|
|
|
durban2 wrote: CMainDlg2 dlgModal; // modal
m_sWorkModeless.Format(L"row = %d",dlgModal.row);
MessageBox(m_sWorkModeless);
In that code sample, the modal dialog's done no work, so its row member will still be as constructed - maybe you need a dlgModal.DoModal(); before you read the row?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hello,
I have embedded an Edit box in my dialog during design time with styles 'Multiline', 'Horizontal
Scroll' and 'Vertical Scroll'.
During runtime, I set text to this edit box with SetWindowText. The set text extends the
dimensions of the edit box and so I want the text to be wrapped dynamically.
How could I achieve this ?
Note : I also tried changing the styles to 'Auto HScroll',
'Auto VScroll', etc.
Thanks in advance.
|
|
|
|
|
Remove the Horizontal Scroll bar and 'Auto HScroll' style....
|
|
|
|
|
Try calling CEdit:FmtLines(TRUE) on your control.
|
|
|
|
|
Hi All
How can i know exe is kill from task manager?I want to show message when exe is kill from task manager?Plz help me
|
|
|
|
|
Davitor wrote: How can i know exe is kill from task manager?I want to show message when exe is kill
So you want to know whether your application is forcefully closed from some other applications such as Task manager right ?
And you want to show some messages at that time ?
Try to map WM_QUIT[^] message in your application. You can display a message in the OnQuit function.
Sorry! I missed the first line in OP
Davitor wrote: How can i know exe is kill from task manager?
Please see the other posts from Superman,Rajesh and Naveen!
Any way I am very glad with this board where people are miserly giving votes for a helpful answer while very competitive in down voting for the mistakes...
modified on Tuesday, May 12, 2009 2:37 AM
|
|
|
|
|
No that wont help. When we kill an exe ( Endprocess ) from the task mamanger, it calls TerminateProcess(). And your process will not get any clue...
|
|
|
|
|
When the user is killing your app with the task manager, he really does want your app to die *immediately*. Not to show any messages, not to execute one more line of code. Therefore, Windows does not allow you to do such a thing.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|
|
If you can do it outside the app that's being killed, then you can use WMI[^].
IIRC, you need to consume[^] the __InstanceDeletionEvent[^] where the TargetInstance is the process[^] that you want to monitor.
I've done this in VBScript - it's relatively easy, but in C++ it's a bit more involved...
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
As said in some of the other posts, task manager will call TerminateProcess to kill the process.
But there is one thing I have noticed.
TerminateProcess takes an exit code as parameter.
You can retrieve this exit code using GetExitCodeProcess after the process is killed if you have the handle to the process.
And task manager always sets this to 1.
But again, any application can use TerminateProcess to kill a process and give the exit code as 1.
So, if you don't have a return 1; statement in your application entry function, you have a good chance of knowing that it was terminated using task manager.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
As an addition to my previous answer - here's some VBScript that will wait until the next time a process called "myprocess.exe" is deleted:
' Get a reference to the WMI service
Set objWMIService = GetObject("winmgmts:{impersonationLevel=impersonate}!\\.\root\cimv2")
' Open a WMI query for __instancedeletionevents where the target instance is a Win32_Process and
' the target instance's name (i.e. the process name) is myprocess.exe
Set colMonitoredProcesses = objWMIService. _
ExecNotificationQuery("select * from __instancedeletionevent " & _
"within 1 where TargetInstance isa 'Win32_Process' and " & _
"TargetInstance.Name = 'myprocess.exe'")
' This call will complete the next time a process called myprocess.exe is deleted.
colMonitoredProcesses.NextEvent
The equivalent in C++ would be quite a bit longer, but would do the same thing.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Stuart Dootson wrote: The equivalent in C++ would be quite a bit manly, ...
Fixed that for ya.
It is a crappy thing, but it's life -^ Carlo Pallini
|
|
|
|