|
how to get post data of form in ATL COM DLL.
i am call Ivoke() using IDispatch interface. In Invoke i am calling the BeforeNavigate2(). But i am getting memory error. can you tell me any example which i can down load and do it.
|
|
|
|
|
Hi, I was toying around with ATL 7.1, and was trying to implement multiple classes. I'm using attributes, and thought I'd done everything right, but when I compiled, it didn't work, and the OLE/COM viewer shows the coclass does not export that interface. To test it out, I right-clicked in class view on the co-class and chose implement interface, pretty much chose one at random and left the functions as they were (returns the not-implemented error code).
Re-built, still didn't show the interface. So, how do I get a co-class to expose the multiple interfaces? The closest thing I saw said "Remove the class declaration and replace it with a traditional one" which I think kind of defeats the purpose of the new attributes. Plus, I'm just starting to learn ATL, so I'd rather learn the new way, then go back, learn the old way, and THEN learn the new way.
|
|
|
|
|
I believe I have it figured out, using the com_interface_entry macro. However, a related bug is when I use that, since my server is based off the ATL shell extension tutorial, I need to use IContextMenu. Even though I #include <shlobj.h> which very clearly shows IContextMenu (it's the first interface it defines), the compiler complains it cannot find the uuid of IContextMenu.
Is there some magic include, some missing lib? Or am I just not reading the right parts of the manual.
|
|
|
|
|
The "no UUID associated" error is due to buggy header files in VC 7. They are missing lines like:
struct __declspec(uuid("guid here...")) IContextMenu; You'll need to add those to your stdafx.h manually.
IMO attributed ATL is horrible, not to mention difficult to debug as you have found out. A couple of weeks ago I was trying to get an attributed sample up and running with Nish. When registering the DLL, the RGS file wasn't being read, and neither of us could figure out why. With all the important bits hidden by attributes, there's no code to step though. We're both bright guys and we were stumped, and Nish's newsgroup searches revealed many similar questions with no answers.
So in short, stick to regular ATL. Again, just MHonestO.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
"That probably would've sounded more commanding if I wasn't wearing my yummy sushi pajamas."
-- Buffy
|
|
|
|
|
Thanks for pointing all that out. It also helps that most of the examples out there are for regular ATL. The only problem is because of the buggy headers, gotta do a lot of those lines, which includes tracking down the UUID in the OLE/COM tool... any idea when microsoft will release a fixed/updated version?
|
|
|
|
|
|
I found out something... my real problem was the registration script. It only reported 1 interface, but it actually worked, once you added the registration_script() attribute.
Hope this helps you with your problems, maybe you can spread it around the various newsgroups.
|
|
|
|
|
|
Where do you intend your ActiveX control to be used ?
Are you trying to add a Menu in an existing menu or trying to create a brand new Menu ?
Can you give us more input please ?
DarkByte
|
|
|
|
|
I was hoping to create secure webpage editor that resides in internet explorer. This would be primarily for broadband users. I have not figured out how to add any menu to an activex container so it would be brand new.
|
|
|
|
|
According to MSDN's instruction on ATL Server projects, developer may use the 'ATL OLE DB Consumer Wizard ' to generate a class code with one db_command attributes ,and then access database with the SQL string specified in db_command.
All samples demostarte that one class can only has one db_comand attribute. If developer want to SELECT , INSERT and DELETE a table records , he must code at least three classes with one [ db_command ... ] for each.
It's not a good idea.
Anyone know how to define multi [db_command ...] attributes for single class in the ATL project? and how to change the [ db_command ... ] attributes during executetion?
thank in advance
he wen feng
|
|
|
|
|
Only 1 db_command is required using a SELECT statement. If you add DBPROPVAL_UP_CHANGE | DBPROPVAL_UP_INSERT | DBPROPVAL_UP_DELETE to the DBPROP_UPDATABILITY property, the rowset will allow INSERT, UPDATE, and DELETE through it's member functions.
|
|
|
|
|
Reply to Doug:
Thanks your suggestion.
Could you tell me how to specified SQL :-Ocommand string for the class through it's member functions?
|
|
|
|
|
Using OLEDB Attributes is no different than using OLEDB Consumer templates. There are a number of examples on using the OLEDB templates at
http://www.codeproject.com/database/#OLE+DB
|
|
|
|
|
i have got a vector of strings. i would like to sort out all the empty strings.. any neater way to do this than this
struct _IsEmpty
{
operator () (const std::string& s)
{
return s.empty();
}
};
void TransformAbtVStr (std::vector<std::string>& v_str)
{
v_str.erase (std::remove_if (v_str.begin(), v_str.end(), _IsEmpty()), v_str.end());
}
Thanks in advance,
Bernhard
"Just looking for loopholes." W. C. Fields American actor, 1880-1946, explaining why he was reading the Bible on his deathbed.
|
|
|
|
|
vector<string> vecStr;
vector<string>::iterator iterB, iterE;
// put stuff in your vector of strings
iterB = vecStr.begin();
iterE = vecStr.end();
sort(iterB, iterE);
vecStr.erase(unique(iterB, iterE), iterE);
vecStr.resize(vecStr.size());
William
Fortes in fide et opere!
|
|
|
|
|
I'm curious, what is the reason to call the resize method at the end?
David
|
|
|
|
|
Because after you've done the erasing of entries, the size of the vector is no longer what it used to be. Therefore, in order to get it to the new size it has become, you'll need to resize it. And that new size is what "size()" is going to give. Therefore you'll be resizing it to the new size of "size()".
William
Fortes in fide et opere!
|
|
|
|
|
If that is the case for you, then you have a faulty STL implementation.
Erase on sequences (and I am prepared to bet money that this is the case for other containter types too), destroys the elements properly and then removes them from the container.
The docs says (SGI STL docs): Destroys the elements in the range [p,q) and removes them from a. and: a.size() is decremented by the distance from i to j. The relative order of the other elements in the sequence is unchanged.
--
Ich bin Joachim von Hassel, und ich bin Pilot der Bundeswehr.
Welle: Erdball - F104-G Starfighter
|
|
|
|
|
Sometimes what the documentation says, and what is implemented, are not always the same. You do whatever works.
William
Fortes in fide et opere!
|
|
|
|
|
So you are saying that if you log the size before and after the resize() you can provide the proof that they are not equal? Please do.
cout << vecStr.size() << endl;
vecStr.resize(vecStr.size());
cout << vecStr.size() << endl;
"No matter where you go, there your are." - Buckaroo Banzai
-pete
|
|
|
|
|
hi,
i got example for BHO from MSDN. it is atl com. it is creating dll and registor in the BHO registry. once it is registor, automaticaly is invoked when the IE starts. it is using setsite method. it is getting html code of the page. But i want to get the POST data of form. pls guid me how to do this. if you know any article about this pls mail me.
|
|
|
|
|
I have an application where I have the usual MainFrame (as so kindly provided by the WTL wizard) but also a copy&paste of that under another name.
I have created a separate toolbar resource for the new frame window but if I specify UPDUI_TOOLBAR for any of the IDs used in that toolbar, the application crashes during PeekMessage() in CMessageLoop::Run().
If I just specify 0 (zero) instead, everything works fine except UISetCheck() for any of the buttons in the second toolbar does nothing.
What to do?
Thanks.
|
|
|
|
|
is there any way of sorting a list with a custom function? i'm trying to sort a list of pointers to structs, so the list.sort() method doesn't work.
-thanks
|
|
|
|
|
Depends - either you can overload operator < at the contained object or, if your stl implementation allows it, you can use the customized sort functor.
The list's sort function should be defined as follows:
void sort(greater<T> pr);
therefore you can define your own:
<br />
struct ptrSort : public greater<SortMe*> <br />
{<br />
bool operator()(const SortMe* &p1, const SortMe* &p2) const<br />
{ <br />
return p1->m_ember < p2->m_ember; <br />
}<br />
};<br />
and use it
list.sort( ptrSort() );
Hope that helps
|
|
|
|