|
The standard way to cope with the situation you describe is as follows:
class B;
class A{
...
B * ptr;
}
class A;
class B{
...
A * ptr;
}
#include "A.h"
#include "B.h"
...
#include "A.h"
#include "B.h"
...
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thanks a lot
|
|
|
|
|
hi all,
I want to get the selected text from a web page but i can't find anything to help me out..can anyone of you help and tell me what do i need to do and where to start with..
any suggestions or anything...
thanks a lot..
Himanshu
|
|
|
|
|
hello
i will have the same problem, so i think do a "copy" and "paste",i didn't find another solution, but if you find i'm very interseted
sory
|
|
|
|
|
I've embedded Word into my application.The save option of the Word is disabled when the application is run.Is it possible to save the word document from my application?
NOTE: Its something like inserting the paint brush picture in Word and saving it as document.
|
|
|
|
|
Can anyone tell me the correct way to do thread work inside COM component. Actually i am having a problem. I created a COM component. The component exposes one interface. This interface just create new thread using _beginthreadEx . So whenever client program calls this interface, the function immediately return. Now thread does something in background and then the thread function fires the event i.e call the function in client program and then thread function return.
The problem is that the client created in VB is not getting event fied from the control by its thread CAn anyone tell me the reason
|
|
|
|
|
The client must be declared like this:
Dim WithEvents client As LIB.Interface Then you must select it from the Object combo and implement the fire procedure.
rechi
|
|
|
|
|
Hi
I have a prob here as follow:
I have a SDI program based on CView.
From the program, a dialog box was called.
However from the dialog box i need to call the UpdateAllView function (which is found as a based function of CView) to update all Views of my main program.
Is it possible to do so ?? When i tried doing it i got a complier error "'CDocument::UpdateAllViews' : illegal call of non-static member function"
How can i go abt calling a CView based class function from a dialog based class ??
Thank you !!
bk
|
|
|
|
|
modify the constructor of your dialog class so that it accept a document object.. once you done that, you should be able to call updateallviews from a dialog..
something like this:
Cmydialog dialog(...,pDoc);
pDoc is the document object that you use to call updateallviews from the your dialog.
|
|
|
|
|
Hi trustnol,
firstly thanx a lot for your help ... I am quite new in C++ so i am very bad in those object kind of things... therefore i still have some doubts which i like to clarify with u ....
1. constructor is like this ??
CmyDialog dialog (CDocument *pDoc)
2. becos wat calling my dialog is the doc class of my main program ... so do i do pass the "this" pointer over to the dialog constructor ??
CABCdoc::onopen()
{
Cmydialog efg(this);
}
is this correct ???
thank you very much for your kind attention !!
|
|
|
|
|
I need a program's main window to roll up when the mouse leaves, I think the best way to do this would be with some kind of global mouse capture function but have no idea how to do this, can someone please point me in the right direction? Much Appreciated, spoonchops
|
|
|
|
|
I am not sure if this works... but how about this:
void CMyControl::OnLButtonDown(UINT nFlags, CPoint point)
{
CStatic::OnLButtonDown(nFlags, point);
SetCapture();
}
void CMyControl::OnMouseMove(UINT nFlags, CPoint point)
{
DoStuff();
CStatic::OnMouseMove(nFlags, point);
}
void CMyControl::OnLButtonUp(UINT nFlags, CPoint point)
{
ReleaseCapture();
CStatic::OnLButtonUp(nFlags, point);
}
I assume here your control is derived from CStatic.
|
|
|
|
|
Well that's great but it's actually the implementation of the SetCapture() and ReleaseCapture() functions I was after as it were....
|
|
|
|
|
If you want to know when the control has been left you can use the message handler: LRESULT OnMouseLeave(WPARAM wParam, LPARAM lParam) in the parent window of your control.
Hope this helps...
|
|
|
|
|
oops sorry man. I did misread "when the mouse leaves" as "when the mouse moves".
time for a :coffee:
|
|
|
|
|
You need to make use of TrackMouseEvent. The trick is that entering one of you dialogs child windows will also trigger this, so you will need to do a GetCursorPos() and WindowFromPoint() and then see whether the window with the mouse in it is a child of your dialog. If it is, you then need to retrack the mouse event again, until it leaves the child window and enters/leaves all the windows of your dialog. At the point where its not in your dialog or a child of your dialog you can then roll up your window.
Its a bit difficult to get right (we did it here). The above bit was the hardest bit to get working correctly.
Roger Allen
Sonork 100.10016
WHats brown and sticky?
A stick or some smelly stuff!
|
|
|
|
|
Thanks Roger, that's exactly what I was looking for
|
|
|
|
|
I want to implement a "plug-in" style system where the plug-ins are derived classes based on a pure virtual base class in my application:
Application:
class CPlugInBase<br />
{<br />
public:<br />
virtual int DoSomething() = 0;<br />
int Calculate(int a, int b) {...}<br />
};
DLL:
class CPlugIn : public CPublicBase<br />
{<br />
virtual int DoSomething() {...Calculate(1,2);...}<br />
};
The CPlugIn class overrides a few virtuals in the base class, and also needs access to other methods in the base class.
An extra wrinkle is that I would actually like to be able to do this:
Application:
class CPlugInBase<br />
{<br />
virtual int DoSomething() = 0;<br />
};<br />
<br />
class CSpecialPluginBase : public CPlugInBase<br />
{<br />
virtual int DoSomething() { DoPart1(); return DoPart2();}<br />
virtual void DoPart1() = 0;<br />
virtual int DoPart2() = 0;<br />
};
DLL 1:
class CPlugIn : public CPublicBase<br />
{<br />
virtual int DoSomething() {...}<br />
};
DLL 2:
class CSpecialPlugIn : public CSpecialPlugInBase<br />
{<br />
virtual void DoPart1() {...}<br />
virtual int DoPart2() {...}<br />
}
where the CSpecialPlugInBase might override the virtuals from CPlugInBase , and then define new pure virtual functions that the CSpecialPlugIn class would have to override while still allowing access to members of both base classes.
Is this do-able in VC++ 6?
Thanks
-robin
|
|
|
|
|
rex666 wrote:
Is this do-able in VC++ 6?
Absolutely.
The nice thing is that since your CPlugInBase and CSpecialPluginBase classes are abstract, they won't really be part of any module (application or DLLs). In other words, they can just be placed inside a header file and then be shared among all the modules that use it.
Don't forget to add a pure virtual destructor to the CPlugInBase class. You can just leave it empty and implement it right where it's declared:
virtual ~CPlugInBase() { }
Regards,
Alvaro
All you need in this life is ignorance and confidence, and then success is sure. -- Mark Twain
|
|
|
|
|
What if there are extensive other methods in the base classes? Do I have to inline everything? Are there consequences of having a massive amount of inline code in the base class?
I had the example with one other method, but what about having a whole API available through the base class for the plug-ins to interact with the main program? Or would it be better to put that API somewhere else?
Thanks
-robin
|
|
|
|
|
If there's massive amounts of code in your base class, then it's best to build it into one module, so that it's easier to maintain -- when it comes time to change something, all you need to rebuild is that one module.
In your case, you can certainly go with putting the code for the base class inside the application (EXE) and exporting the class. That will generate a LIB file which you can then use when linking your DLLs. Thus, your DLLs will depend on the EXE and your EXE will depend on the DLLs -- a mutual dependency. Since your EXE is already running when it loads the DLLs, the DLLs will just use the base class code right out of it and they won't load another version of the EXE.
I've done this myself in the past and it's worked great. Instead of putting the code for the base class into yet another DLL (which is another option), you can just export it right out of the main app.
Regards,
Alvaro
All you need in this life is ignorance and confidence, and then success is sure. -- Mark Twain
|
|
|
|
|
I've got some binary data (hex represented).
I've got the values
01 ae
90 3d
and I want to convert these to a string representation in ATL with Minimial additional libraries involved
"AE01"
"3D90"
Is there a simple way to do this, or should I just import stdio etc?
|
|
|
|
|
str.Format("%.02X",bit[i])
-----------------------------
Mr.Whelk
-----------------------------
Zhuhai City ,Guangdong ,China
|
|
|
|
|
When I try to include a ressource item in my project.
I have a error that tell me that afxres.h cannot be found?
I use MFC with VS.net.
Any ideas?
Everything is beautiful if you look at it long enough...
|
|
|
|
|
check resource(!) include path
|
|
|
|