|
Send the list a LVM_GETTOOLTIPS message to get the HWND of the tooltip control. Once you have that, you can subclass it like any other window.
|
|
|
|
|
Hi Mike,
Thanks for the reply.
The problem is, When I use that method
I'm only getting the item number in the LVN_GETINFOTIP message handler.
I'd like to get all the subitems, and MSDN only says you must use LVS_EXFULLROWSELLECT.
I'm using comctl32.dll v6 in my manifest
any ideas or articles?
Again, Thanks for the help.
P1p3r
|
|
|
|
|
Not sure if you mean the subclassing that I thought you meant, but you can read about SetWindowsHookEx and SetWindowLong API, or search for the article here in codeproject. There is one article about changing the control/dialog to show additional item, similar to what you want to do.
|
|
|
|
|
Hello gurus,
I have a quad-core machine and I'd like to know how to programmatically launch threads simultaneously (start together) on the different cores?
The program should run like this:
Core 1 -> main process creates n threads depending on the number of cores available
Core 2 -> thread1
Core 3 -> thread2
Core 4 -> thread3
...
Core n -> threadn
'->' means 'runs'
See what I mean???
How can I build such a routine? Any idea?
Thanks in advance for the help.
Best regards.
Fred.
There is no spoon.
|
|
|
|
|
Check out SetThreadAffinityMask()
|
|
|
|
|
I know this function already, but the problem is to launch the threads simultaneously, as the post suggests.
Best regards.
Fred.
There is no spoon.
|
|
|
|
|
If you've used SetThreadAffinityMask() correctly can't you wait on an event object in all the threads? Signal (set) the event to fire them off?
Mark
|
|
|
|
|
Hi guys.
I need to run some IE instance...
I used CoCreateInstance() ... it worked good but I noticed that it uses always the same exe, so in my multithreaded application it uses always the same running instance, i see in my taskmanager always the same iexplorer.exe even if i run more than one browser. Instead i need to run multiple exe, one exe for every thread. As I read on msdn CoCreateinstance uses the same instance.
So how to run a new exe when i create a new instance???
IClassFactory* oby;<br />
CoGetClassObject(CLSID_InternetExplorer,CLSCTX_ALL, NULL, IID_IClassFactory, (void**)&oby);<br />
hr = oby->CreateInstance(NULL,IID_IWebBrowser2, (LPVOID*)&WebBrowser);
I tried this code...but it doesn't work, it uses always the same exe without running a new one.
Thanx!
|
|
|
|
|
Why are after running a new exe.
I will not happen, because windows always share resources.
Creating a new instance means that you are instanciating a new object.
If just want to run two copies of the same exe why not use ShellExecute function. I think this will help.
|
|
|
|
|
thanx for you answer...
i need to run multiple instances, evenif using the com object was surely lighter on system resource...so i used shellexecute and then link to the browser...
now it's ok!
|
|
|
|
|
I have a base class from which I derive several classes. Since I pass these derived classes to many functions, I decided the best approach is to specify the base class type in the function header. Is there any way to determine the derived class from a base class pointer?
class Base
{
};
class derA : public Base
{
};
class derB : public Base
{
};
void SomeFunction( Base* base )
{
}
|
|
|
|
|
As a rule, the code in SomeFunction shouldn't care what type of derived class is passed to it. If you need specialized behavior in SomeFunction , add a virtual function to the Base class that can be overridden in the derived classes:
class Base
{
public:
virtual void Behavior();
};
class derA : public Base
{
public:
virtual void Behavior();
};
class derB : public Base
{
};
void SomeFunction( Base* base ){
base->Behavior();
}
derA A;
derB B;
SomeFunction(&A);
SomeFunction(&B);
Software Zen: delete this;
|
|
|
|
|
That's basically what I implemented, but I was just wondering if here was an easier way to do it. Thanks anyway.
|
|
|
|
|
derA* einA = dynamic_cast<derA>(base);
derB* einB = dynamic_cast<derB>(base);
if(einA) {
} else if(einB) {
} else {
}
--
Verletzen zerfetzen zersetzen zerstören
Doch es darf nicht mir gehören
Ich muss zerstören
|
|
|
|
|
Hello.
We need to use UserControl components written in C# in our existing MFC application. The components need to be inserted into existing ActiveX controls (written using MFC and ATL as separate OCX files). The recommended way is to turn on the /CLR switch and use CWinFormsControl class. Using this approach I was able to insert a simple test component into one of our ActiveX controls and successfully build the OCX in Debug mode, however when running the application I noticed that when the app tries to create an instance of the modified ActiveX control it fails with the following error: ClassFactory cannot supply requested class. The same load failure occurs even when I completely removed the test component from the ActiveX control so it seems that the failure is caused by building with the /CLR switch. I also tried to build the ActiveX's StdAfx.cpp and the cpp file containing code for the ActiveX DLL (such as InitInstance and DLLRegisterServer) without the /CLR switch but it didn't help. The control is registered properly and w/o errors (at least that's what regsvr32 shows).
We use Visual Studio 2005, any help will be greatly appreciated. Thank you.
|
|
|
|
|
Have you been successful on using a C# UserControl with an unmanaged MFC ActiveX host container?
Similar to you, we need to use a C# UserControl and expose it as an ActiveX control. As far as I can see there are some completely different approaches. One would be using an unmanaged MFC ActiveX as host container for the Windows Forms control. And then using CWinFormsDialog or CWinFormsView to host the Windows Forms control. Another approach would be to rebuild the complete ActiveX interfaces with C# and expose it directly to COM.
We tried approach one and have some major problems. We created the MFC ActiveX host container which works and currently displays an empty CDialog. Now, when turning on Common Language Runtime support (/clr), Visual Studio 2005 locks up when loading the project. 100% reproducible... turning of '/clr' everything works, turning it on VS2005 locks up while loading the project without any error message, it just hangs while loading CLR dlls like 'mscoree.dll', 'mscorwks.dll'.
Any help would be appreciated... thanks in advance!
cheers,
mykel
If they give you lined paper, write the other way!
|
|
|
|
|
In my solution I would like to have 3 projects in C++ and the following architecture:
1. Interface.
It is a DLL that has only interfaces with pure virtual functions.
Some of those interfaces should also be singletones (I need to ensure that the concrete class will be singletone).
2. Implementation.
It is another DLL that implements concrete classes for those interface classes defined in Interface DLL. The Implementation DLL will load the Interface DLL.
3. TestDriver.
This is an EXE application that will know only about Interface DLL/LIB and will NOT LOAD the Implementation DLL. It will use the Interface like this:
Interface *my = InterfaceDLLClass.GetInstance();
The GetInstance will return an object of concrete class.
In such a way I will be able to change Implementation DLL in the future without changing Interface DLL and TestDriver EXE.
Is it possible to implement such an architecture in C++?
Can you give me some advise/link?
As I understood, in Java/C# it is possible, but I need C++.
Thanks in advance.
|
|
|
|
|
I think you may have a misunderstanding about DLL's. Your interface DLL as described can't exist. A DLL contains executable code that is loaded dynamically at run-time. A set of classes that contain only pure virtual functions by definition don't generate any code, since there is no implementation.
The whole point of using a DLL is being able to replace the code in the DLL without recompiling the entire application. That's why it's called a Dynamic Link Library. This meets your requirement to change the 'implementation DLL' in the future without changing the interface.
What you end up with is a header file that specifies the 'interfaces' (the classes) implemented in the DLL, and the implementation DLL. One of the functions in the DLL can return an instance of the object implemented by the DLL, thereby enforcing the singleton requirement.
For further reference, COM in the Microsoft Windows environment provides a lot of these sorts of features in an architecture that lets your application enumerate compatible implementations. With ordinary DLL's, they have to be in a known location, and the interface signatures must match exactly. COM gives you more flexibility, but at the price of a steep learning curve.
Software Zen: delete this;
|
|
|
|
|
Thanks a lot Mr. Gary R. Wheeler,
1. I understood what you wrote, but the whole point is not to load the Implementation DLL by the TestDriver project. Is it possible that the TestDriver will be aware only about the Interfaces?
2. Another important point is that my Interfaces contain pure virtual interfaces and some implementations as well, so I could not remain them just in header files. May be I should use static lib??
3. I tried to think in the direction of templates to solve the problem, but still did not come to any conclusion.
Thanks again, Julia1.
|
|
|
|
|
I think part of our stumbling block here is the notion of an 'interface'. AFAIK in .NET (C#) and Java, an 'Interface' is a concrete, compilable language feature that specifies how two pieces of code communicate. There is no corresponding language feature in a pure C++ DLL. An 'interface' is a descriptive term only. A DLL simply provides executable code with known entry points, described either through 'C' style function signatures or as C++ classes.
If I understand correctly, what you're trying to accomplish is to have your TestDriver program load an Interfaces DLL, rather than loading an Implementation DLL directly. What I don't understand is how your Implementation DLL will ever get loaded. In your original post, you state that the Implementation DLL loads the Interfaces DLL. You then have the TestDriver program and the Implementation DLL loading the Interfaces DLL, but no one loads the implementation DLL. For the Implementation DLL to be loaded, there has to be some code, either an application that references the Implementation DLL directly, or some DLL that is uses that references the Implementation DLL.
My point in my previous post was that I don't think you don't need to have two DLL's to accomplish your goal of being able to replace the Implementation DLL at will without having to recompile the TestDriver application. Have your TestDriver application use the Implementation DLL directly; no Interface DLL is required. You can replace the Implementation DLL as needed. As long as you don't change the function signatures or class definitions for the code implemented in the DLL, this will work correctly.
I'm sorry if I'm not understanding your situation exactly. I hope this explains my earlier reply a little better.
Software Zen: delete this;
|
|
|
|
|
Hey Guys,
I know the following might sound like a silly question, but I have a project which is a Doc-View SDI MFC project. Any way a requirement has emerged which means I need to use combo boxes in the actual view window.
Does anyone have any experience at using something like this, In particular can you use a combo box in the view class of an SDI app? If so how do you incorporate it.
Looking forward to your reply.
Best Regards
Danny Nowlan
|
|
|
|
|
have you looked at CFormView?
cje
|
|
|
|
|
Since controls are just windows you can use them as a child window on any window.
An easy way is to add a CComboBox member to your window class:
CComboBox m_MyCombobox;
Add a WM_CREATE handler to the window class. In the handler call Create() for the combo box.
int CMyWindow::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CWnd::OnCreate(lpCreateStruct) == -1)
return -1;
m_MyCombobox.Create(CBS_DROPDOWN, CRect(10,10,100,15), this, IDC_MYCOMBOBOX);
...possibly populate the combo box here using AddString() etc ...
return 0;
}
This example places a 100 wide by 15 high CBS_DROPDOWN style combo box at 10,10 in the window.
You could handle WM_SIZE in the window and move the combo box in response to the user resizing the
window.
Hope this helps get you started!
Mark
|
|
|
|
|
Hey Mark,
Thanks for that mate. I implemented it and I had no errors, however the Combo box still isn't showing up. I also created a IDC_MYCOMBOX resource with the type set to child. Any ideas?
For what its worth I am dealing with a view that is derived from CView as opposed to CFormView. Is that part of my problem?
Thanks again to everyone for all their help.
Danny
|
|
|
|
|
Danny Nowlan wrote: I implemented it and I had no errors, however the Combo box still isn't showing up.
Sorry The limited example code didn't have enough style flags.
try
m_MyCombobox.Create(CBS_DROPDOWN|WS_VISIBLE|WS_CHILD, CRect(10,10,100,15), this, IDC_MYCOMBOBOX);
Calling MyCombobox.ShowWindow(SW_SHOW) would make it show as well. Useful if you want to
create it hidden and show it later I suppose.
Mark
|
|
|
|