|
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
|
|
|
|
|
You could always subclass it and intercept the WM_SIZE message. When you intercept the message, call the default window procedure for the toolband object, and when it returns, you can perform your specific action.
--
If there was a problem, Yo, I'll solve it!
Check out the hook while my DJ revolves it.
|
|
|
|
|
I want to downlaod ( e.g www.codeproject.com/index.html) using ATL (without any support of MFC). How can I implement it using ATL. Any code/IDea/URL will be highly acknowledgement.
|
|
|
|
|
look to the CBindStatusCallback in MSDN help. Usage is like:
<br />
CBindStatusCallback<CATLAsync>::Download(this, OnData, m_bstrURL, m_spClientSite, FALSE);<br />
|
|
|
|
|
|
The pCaller argument in your article is described as Pointer to the controlling IUnknown interface of the calling Microsoft® ActiveX® component (if the caller is an ActiveX component). ... The function attempts the download within the context of the ActiveX client framework and allows the caller's container to receive callbacks on the progress of the download. in the MSDN docs.
Now, exactly what does the last part really mean? Will it query the pCaller for a specific interface? If so, do you know which? I wish the MSDN could be a bit clearer sometimes.
--
If there was a problem, Yo, I'll solve it!
Check out the hook while my DJ revolves it.
|
|
|
|
|
|
hey!!!thanks a lot Michael.(this is what i was searching for..)One again thanks, u saved my 1 days of extra coding
regards
Balkrishna Talele
|
|
|
|
|
Hi All This is My First Post in this Group (Hope i Will Get To Learn a lot Here)
Here is my Query
I want a Browser Helper Object in ATL.
(Any FAQ's Link Will be Much Appriciated)
Is it Possible To Change the Contents of a Browser(window) Through the BHO's ?
I want to UnderLine a few Keywords that are in the WebSite being Displayed in Browser Window , Is It Possible ?
Thanks All
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
IHTMLDocument2->write will let me write in the browser window.
i'll get the HTML parse it add a few tags and write it back
is it ok or am i dreaming
Any Comments/Suggestions ?
Live as if your were to die tomorrow. Learn as if you were to live forever.
-Mahatma Gandhi
|
|
|
|
|
I have a lot of source code where CWinThread is used. How to change CWinThread to a WTL project? Thank you.
Freehawk
|
|
|
|
|
I'm writing a VT100 ActiveX Control,
I add an Atl Control class, "CAVTCtrl", 2 Atl objects
"CEmul" and "CTerm".
the 2 Atl objects are created inside "CAVTCtrl" (aggregate) , "CEmul"
handle input stream in VT100 format, decode them in to a buffer, "CTerm" read the buffer, and display on terminal window.
the CEmul implements a _IEmulEvents interface,
CTerm implements _ITermEvents, to dispatch events to CAVTCtrl and User Applications,
But CAVTCtrl is already a event sender, can't be defined as event receiver.
So, how to dispatch events from CEmul and CTerm to CAVTCtrl, and expose the _ITermEvents _IEmulEvents connection points?
|
|
|
|
|
How might I reference the iterator that's currently activating the function object, while inside the function itself? I'm trying to do "in-place" update.
Here's some code to demonstrate what I mean. (namespace and '#include' statements were provided.)
typedef map<const string, string, less<string> > MapStr;
typedef pair<string, string> PAIR_KV;
class FnObj
{
public:
void operator() (const MapStr::iterator& it);
};
int main()
{
MapStr mapStr;
MapStr::iterator iterB = mapStr.begin(), iterE = mapStr.end();
for_each(iterB, iterE, FnObj());
return 0;
}
void FnObj::operator() (const MapStr::iterator& it)
{
MapStr mapStr;
PAIR_KV PAIR;
if((*it).first == "Old Key")
{
mapStr.erase(it);
PAIR.first = "New Key";
PAIR.second = "This is the value of the new key";
mapStr.insert(PAIR_KV(PAIR.first, PAIR.second));
}
} The compiler is not happy with the above code.
Any insight is appreciated.
William
Fortes in fide et opere!
|
|
|
|
|
The functor's argument is a reference to the object pointed to by the iterator, not the iterator itself, so that's the source of your compile errors. In your case the argument would be pair<const string,string>& . However, the VC 6 docs specifically say the function must not alter the object
--Mike--
Ericahist | CP SearchBar v2.0.2 | Homepage | 1ClickPicGrabber New v2.0! | RightClick-Encrypt
Kosh reminded me of some of the prima-donna programmers I've worked with. Knew everything but when you asked them a question; never gave you a straight answer.
-- Michael P. Butler in the Lounge
|
|
|
|
|
Thanks for replying.
OK, I can settle for not altering the key, but being able to change the value of the second argument, does nothing as far as altering the structure of the map (which is what "in-place" update seeks to do).
William
Fortes in fide et opere!
|
|
|
|
|
You may not modify the structure of the container you are iterating with for_each. The reason is that you may invalidate iterators which for_each is holding a reference to.
NEVER modify containers structurally while inside iterating functions such as for_each.
--
You copy and paste yourself into my brain.
You always find your way back into my brain.
|
|
|
|