|
|
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
|
|
|
|
|
Hi geo_m, thanks for the reply. unfortunately i can't get it to work
it compiles ok but doesn't seem to actually use the customized sort functor. i put a call to MessageBox() inside ptrSort
struct ptrSort : public greater<SortMe*>
{
bool operator()(const SortMe* &p1, const SortMe* &p2) const
{ MessageBox(g_hMainWnd, "inside ptrSort", "", 0);
return p1->m_ember < p2->m_ember;
}
};
but no message boxes ever show up, and the list is sorted exactly the same way as if i used list.sort(greater<sortme*>()) instead of list.sort( ptrSort() ) )
any idea whats going wrong?
-thanks
|
|
|
|
|
I see. Look at KB265109
BUG: The STL list::sort() Function Doesn't Sort a List of Pointers
This could help you to point into the right direction
|
|
|
|
|
i got it to work, thank you!
|
|
|
|
|
After hours of searching I finally found a solution being described by "DerMeister" in a post in the following forum (scroll down to post from 5/31/2003):
http://www.gamedev.net/community/forums/topic.asp?topic_id=159921
To quote him (1st example would be "best" in STL but 2nd example does work with Visual C++ 6.0):
[QUOTE]
At last!!! I found the way around it... I suggest anyone using VC 6 to read this. First I found that the "right" way to work with sorting STL lists is not supported by MSVC6.
With the right way I mean for example:
using namespace std;
struct compareByRS
{
bool operator()(const C3DObject* obj1, const C3DObject* obj2)const
{ return (obj1->rs) < (obj2->rs);}
};
list<c3dobject*> ObjsList;
//then I insert a few pointers to the list with random values in //the rs member (an int)
lst.sort(compareByRS()); //this would sort by rs
but, for the MS guys something should be done their way:
template<>
bool std::greater<c3dobject*>::operator()(C3DObject* const& p1, C3DObject* const& p2) const
{
return p1->rs < p2->rs;
}
list<c3dobject*> ObjsList
//I fill the list the same way
ObjsList.sort(greater<c3dobject*>());
//and use this horrible way to sort it... that's the MS way...
Anyway changing < to > sets the way to sort the list... I hope this is the only exception to work with STL under MSVC (which I doubt)...
Thanks to all who helped...
No matter where you go... &this
[/QUOTE]
gosh, you don't know how happy I am now ))
Bye,
T.T.H.
|
|
|
|
|
Currently writing a memory management system and I decided it'd be the logical thing to use stl maps to store various data. I'm very new to stl so I don't really understand the ins and outs of it yet, so I'm stuck on a problem which *should* be easy, but I'm doing something wrong.
I'm basically keeping a map of maps, with a unique string as the key to each of the maps. Here's one of my insert functions:
bool CHeapStore::_insert (heapHeader_t *header) {
map<int, heapHeader_t *> tmpMap;
pair< map<string, map<int, heapHeader_t *> >::iterator, bool> p;
tmpMap.insert(pair<int, heapHeader_t *>(header->id, header));
p = s_heaps.insert(pair<string, map<int, heapHeader_t *> >(header->name, tmpMap));
s_mmStashing = false;
return p.second == true ? true : false;
}
The program crashes on the s_heaps.insert() and returns the debugger to this in xtree:
_Pairib insert(const value_type& _Val)
{ // try to insert node with value _Val
_Nodeptr _Trynode = _Root(); // crashes here
What am I doing wrong? I've also tried other insertion methods, but this is the most direct one. The s_heap is an empty map when it crashes, it's the first call to the insert function.
Thank you so much for any help. btw, i'm using the default stl library that comes with MSVC .NET 2003.
-j
|
|
|
|