|
int main()
{
DerivedChild cChild(9);
cChild.Base::Identity();
cChild.Identity();
return 0;
}
You can use both, you would be in trouble if both base classes had Identity as protected because in that case you could put only one of them into to the public namespace of the DerivedChild class.
|
|
|
|
|
hi every body
i am trying to retrieve a single value from Adodc into EditBox
here i got an error :-
m_edit1=m_adodc1.GetRecordset().GetField().GetItem("StockName");
where "StockName" field of names in my table "Stocks"
the error :- binary : '=' no right side takes class tagVariant , or no convertion available
im working with "visual c++ 6 / mfc" dialog based project
thank you in advance .
|
|
|
|
|
What is m_edit1 ?
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
m_edit1 is a member variable for the EditBox , EditBox is one of the tools which used in Dialogs it has the class CEdit , EditBox in visual C++ is similar to textbox in visual basic
|
|
|
|
|
I think the question was, whether m_edit1 is a control member (i.e. CEditControl) or a data member (CString). In the former case you would need m_edit1.SetWindowText(content) to display the content.
In any case you need to extract (or convert to) a CString from the variant that you have as input.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
an example would clear the case
thanx .
|
|
|
|
|
If m_edit1 is a data member it would be something like that.
m_edit1=m_adodc1.GetRecordset().GetField().GetItem("StockName").GetString();
If m_edit1 is a control member it would look like that instead.
m_edit1.SetWindowText(m_adodc1.GetRecordset().GetField().GetItem("StockName").GetString());
In both cases GetString() is a placeholder for the function to extract a String representation from the tagVariant. You should check the documentation (or intelli sense) for the correct function name.
The good thing about pessimism is, that you are always either right or pleasently surprised.
|
|
|
|
|
i made it ,,, partially !!
to inform you about my mdb file :-
its name (inventory.mdb)
it hase one table (Stocks)
the fields are (StockName,StockID,...)
now i can extract values from only the "StockName" which its string values
by the following code in button click :-
m_ado.SetRecordSource ("SELECT * FROM Stocks");
m_ado.Refresh ();
C_Recordset m_Record = m_ado.GetRecordset ();
COleVariant var1;
var1.vt = VT_I2;
var1.iVal = 1;
COleVariant value = m_ado.GetRecordset().GetFields().GetItem(var1).GetValue ();
m_edit = value.bstrVal;
UpdateData (FALSE);
how to extract the other values such as "StockID" which its integer or any other fields ?
thanx .
|
|
|
|
|
coolerfantasy wrote:
how to extract the other values such as "StockID" which its integer or any other fields ? See if this article is of any use.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
thank you and thanx to all those posting my Question
its solved ..
|
|
|
|
|
Hi,
I am using Googletest(gtest-1.6.0) for Unit testing activity for C++\VC++ code. Here i'm using microsoft Visual studio 2010. There is inbuild Codecoverage facility in MSVisualStudio 2010. I didn't find a way yo configure gtest framwork in visual studio to generate Codecoverage report. I mean any project setting required for the same.
Please guide me soon.Thanks
|
|
|
|
|
|
Hi All,
I would like to monitor my application memory usage when it runs outside the debugger (VS2008). How can I do it?
The best I can think of is to use some kind of a windows port of SAR utility from Linux to see what was the system memory state before I launched the program and what was the system memory state after I closed the program.
I am talking about an MFC GUI application.
Thanks!
modified 30-Sep-13 2:03am.
|
|
|
|
|
See here before you get too far into this.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
Thanks David for the prompt reply.
Unfortunately my question was not clear nor complete...
What I meant was that I need to verify that memory is cleaned after app is closed.
So I'd like to check the system free memory before I started the app and after I closed it, and this way to know if all the allocated memory was cleared.
|
|
|
|
|
dushkin wrote: What I meant was that I need to verify that memory is cleaned after app is closed. It is, whether you want it to be or not.
"One man's wage rise is another man's price increase." - Harold Wilson
"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
"Show me a community that obeys the Ten Commandments and I'll show you a less crowded prison system." - Anonymous
|
|
|
|
|
dushkin wrote: What I meant was that I need to verify that memory is cleaned after app is
closed. So I'd like to check the system free memory before I started the app
and after I closed it, and this way to know if all the allocated memory was
cleared.
Emphasizing the previous response - that is always true regardless of what your application does.
When the application stops, except for some exotic resources, all resources are cleaned up. Memory (all of it) is released, files are closed, sockets are closed, UI specific resources are closed, etc, etc, etc.
|
|
|
|
|
|
|
I have a single document frame window with multiple views and I'm trying to add a view that contains a splitter window.
For this new view I have created a base CView that contains a CSplitterWnd . The splitter has one row, and two columns. The left column is a CTreeView derivative, and the right column is a CView derivative that contains a CMFCPropertyGridCtrl .
When the program switches to this new view, it is totally blank with no splitter bar or child views. What have I failed to do to get the splitter view to display correctly? Is it valid for a CSplitterWnd to be hosted inside a CView ?
This is the code inside the base CView that creates the splitter:
int CGSFeaturesView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CView::OnCreate(lpCreateStruct) == -1)
return -1;
Splitter.CreateStatic(this, 1, 2);
CCreateContext Context;
Context.m_pCurrentDoc = GetDocument();
Splitter.CreateView(0, 0, RUNTIME_CLASS(CGSFeatureTreeView), CSize(0,0), &Context);
Splitter.CreateView(0, 1, RUNTIME_CLASS(CGSFeaturePropertyView), CSize(0,0), &Context);
Splitter.SetColumnInfo(0, 300, 200);
Splitter.SetColumnInfo(1, 300, 200);
Splitter.SetRowInfo(0, 1000, 200);
return 0;
}
This is the code inside the CWinApp that switches views: (Taken from the MSDN example that shows how to create multiple views for a single document)
void CGSApp::SwitchToView(CView* pNewView)
{
CView* pActiveView = ((CFrameWnd*) m_pMainWnd)->GetActiveView();
UINT temp = ::GetWindowLong(pActiveView->m_hWnd, GWL_ID);
UINT temp1 = ::GetWindowLong(pNewView->m_hWnd, GWL_ID);
::SetWindowLong(pActiveView->m_hWnd, GWL_ID, temp1);
::SetWindowLong(pNewView->m_hWnd, GWL_ID, temp);
pActiveView->ShowWindow(SW_HIDE);
pNewView->ShowWindow(SW_SHOW);
((CFrameWnd*) m_pMainWnd)->SetActiveView(pNewView);
((CFrameWnd*) m_pMainWnd)->RecalcLayout();
pNewView->Invalidate();
}
Thank you for reading my question.
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
The CSplitterWnd should be the main client of your frame window, and the views are then placed in the panes of the splitter, as far as I recall - it's a few years since I used MFC.
Veni, vidi, abiit domum
|
|
|
|
|
Richard MacCutchan is right.
Splitters and Views need to be created in the frame class.
Place the code in the OnCreateClient method of the frame class and it should work.
A context object pointer is also available as a parameter to OnCreateClient that you can use in the call to CreateView .
|
|
|
|
|
«_Superman_» wrote: Place the code in the OnCreateClient method of the frame class and
it should work.
Can I still switch among multiple views if I create the splitter inside OnCreateClient ?
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|
|
Yes but your views need to be shown inside a pane of the splitter.
Veni, vidi, abiit domum
|
|
|
|
|
I see what you mean. I created a test application with the MFC application wizard just to see how they use the CSplitterWnd .
And what they do is they put the splitter window as a member of the main form, NOT the view. This implies that the splitter does its thing over every view that gets displayed.
Apparently you can't just put the splitter on certain views.
Thanks for your input!
The difficult we do right away...
...the impossible takes slightly longer.
|
|
|
|