|
DavidCrow wrote: CPropertyPage is already derived from CDialog .
AFAIK, that's been the case at least since VC6/MFC4.2.
I had to create classes derived from both, since I wanted to make services transparently available to both dialog and property page handlers. There isn't a simple way to inject your code into the inheritance chain between CPropertyPage and CDialog . For that reason, I've got this:
class GalaxyUI_Dialog: public CDialog, GalaxyUI_Form {
};
class GalaxyUI_PropertyPage: public CPropertyPage, GalaxyUI_Form {
}; where the GalaxyUI_Form class has the common elements.
The only thing that's a little odd-looking are the message handlers. For example:
void GalaxyUI_Dialog::OnSize(UINT nType,int cx,int cy)
{
CDialog::OnSize(nType,cx,cy);
GalaxyUI_Form::OnSize(nType,cx,cy);
} Sometimes the derived classes call their 'base' class only, the form class only, or both.
Software Zen: delete this;
|
|
|
|
|
See here[^].
My favorite quotation: People quite correctly say that you don't need multiple inheritance, because anything you can do with multiple inheritance you can also do with single inheritance. You just use the delegation trick I mentioned. Furthermore, you don't need any inheritance at all, because anything you do with single inheritance you can also do without inheritance by forwarding through a class. Actually, you don't need any classes either, because you can do it all with pointers and data structures. But why would you want to do that? When is it convenient to use the language facilities? When would you prefer a workaround? I've seen cases where multiple inheritance is useful, and I've even seen cases where quite complicated multiple inheritance is useful. Generally, I prefer to use the facilities offered by the language to doing workarounds.
|
|
|
|
|
I've worked on projects that make use of multiple inheritance, and, like any tool, it can be or a good and a bad thing depending on the context. Probably the most common usage in C++ is in implementing interfaces: in C++ you need to use multiple inheritances to implement multiple interfaces or even to implement one if you’re also deriving from another class in addition to implementing the interface. In C# you don’t use multiple inheritance to implement interfaces so this is not an issue. Another common use of multiple inheritance is to use mixins[^].
Steve
|
|
|
|
|
MI is nice for implementing functionality where the the "is a" or "has a" relationship doesn't really exist, it's more like "I can do this and this is how I do it" type relationship.
I've used it quite a bit in programming custom controls, to let objects describe various aspects of themselves, like how they paint themselves, resize, move, etc. There's a lot of internal handshaking, but MI is a very powerful tool in this respect.
- S
50 cups of coffee and you know it's on!
|
|
|
|
|
Steve Echols wrote: MI is nice for implementing functionality where the the "is a" or "has a" relationship doesn't really exist, it's more like "I can do this and this is how I do it" type relationship.
A nice description. These are called mixins but the way you've explained it is more useful than name-dropping.
Steve
|
|
|
|
|
What you dewscribe here ist exactly how I have always used Multiple Inheritance (only seldom) apart from inheriting pure abstract interfaces.
It is about the same thing Stephen Hewitt mentions as 'mixins'. MI is how it is done in C++ and just because Java (and Microsofts second implementation of it, C#) give it a different name, it is not wrong.
I don't understand the wailing of the Java-Fanboys about C++ using this feature.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
I'm trying to find a solution to a little problem that involves being able to decode any type of media and save it into a wave-file.
Of course, this is done through DirectShow. I've actually tried this, but it doesn't seem to work.
I have a simple AVI-source, which I convert to matroska using mkvmerge.
Anyway, the file contains a video tracks and a audio track (MP3).
So I use Haali's Media Splitter, FFDShow, WavDest and File Writer, in that order. But the output audio file seems corrupted since it won't play!
Connecting an audio rendered after FFDShow plays the audio perfectly fine and clear.
I have no idea what can be wrong here, so if anyone has any idea or an alternative suggestion, please indulge me.
Thanks.
|
|
|
|
|
Hi,
During the setup of my application (using wise installation system) I am installing several files to c:\ProgramData.
During the runtime of the application I have to make changes to the content of those files - however for some reason it can be done only if I run the application as administrator.
Strangley though if I delete those files and install them again - this time not as an administrator - the problem disappear. However those files must be installed during the application setup (which runs with administrator priviliges)
I will appriciate any comments regarding this issue.
Eran
|
|
|
|
|
You are creating the files as an administrator but trying to modify the content as a normal user?
Under Vista's file security scheme, each file/folder is assigned an ACL, from your installer you need to make sure that you add users to the ACL's as the default would be for administrators. Luckily, vista has a tool to do this for you, "icacls.exe".
I will leave you to find out how to use it.
Waldermort
|
|
|
|
|
Thanks Waldermort, you have been a great help!
|
|
|
|
|
Sorry for distrubing all.
i have to create communication Between modem and Pc through RS-232.
1)i created a port along with activeX(microsoft Communication control, version 6.0)control.it works well and opened the serial port.
2)my dialoge box is having all port configaration controls(like hyperterminal) and after that two edit boxes one for commands to modem,after that submit button.
next there will edit box for responces for Modem.
3)iam not able to create thread for communication b/w pc and modem. which fuctions i have to call.pls anybody help
4)iam successfully completed the communication B/w two sys by RS-232 port.
here is the thread where i used in Communication b/w in two sys
<code>
UINT ReaderThread(LPVOID lParam)
{
CString strCount;
VARIANT vtResult;
CString str,str1;
CSerialcomDlg* m_wnd = (CSerialcomDlg*)lParam;
while(1)
{
int nCount = m_wnd->m_CommControl.GetInBufferCount();
if(nCount > 0)
{
strCount.Format("%d",nCount);
for(int i = 0; i< nCount;i++)
{
vtResult = m_wnd->m_CommControl.GetInput();
str.Format("%s",(LPCSTR)(_bstr_t)vtResult);
str1 = str;
}
m_wnd->m_edtrecvdata.SetWindowText(str1);
}
}
return TRUE;
}
</code>
|
|
|
|
|
I suggest using the search[^] page here on Code Project, and enter 'serial' as the keyword.
Software Zen: delete this;
|
|
|
|
|
krishna Vuppala wrote: 3)iam not able to create thread for communication b/w pc and modem. which fuctions i have to call.
To get started with multithreading and avoid common pitfalls, read this[^]. In my opinion the very best starting point for multithreading.
When you've read the article above and understood it, you'll face a new problem: since you're using an ActiveX control and want to access it from different threads, you need to know how to cross apartment boundaries the right way using marshalling. Read Lim Bio Liong's excellent article series starting here[^].
Writing the serial communication part by yourself, not using the MSComm control, isn't that hard really.
Have a look at Joe Newcomer's article here[^].
"It's supposed to be hard, otherwise anybody could do it!" - selfquote "High speed never compensates for wrong direction!" - unknown
|
|
|
|
|
Dear All
In one multi threaded program an unknown bug is detected merely which results in program exit.
We use Dr Watson to catch the reason of this exception but no reson is logged in Dr Watson log file.
any way
do you know :
1. What kind of exceptions is not detectable by Dr.Watson program ?
2. Do you know any other reason for program exit by windows ?
3. Do you know any third party program which can help us to detect the reason of this failure.
some points about our program :
1.Our program is a Server program which works with USB port to read and write voice data from a hardware.
2. This program sends and receives data on a LAN to other computers.
3. We use windows 2K sp4 OS.
4. Some DLLs of program is written with msvc 6 but main program is written with msvc 7.
If you have any idea please let me know.
Thanks in advance
Monhi
|
|
|
|
|
There are some activeX controls on my dialog, and I want to get the ID of the activeX control that has the keyboard focus.
I use the function:
GetWindowsLong(::GetFocus(), GWL_ID),
But the return value is always 0.
I put the fuction GetLastErr() after it, but the return value is ERORR_SUCCESS.
Did I use the wrong fuction? And is there any other way to get the Id?
Thanks!
|
|
|
|
|
I have noticed that active-x are always created with id 0. Use Spy++ and check the ID.
|
|
|
|
|
Naveen.R wrote: I have noticed that active-x are always created with id 0. Use Spy++ and check the ID.
I don't believe this is reliable. Also note that ActiveX controls need not even have a window.
Steve
|
|
|
|
|
Stephen Hewitt wrote: I don't believe this is reliable
I just said my findings. If you show me a sample which have a active-x control id other than 0, I am ready to change the statement.
|
|
|
|
|
I inserted the “Microsoft Office Chart 10.0” control into the “ActiveX Control Test Container” then used "Spy++" to scope out the IDs -- no zeros to be seen! Your advice relies on implementation details of the controls in question.
Steve
|
|
|
|
|
Stephen Hewitt wrote: I inserted the “Microsoft Office Chart 10.0” control into the “ActiveX Control Test Container” then used "Spy++" to scope out the IDs
Ya u r right... Its an ATL active-x isnt it. when I chacked other ATL activex's, it also have have ID. But many other non ATL active x, the ID 0, like Calender,Micorsoft Form 2 controls( For those having windows ).
I have tried specifying the control id while creating the control. In such cases also Id is coming as 0. May be as you said its the implementation difference of control. But offcourse I think this is not under our control.
Do you think its the implementation differece of ATL Active X and MFC Active x?
|
|
|
|
|
Naveen.R wrote: Do you think its the implementation differece of ATL Active X and MFC Active x?
Both ATL's and MFC's hosting and control implentation details differ.
But this line of reasoning is missing the point: If you’re manipulating an ActiveX control you should manipulate it via the OLE control interfaces if possible and be weary of directly manipulating it’s window; windowless controls need not even have windows! One of the main goals of ActiveX control is to isolate clients of the implementation details of the control. ATL allows you to treat the control as a window but the window you manipulate is part of the hosting code and not part of the control: it handles messages and translates them into interface calls on the control. See the OnSize function in the "ATLHOST.H" file for an example.
Steve
|
|
|
|
|
Sorry I dont know much about ATL. May be we can focus on MFC..
What my doubt is that, when ever I create a MFC activex and add it to some applications, the control id is 0. Why this comes so? MFC ignores those ID's? ( Not only MFC activex but the activex like microsoft form 2 control also have same behavior )
|
|
|
|
|
The axtiveX I used was "Microsoft Forms 2.0 OptionButton", and I created it in the MFC application....
But in the Resource.h file the activeX control has the id which is not 0.
|
|
|
|
|
Can you tell me y u need the id of the control?
As i told earlier, that "Microsoft Forms 2.0 OptionButton" active x will be created with out an id. But MFC internally keeps the id of the control. check the COleControlSite::FindItem function() for more details.
|
|
|
|
|
hi,
i have created a new desktop and i successfully switched in to that destop. But any of windows shortcuts not working on my new desktop.ie, if i press Ctrl+Alt+Del the taskmanager executes on default desktop.
how can i solve this problem ? some one please help me.
Thanks & Regards
|
|
|
|