parameter of function
-
my function f_my() receive identifier of control, for example IDC_DATETIMEPICKER1 How do set type of argument? And how this function to call for execution? As show - unproperly: error C2660: 'GetDlgItem' : function does not take 1 arguments void CADO_MDIApp:: f_my (long identifier) { COleDateTime* p1 = (COleDateTime*) GetDlgItem(identifier); }
-
my function f_my() receive identifier of control, for example IDC_DATETIMEPICKER1 How do set type of argument? And how this function to call for execution? As show - unproperly: error C2660: 'GetDlgItem' : function does not take 1 arguments void CADO_MDIApp:: f_my (long identifier) { COleDateTime* p1 = (COleDateTime*) GetDlgItem(identifier); }
durban2 wrote:
COleDateTime* p1 = (COleDateTime*) GetDlgItem(identifier);
You are trying to call
GetDlgItem()
which resides in the global namespace (sinceCADO_MDIApp
is not derived fromCWnd
). That version requires 2 arguments. Why are you wanting to do this? The application object should not need to know about controls on a dialog."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
-
my function f_my() receive identifier of control, for example IDC_DATETIMEPICKER1 How do set type of argument? And how this function to call for execution? As show - unproperly: error C2660: 'GetDlgItem' : function does not take 1 arguments void CADO_MDIApp:: f_my (long identifier) { COleDateTime* p1 = (COleDateTime*) GetDlgItem(identifier); }
durban2 wrote:
my function f_my() receive identifier of control, for example IDC_DATETIMEPICKER1 How do set type of argument?
Maybe an
int
.durban2 wrote:
As show - unproperly: error C2660: 'GetDlgItem' : function does not take 1 arguments void CADO_MDIApp:: f_my (long identifier) { COleDateTime* p1 = (COleDateTime*) GetDlgItem(identifier); }
GetDlgItem
function takes actually2
parameters [^]. Possibly you want to callCWnd::GetDlgItem
method. :)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] -
my function f_my() receive identifier of control, for example IDC_DATETIMEPICKER1 How do set type of argument? And how this function to call for execution? As show - unproperly: error C2660: 'GetDlgItem' : function does not take 1 arguments void CADO_MDIApp:: f_my (long identifier) { COleDateTime* p1 = (COleDateTime*) GetDlgItem(identifier); }
In addition to what the other said and to remind you what I told some hours ago, GetDlgItem returns a pointer to a CWnd derived object. COleDateTime doesn't inherit from CWnd, so it is a completely different object. So, you can't cast your control to a COleDateTime object and expect everything to work. And as I said David, why are you delegating that stuff to your application class ? Your dialog class should be responsible to manipulate its control, the application class has nothing to do with that.
Cédric Moonen Software developer
Charting control [v2.0] OpenGL game tutorial in C++