|
I have an ATL ActiveX DLL control & in Internet Explorer, on an XP system with themes enabled - any dialogs that my control displays do not have any themes active!
I've themed my EXE projects before with no issues. (manifest resource type=24 id=1, InitCommonControls, comctl32.lib, ect..).
But for some reason when I apply the same modifications to my DLL - it doesn't work.
The dialogs that I display from the control have a themed non-client area (the caption & 'x' close button), but the dialog client controls are not themed.
I attempted to use the theme library (uxtheme.dll) to force the themeing of the dialog & its child controls, but that failed horribly (probably from a lack of understanding the theme lib), the best(???) I was able to accomplish is the removing of the theme from the non-client area.
Does any one know why my control's dialog doesn't show up as being themed in IE??
Thanks
|
|
|
|
|
|
I think I'm missing something else. I tried resource id's 1-16 for my manifest file & it still didn't work
So as a sanity check I created to following quick ActiveX project in DevStudio6SP5
* File>New>Projects>ATL COM AppWizard
* DLL Project, nothing checked, finish
* Insert>New ATL Object,Category "Controls", Full Control
* ATL Object Wizard Properties > ShortName = TestBob, left everything else as default
* Add a WM_LBUTTONDBLCLK handler that displays a simple MessageBox
OR if you're lazy & don't want to double click all the time...
* Add a Button control to the window in your WM_CREATE handler (be sure to enable m_bWindowOnly)
* Added a manifest resource, type 24, id=2
* Added ComCtl32.lib to the linker
* In the constructor, added AtlInitCommonControls(ICC_WIN95_CLASSES|ICC_DATE_CLASSES|ICC_USEREX_CLASSES|ICC_COOL_CLASSES|ICC_INTERNET_CLASSES|ICC_PAGESCROLLER_CLASS|ICC_NATIVEFNTCTL_CLASS); Wanted to make sure I wasn't missing anything
Unfortunatly the buttons are still not themed.
I even added 511 manifests to the project, numbered 1-512. Sort of a buckshot approch. Still no luck.
Is there some obsure interface I need to implement?
FYI: CPLs (Control Panel Applets) should have a manifest resource of 123
|
|
|
|
|
|
Wow, thanks Michael - that did the trick!
I removed my ComCtl32.lib linker entry & the call to InitCommonControls & it still worked!
So for future users that are having similar issues, All I needed for my ActiveX control was..
* A valid manifest resource type=24 with an ID=2
* #define ISOLATION_AWARE_ENABLED 1 in stdafx.h before all other #includes
(I think that this is the article[^] you ment)
Now I just want to know what the heck all this isolation stuff is & why it added 4k to the size of my DLL I'll google for it later.
|
|
|
|
|
(This is the correct version, with < >) )
Hi,
Consider the following template
template<typename T>
class X
{
//...
};
Now, I would like to put pointers to the different instantiations of the above template for ex
X<int>* xi;
X<double> *xd;
in a single stl container, let's say a vector. Can I do it in an elegant way ?
(Well, actually I can, using a vector<void*>. But after that how do I get back my objects ?)
Thank you,
Andras
|
|
|
|
|
This can be handled in a number of ways that depend on what you want to do with these objects later. Probably the most obvious solution is to write an abstract class from which all X instantiations derive from, and use this as the type of the pointers stored in te container:
class X_base
{
virtual foo()=0;
...
}
template <class T>
class X: public X_base
{
...
};
vector<X_base*> X_vector; Is this suitable for you?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Yes, making an abstract base class solves my problem.
But I'm curiuos what other solutions might exist.
Andras
|
|
|
|
|
Hello Joo,
I think Joaquin's solution is really cool. But I think we may have missed your earlier concern : how to obtain the actual derived class object contained within the vector.
If we used a vector of pointers to X_base objects, we will obtain only pointers to X_base objects when we iterate through the vector.
We need to be able to determine at runtime the following information :
1. What is the X_base-derived-template-class of each vector item.
2. What is the type that is actually used to instantiate the X_base-derived template class (in your earlier example, this is actually 'int' or 'double').
Inspired by Joaquin, I went on to refine his example source codes and produced the following :
#include <vector>
#include <iostream>
#include <typeinfo.h>
using namespace std;
class X_base
{
public :
X_base()
{
}
virtual operator const type_info&() = 0;
};
template <class T>
class X: public X_base
{
public :
typedef T MyType;
X(MyType t) :
m_t(t),
m_ti(typeid(t))
{
}
virtual operator const type_info&()
{
return m_ti;
}
MyType& GetValue()
{
return m_t;
}
protected :
MyType m_t;
const type_info& m_ti;
};
typedef X<int> X_int;
typedef X<double> X_double;
typedef std::vector<X_base*> X_base_vector;
int _tmain(int argc, _TCHAR* argv[])
{
X_int* pxi = new X_int(5);
X_double* pxd = new X_double(0.85);
X_base_vector x_base_vector;
X_base_vector::iterator theIterator;
const type_info& ti_int = typeid(int);
const type_info& ti_double = typeid(double);
int i = 0;
cout << ti_int.name() << endl;
cout << ti_double.name() << endl;
x_base_vector.push_back(pxi);
x_base_vector.push_back(pxd);
for (theIterator = x_base_vector.begin(); theIterator != x_base_vector.end(); theIterator++)
{
X_base* px = *theIterator;
if (ti_int == (const type_info&)(*px))
{
X_int* pxi = dynamic_cast<X_int*>(px);
cout << "px == X<int>" << endl;
cout << "Value : " << pxi -> GetValue() << endl;
}
if (ti_double == (const type_info&)(*px))
{
X_double* pxd = dynamic_cast<X_double*>(px);
cout << "px == X<double>" << endl;
cout << "Value : " << pxd -> GetValue() << endl;
}
cout << ((const type_info&)(*px)).name() << endl;
}
return 0;
}
Essentially, I used Run-Time-Type-Information (RTTI) to help determine the class (X_base-derived) of each vector item as well as to determine the type that is actually used to instantiate the X_base-derived template class.
Hope the above code will be helpful to you and Joaquin.
Thanks,
Bio.
|
|
|
|
|
You could also use the boost::any as container item type. Please see http://www.boost.org/doc/html/any.html[^] for more information.
If you think this is something you would like to use, then you do not need to download the entire boost source code. You can download any.hpp and use it. No link libraries required.
--
Seraphim Shock. Gold for your ears.
|
|
|
|
|
Hi,
Consider the following template
template<typename t="">
class X
{
//...
};
Now, I would like to put pointers to the different instantiations of the above template for ex
X<int>* xi;
X<double> *xd;
in a single stl container, let's say a vector. Can I do it in an elegant way ?
(Well, actually I can, using a vector<void*>. But after that how do I get back my objects ?)
Thank you,
Andras
|
|
|
|
|
Hello everyone
How to load a MFC dll to a WTL project? If having some sample, could you send me by email?
Thank you .
-Freehawk
|
|
|
|
|
If it's an MFC extension DLL, you can't. An extension DLL can only be used by an MFC app. (You could add MFC support to the WTL app, though).
If it's an MFC regular DLL, there's nothing special you have to do to use it.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0.1! | RightClick-Encrypt
"Just because the box has 2 gigabytes of memory doesn't mean you get to use it all!"
-- Rico Mariani, CLR perf guy
|
|
|
|
|
Hello.
Could you teach me the details about "add MFC support to the WTL app"?
Thank you.
-Freehawk
|
|
|
|
|
It'd be easier if you made a dummy ATL project with the appwizard, and check the "support MFC" checkbox so you can see where the CWinApp object is created & initialized.
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0.1! | RightClick-Encrypt
Pinky, are you pondering what I'm pondering?
I think so Brain, but if we shaved our heads, we'd look like weasels!
|
|
|
|
|
Hello
Thank you for the reply.
Now I am using WTL7.1, and I cannot find "check the "support MFC" checkbox ".
how to do?
-Freehawk
|
|
|
|
|
|
Hello.
Thank you very much. I want to know a way by which I can use MFC in a WTL project.
If know it, please tell me.
-Freehawk.
|
|
|
|
|
You have to ask yourself this question; If I need MFC support, then why am I not writing an MFC based application?
--
Seraphim Shock. Gold for your ears.
|
|
|
|
|
I need some docking, auto-hide tool windows, till now I only realized them by WTL, at same time I need to call a lot of Dll created by MFC, so.......
-Freehawk.
|
|
|
|
|
hi all,
how can i match AfxGetMainWnd() in WTL code?
the issue is that from child windows or from some other classes i need to get a pointer to MainFrame. AfxXXXXXXXXX does bot work... what does then?
debug - is my life style
|
|
|
|
|
There is no such function. Store the pointer to your main window where it is created (typically in the ProjectName.cpp file if you are using the WTL-wizard). Either make a global variable or a function, say WtlGetMainWnd().
--
Seraphim Shock. Gold for your ears.
|
|
|
|
|
Iam currently trying to code a small graphics viewer using the ATL in VC. Ive had some success modifying the onDraw code so I can use the setPixelV command to display the pixel data I need to the screen, but I have yet to find a way to change the size that the control appears in IE or the test container. Iam pretty new to VC and the ATL but have a very strong java background, and i finding this ATL stuff hard? Can n e 1 help me change the size of my control????! Also sometimes when i use setPixelV I get some kind of throw back or 'echo' where it draws some pixels at the bottom of the screen in a unspecified position?!
[] /\ () X
|
|
|
|
|
I can't speak to your exact SetPixelV issues, but you should be sure to limit the area to ATL_DRAWINFO::prcBounds in your OnDraw.
I think that I can provide some insight into the size issue.
Recently I made an ATL ActiveX control for IE & in order to set the default size of the control, I modified _Module.m_sizeExtent in my constructor. When I needed to re-adjust the size of the control, I told IE to do it for me
To do that, I had to get the IHTMLDocument that my control was in & find my exact IHTMLObjectElement & then do a put_height to adjust it.
Bad Psudo Code<br />
this->GetClientSite(IOleClientSite)<br />
IOleClientSite::QI(IID_ServiceProvider)<br />
IServiceProvider->QueryService(SID_SWebBrowserApp)<br />
IWebBrowser2->get_Document()<br />
--find the IHTML Object that you want to adjust<br />
IHTMLObjectElement->put_Height(VT_I4)<br />
done
It's probably something similar for the test container - but I've never investigated it.
|
|
|
|
|
Hi..
I make an activeX control (ATL 3.0 - VC++6.0 SP5)
I want to make a property read only at runtime...
what I did was :
BOOL blnMode=TRUE;
GetAmbientUserMode(blnMode);
if(blnMode)
return Error("Property not available at runtime\n",IID_INumberBox,E_FAIL);
the problem with this :
When the value of the property is being loaded (when I run the peogram) the put_property() is invoked and the error is raised..
So I did this :
BOOL blnMode=TRUE;
GetAmbientUserMode(blnMode);
if(blnMode && IsWindow())
return Error("Property not available at runtime\n",IID_INumberBox,E_FAIL);
this checks if the window of the control has been created .. if not the control is loading properties so no need to fire raise the error..
this works .. but I wonder if there is a way to check if the properies are being loaded/saved ?!! Something like : IsLoadingProperties() , IsSavingProperties()...
Or is there a way to override the loading / saving actions ?
Any help / comments are appreciated
|
|
|
|