|
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
|
|
|
|
|
I have added an ATL object with connection points to my MFC project so I can expose methods and events to another application. How would I go about starting an instance of my object, so I can fire events from, say, a button click? I'm new to C++ and ATL programming, so please bear with me if my question is stupid.
Regards,
NotBear
|
|
|
|
|
Hello!
Hope someone can help me.
First some explanation:
I have a function (from the DX9 C++ Help) that grabs a video frame from any DirectShow supported Video file. It works fine so far, no problems.
BUT (as always )
if i call this function in a thread, CoCreateInstance failes (using ATL Smart Pointers with IMediaDet).
Here is the begin of the function to the point where FAILED is true:
HRESULT GetBitmap(LPTSTR pszFileName, BITMAPINFOHEADER** ppbmih)
{
HRESULT hr;
CComPtr<imediadet> pDet;
hr = pDet.CoCreateInstance(__uuidof(MediaDet));
if (FAILED(hr))
return hr;
The function where i am calling GetBitmap() looks this way:
unsigned __stdcall DoStuffThreaded( void *pArguments )
{
for( ;; )
GetBitmap()
.. do stuff etc
_endthreadex(1);
}
and the thread function is started with:
hThread = _beginthreadex(NULL, 0, DoStuffThreaded, (void*)pParam, NULL, &uiID);
Again, if i call GetBitmap() the usual way (not in a thread) it works perfect.
Do i need to initialize ATL in some way to make it work in a thread?
Thanks for any help/hints/solutions!
Nik
|
|
|
|
|
Ok, i am stupid.
Doing a
CoInitialize(NULL);
at the beginning
and a
CoUnitialize();
at the end
solves the problem...
Nik
|
|
|
|
|
Hello Virtualnik,
The reason why CoInitialize() and CoUninitialize() are required is to enable COM to support Apartment Threaded Models. In an Apartment Threaded Model, each thread owns the COM objects that are created in the thread.
When a thread wants to access the COM objects created in another thread, the COM object must be marshalled to the thread that wants the access. In order that threads be able to perform marshalling, CoInitialize() and CoUninitialize() must be called in each thread.
Hope the above will shed more light.
Thanks,
Bio.
|
|
|
|
|
Thank you for the explanation!
Nik
|
|
|
|
|
I am Using
CComPtr<IHTMLElement> m_pBody;
as a Class Member
and in the DocumentComplete() Handler of BHO
hr = spHTML->get_body(&m_pBody); <-ASSERTION FAILED 2nd Time
if (FAILED(hr))
return hr;
When the Code Executes second time this assertion fails
Excerpts from CComQIPtr class
T** operator&()
{
ATLASSERT(p==NULL);
return &p;
}
if i don't use CComQIPtr then everything is ok but it sometimes crashes
what does this assert means what am i doing wrong ?
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
You are using that variable twice without releasing the first object. To release the first object, set the value to NULL.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Now I want to read a file and display the content of file to different areas
of same veiw (some areas can be inputed some words, and others can not be
inputed), How to do?
CHeaderCtrl + CRichEditCtrl?
CHeaderCtrl + CListView?
or other way?
BTW, the size of file is very big.
Please teach me how to do?
Do you have sample about it?
-Freehawk.
|
|
|
|
|
It's common to see FunctionA and FunctionW for ANSI/UNICODE versions, however my ATL functions are being created like this which is not good.
For example, I made a method called OpenService which returns an IService object (of my creation) and takes as a parameter a BSTR.
So the declaration is as follows:
<br />
__interface IConfigurer : IDispatch<br />
{<br />
[id(1), helpstring("method Open")] HRESULT Open([in] BSTR machineName);<br />
[id(2), helpstring("method Close")] HRESULT Close(void);<br />
[id(3), helpstring("method OpenService")] HRESULT OpenService([in] BSTR serviceName, [out,retval] IDispatch** ppService);<br />
};<br />
I havn't done ATL since VC 6.0 and I'm using 2003 .NET now. It auto creates the IDL file and outputs the OpenService function as OpenServiceA. Aren't BSTR's not supposed to require A/W or distinctions since they are always wide?
I'm an ATL 7.0 noob so help me out
|
|
|
|
|
I saw the EXACT same thing today! I have not yet fully investigated the matter further - I was on my way home when I spotted a method of mine, OpenService, having the name OpenServiceW.
I am not 100% sure of what's going on, but it wouldn't surprise me that there's some function in the system headers that looks something like this:
#ifdef _UNICODE
#define OpenService OpenServiceW
#else
#define OpenService OpenServiceA
#endif
If you want to, you can investigate this and post what you find - that ought to be good reading tomorrow morning
--
I am perpetual, I keep the country clean.
|
|
|
|
|
Hey there. Does anyone know how to close all open Internet Explorer windows? I've seen other programs out there that do this, but have no idea of how to do this myself. Thanks in advance!
|
|
|
|
|
Hello everybody,
How do I define or create root or application objects in VC++ ATL projects like GlobalMultiUse objects in VB ActiveX DLL projects?
Regards,
Roozbeh
|
|
|
|
|
It is ordinary ATL (or COM) object, but having [appobject] attribute.
With best wishes,
Vita
|
|
|
|
|
hi
i have a atl component with one interface with three byref variant parameters coming inside my StdMethodImplementation,
the client is always asp.
namely vin1,vin2,vin3
vin1 and vin2 are arrays of unknows dimentions
they can be single dimention and may be double dimention array,i need to read vin1 and if it is array i need to read some certain index of it and change it to some allcaps and another little string saying "changed ".
the problem is i am not able to access the variant inside the implementation, is it coming as safearray for i don't get any thing, i tried copying vin1 values to vin2 it didn't work.
any idea what could be wrong.
and if possible is there any sample available for handling variant arrays inside ole object.
regards.
before you know it is past.
0x5c06abc0, 0x2dcd, 0x11ce, 0x84, 0x17, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71
|
|
|
|
|
Hi
I need to get WM_SIZE event for Toolband object.I need to resize a control which is hosted on it accordinding to band width.Help would be appreciated.
Thanks
Sai
|
|
|
|