|
any particuliar reason to repost/cross-post the forums ?
i believe David[^]'s answer didn't satisfy you
anyway, '1' for the offense.
|
|
|
|
|
Hi,
I created a generic ATL COM Dll with an Interface and Event. I'm having trouble setting it up to receive the event notification in my client container of a console application. I tried adding a class derived from IDispEventImpl and added the Event Sink map. Anyone know the correct steps in doing this?
Regards,
|
|
|
|
|
Hello Anthony9887,
Can you be more specific about the trouble you are facing ? For example, does your application crash when it is supposed to receive the event ? Does your application termiate before the event is received by the sink ?
The correct steps to resolve your problems may depend alot on the nature of your problem.
Thanks,
Bio
|
|
|
|
|
Hi, I am having errors.
error C2664: 'Menu::createMenuItem' : cannot convert parameter 3 from 'std::_Vb_reference<_MycontTy> *__w64 ' to 'bool *'
...
vector<bool> connect_flags;
vector<bool> disconnect_flags;
...
for(int j=0;j<gmenustate.getsizeofgosafestations();j++)
{
this-="">pMenu->createMenuItem(mhComm, (connect_str+gMenuState.getGosafeStation(j).name).c_str(),
&(gMenuState.connect_flags[j]), &_menuHeaderCommFn);
this->pMenu->createMenuItem(mhComm, (disconnect_str+gMenuState.getGosafeStation(j).name).c_str(),
&(gMenuState.disconnect_flags[j]), &_menuHeaderCommFn);
}
Anybody can help me?
Yonggoo
-- modified at 18:50 Thursday 13th April, 2006
|
|
|
|
|
please check the Ignore HTML tags in this message (good for code snippets) checkbox so that we can see your < > stuff properly
|
|
|
|
|
Scott Meyers in his book "Effective STL" says vector<bool> is not really vector - it's a bitset and it uses proxy when you try to address an element. You cannot use it like an array.
Try different element type instead.
|
|
|
|
|
Or use std::deque<bool> instead
Orhun Birsoy
|
|
|
|
|
I have an active control which is published. Now I want to add two new methods to this control to provide new functionality. Just like COM is the activex immutable ? If yes, how do I achieve it. I mean we declare new interfaces in COM when providing new functionality and QueryInterface determines whether to use the new functionality exists or not. How can I achieve this in activex control.
"C makes it easy to shoot yourself in the foot. C++ makes it
harder, but when you do, it blows away your whole leg."
- Bjarne Stroustrup
|
|
|
|
|
See my reply in the C++ forum here[^].
--
Roger
It's suppose to be hard, otherwise anybody could do it!
|
|
|
|
|
I have an atl application that uses an activex control which I create at runtime. I am currently using #import. Now I have a new version of the activex which has some new features, I would like the option of using either of them based on some config setting somewhere. Don't think #import will work in this scenario. Any help is greatly appreciated.
Kurt
|
|
|
|
|
OK, following on from the char -> wchar_t question earlier, does anyone know of a neat STL-friendly way to perform UTF8 encoding/decoding? Currently I use the MS character encoding macros, e.g.:
wstring str = CA2W(utf8_string, CP_UTF8).m_psz;
But I'd like to use something that is a bit more platform independent!
The Rob Blog Google Talk: robert.caldecott
|
|
|
|
|
AFAIK STL doesn't have UTF-8 support because the elements in a basic_string have to all be the same size, and the UTF-8 encodings of characters have variying sizes.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | NEW!! PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Never mind. You can store a utf-8 string as a sequence of bytes in std::string, just need to know which functions operate correctly on such a sequence and which not.
As for the conversion, I have been writing an article on platform-independent STL friendly utf-8 string operations for months, but I just can't make myself finish it
My programming blahblahblah blog. If you ever find anything useful here, please let me know to remove it.
|
|
|
|
|
Nemanja Trifunovic wrote: As for the conversion, I have been writing an article on platform-independent STL friendly utf-8 string operations for months, but I just can't make myself finish it
Man, that would be sweet...
The Rob Blog Google Talk: robert.caldecott
|
|
|
|
|
In the Microsoft stl libraries, localization uses C interface. The locale class calls setlocale function. And it cannot work with UTF-8.
From the Remarks section on the setlocale function reference:
"The set of available languages, country/region codes, and code pages includes all those supported by the Win32 NLS API (except code pages that require more than two bytes per character, like UTF-8)."
|
|
|
|
|
Yeah once again about it!
I know, there is a way to do it using crt function mbstowcs. The first thing I do not like about it I have single-byte character string (in the cp1251 encoding for example). The second it's not about stl.
|
|
|
|
|
alabax wrote: Yeah once again about it!
huu ???[^]
how many CP accounts do you have ?
|
|
|
|
|
that's the only
|
|
|
|
|
yeah, that's what i see, so, why did you say "once again about it" ???
|
|
|
|
|
I mean questions like this appear every month on the newsgroups and message boards. =)
|
|
|
|
|
|
like this:
wstring s2w(const string &s)
{
size_t l=s.size()+1;
const char *pc=s.c_str();
wchar_t *pw=new wchar_t[l];
locale loc("");
use_facet<ctype<wchar_t>>(loc).widen(pc,pc+l-1,pw);
return wstring(pw);
}
-- modified at 14:03 Wednesday 12th April, 2006
|
|
|
|
|
Look s about right - proof of the pudding's in the testing, of course!
|
|
|
|
|
OMG! It's such a shame I did new without delete
GC is deep in my mind!
wstring s2w(const string &s)
{
size_t l=s.size()+1;
const char *pc=s.c_str();
wchar_t *pw=new wchar_t[l];
if (pw==0) throw;
locale loc("");
use_facet<ctype<wchar_t>>(loc).widen(pc,pc+l-1,pw);
wstring ws(pw);
delete [] pw;
return ws;
}
|
|
|
|
|
You could always use a vector instead.
vector<wchar_t> pw(l);
...
use_facet<ctype<wchar_t> >(loc).widen(pc,pc+l-1,&pw[0]);
wstring ws(&pw[0]);
The Rob Blog Google Talk: robert.caldecott
|
|
|
|