|
this is based on Registry Setting ( Afect all windows). If the user has no right to change system settings then how it works.. ?
|
|
|
|
|
In my SDI application, I have two views, Treeview and FormView.
I placed Edit control on FormView. I have to change value of Edit control by clicking on Tree. Both are different classes.
But I am unable to access FormView Class members from Treeview. How can I do that?
void CLeftView::OnTvnSelchanged(NMHDR *pNMHDR, LRESULT *pResult)
{
CRightView *rView = new CRightView();
if(rView!=NULL)
{
rView->m_Edit1.SetWindowText(_T("ok"));
}
}
Code gives Debug Assertion Error.
|
|
|
|
|
|
You are creating new View object CRightView *rView = new CRightView();.Instead of this you should get the the attached View object.
-@SuDhIrKuMaR@-
|
|
|
|
|
Sir, I am very confused.
Please give me some example.
How do I create attached view object?
|
|
|
|
|
Try to run this code.
CFrameWnd * pFrame = (CFrameWnd *)(AfxGetApp()->m_pMainWnd);
CView* pFrmView = pFrame->GetActiveView ();
CRightView *rView = NULL;
if (pFrmView->IsKindOf (RUNTIME_CLASS (CRightView)))
rView = (CRightView *)pFrmView;
(Your Doc Class Name) * pDoc = GetDocument()
if(rView == NULL)
{
POSITION pos = pDoc->GetFirstViewPosition();
while (pos)
{
CView* pView = GetNextView (pos);
if (pView->IsKindOf (RUNTIME_CLASS (CFormView)))
{
rView = (CRightView *)pFrmView;
}
}
}
if(rView!=NULL)
{
rView->m_Edit1.SetWindowText(_T("ok"));
}
-@SuDhIrKuMaR@-
|
|
|
|
|
Now, i get this error:
Unhandled exception at 0x00530a33 in MyPrg.exe: 0xC0000005: Access violation reading location 0x1271e40a.
and control goes to:
void CWnd::SetWindowText(LPCTSTR lpszString)
{
ENSURE(this);
ENSURE(::IsWindow(m_hWnd) || (m_pCtrlSite != NULL));
if (m_pCtrlSite == NULL)
::SetWindowText(m_hWnd, lpszString);
else
m_pCtrlSite->SetWindowText(lpszString);
}
|
|
|
|
|
I had posted this earlier but no reply. Sorry for posting it again
This is how it is...
My Class is defined in newclass.h as...
Class A
{
public:
void out_func1();
void out_func2();
class B
{
public:
string path;
in_func1();
};
};
I then Get the path at intialize.cpp as follows....
void A::out_func1()
{
B obj;
obj.path="c:\folder\file1.txt";
}
Then I try to open the file to write in write.cpp...
void A::out_func2()
{
B obj;
ofstream myfile;
myfile.open (obj.path.c_str(), ios::app);
...
}
This crashes.I have included the header initialise.h too.
Please let me know were I could have gone wrong. I think I am having problem with the scope of the varible. But I am not sure.
THANKS.
|
|
|
|
|
out_func1() and out_func2() uses different instance of the class B. You should use same instance of class B in both functions.
|
|
|
|
|
Actually you got replies.
I repeat myself: no wonder your application crashes, you're passing a uninitialized path to myfile.open .
Hint: usage of locals where class member (or method parameter) should be used.
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
|
|
|
|
|
Where do you initialize the variable obj? That kept aside you don't call out_func1 that is initializign the obj variable. Initialize and use the same variables.
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
pl_kode wrote: obj.path="c:\folder\file1.txt";
Use below code,
obj.path="c:\\folder\\file1.txt";
Regards,
Paresh.
|
|
|
|
|
pl_kode wrote: myfile.open (obj.path.c_str(), ios::app);
obj has not been initialized.
"Love people and use things, not love things and use people." - Unknown
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
i created 3 property pages i am doing one of those 3 pages
i am getting like this
unresolved external symbol "public: static struct CRuntimeClass const CNSPropertyPage::classCNSPropertyPage" (?classCNSPropertyPage@CNSPropertyPage@@2UCRuntimeClass@@B)
followed by 30 LNK2001 errors
|
|
|
|
|
forgetting to link some libs ?
|
|
|
|
|
i checked but no libs missed
|
|
|
|
|
|
i created class CNSVirtualcircuitPath which is inherited from CNSPropertypage which is derived from CResizablePage
code i am writing for this page is already existing in my App i copied same code but this error is coming
|
|
|
|
|
and here i am giving some of examples
error LNK2001: unresolved external symbol "public: virtual bool __thiscall CNSPropertyPage::SkipFieldUpdate(class CString)" (?SkipFieldUpdate@CNSPropertyPage@@UAE_NVCString@@@Z)
NSPathInformationPage.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CNSPropertyPage::InitializeTagMap(void)" (?InitializeTagMap@CNSPropertyPage@@UAEXXZ)
NSPathInformationPage.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CNSPropertyPage::CreateTagMap(void)" (?CreateTagMap@CNSPropertyPage@@UAEXXZ)
NSPathInformationPage.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CNSPropertyPage::GetEditableDependentsList(class std::list<struct NSObject::ObjectDependencyInfo const *,class std::allocator<struct NSObject::Obj
ectDependencyInfo const *> > &)" (?GetEditableDependentsList@CNSPropertyPage@@UAEXAAV?$list@PBUObjectDependencyInfo@NSObject@@V?$allocator@PBUObjectDependencyInfo@NSObject@@@std@@@std@@@Z)
NSPathInformationPage.obj :
|
|
|
|
|
Did you add the .cpp file which contains the definition of CNSPropertyPage in your project ?
|
|
|
|
|
and here i am giving some of examples
error LNK2001: unresolved external symbol "public: virtual bool __thiscall CNSPropertyPage::SkipFieldUpdate(class CString)" (?SkipFieldUpdate@CNSPropertyPage@@UAE_NVCString@@@Z)
NSPathInformationPage.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CNSPropertyPage::InitializeTagMap(void)" (?InitializeTagMap@CNSPropertyPage@@UAEXXZ)
NSPathInformationPage.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CNSPropertyPage::CreateTagMap(void)" (?CreateTagMap@CNSPropertyPage@@UAEXXZ)
NSPathInformationPage.obj : error LNK2001: unresolved external symbol "public: virtual void __thiscall CNSPropertyPage::GetEditableDependentsList(class std::list<struct NSObject::ObjectDependencyInfo const *,class std::allocator<struct NSObject::Obj
ectDependencyInfo const *> > &)" (?GetEditableDependentsList@CNSPropertyPage@@UAEXAAV?$list@PBUObjectDependencyInfo@NSObject@@V?$allocator@PBUObjectDependencyInfo@NSObject@@@std@@@std@@@Z)
NSPathInformationPage.obj :
|
|
|
|
|
did u miss the IMPLEMENT_DYNCREATE() macro in the cpp file of the property page? Put the following code in your cpp file just after the #includes...
IMPLEMENT_DYNCREATE(CNSPropertyPage, CPropertyPage)
|
|
|
|
|
i think that is not the problem i added correctly as
IMPLEMENT_DYNCREATE(CNSVirtualcircuitPath, CNSPropertyPage)
|
|
|
|
|
ok.
Have you added the file that contains the class CNSPropertyPage into the project? I mean, just take the file view tab and confirm that the cpp file is listed there.
|
|
|
|
|
i properly added that .h file in header file of CNSVirtualcircuitPath
but that file is in different DLL is there any communucation problem i am getting
|
|
|
|