|
Do not count too much on IDE, except creating a new project using a WTL wizard. Mostly you'd do everything by hand which is not that bad.
If you really get interested in WTL there is a wtl group hosted by Yahoo: http://groups.yahoo.com/group/wtl/[^].
Good luck,
Igor.
|
|
|
|
|
If the IDE detects BEGIN_MSG_MAP(class) in your class, you can automatically add window message handlers. It also detects if your class is dependent on a dialog resource (you can add event handlers from the dialog editor). And that's about it I guess. The intellisense support for WTL is very limited. Since many names in WTL is also present in MFC, the IDE will be fooled by this and show you MFC-versions of the intellisense data. But don't worry though, most of the time WTL is a reflection of MFC interface wise.
If intellisense is lying, there's always the header files which I find easily navigable.
I've never tried using WTL with the wtl:: namespace though. That might correct the intellisense problems.
--
Watcha' gonna do, when Hulkamania runs wild on you!?
|
|
|
|
|
Hi Geeks,
I have created a new COM server as a NT-service using ATL. I have added a new coclass, interface and method. It builds, and the service runs ok. When I instantiate the server from a client, it works. However, when I call QueryInterface on this object for my new interface, it returns E_NOINTERFACE. I have checked the ATL generated BEGIN_COM_MAP AND END_COM_MAP block, which does have my new interface in there.
Any suggestions will be appreciated.
Thanks.
|
|
|
|
|
Check the registry, see if your interface has been properly registered. Also look at the OLE/COM object viewer, it lists all interfaces.
Igor.
|
|
|
|
|
Ok now i have a wstring and other string, how do i convert between them...
any support for BSTR will also help me.
Is there veeeeeeeery good documentation on wstring and string...
MSDN is of little help.
thank you.
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
If you're using ATL (or even if you're not), use the ATL string conversion macros:
#include <atlbase.h>
#include <atlconv.h>
#include <string>
void this_is_your_function()
{
USES_CONVERSION;
std::string s = "whatever";
std::wstring ws = A2CW(s.c_str());
}
Alternatively (without using ATL), you can use the Win32 functions MultiByteToWideChar and WideCharToMultiByte to convert between ASCII and Unicode.
HTH
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Sometimes this is enough:
<br />
wstring w = L"This is a string";<br />
string s;<br />
copy (w.begin(), w.end(), back_inserter(s));<br />
<br />
string s1 = "This is another string";<br />
wstring w1;<br />
copy (s1.begin(), s1.end(), back_inserter(w1));<br />
<br />
|
|
|
|
|
|
Hello, how do I access the element which resides a vector of set. The codes are show below.
vector< set<int> > objSetVt;
set<int> objSet1;
objSet1.insert(2);
objSet1.insert(4);
objSet1.insert(2);
objSet1.insert(7);
set<int> objSet2(objSet1);
set<int> objSet3(objSet1);
objSetVt.push_back(objSet1);
objSetVt.push_back(objSet2);
objSetVt.push_back(objSet3);
vector< set<int> >::iterator objVtItr;
for(objVtItr = objSetVt.begin(); objVtItr < objSetVt.end(); objVtItr++)
{
//??? How to access the element now
//objVtItr[0][0] <-- this give compile error
}
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
Anthony,
Unlike the vector class the set class does not have operator[]. A set is a sorted non-repeating collection, so you have to use the set's find() method.
In you particular case if you want to access the 7 of your set in the first vector you can use:
<br />
int iTest = *objSetVt[2].find(7);<br />
However if there is no 7 in the set the value of iTest will me meaningless. So You must always check:
<br />
set<int>::iterator it = objSetVt[0].find(7);<br />
if (it != objSetVt[0].end())<br />
int iTest = *objSetVt[0].find(7);<br />
Ivor S. Sargoytchev
Dundas Software
|
|
|
|
|
Does STL support unicode. if so how do i use it,
Certain functions like lstrcpy under unicode takes unsigned short* as input parameter in that case STL string failes.
Any idea bout it.
My God is more powerfull Than Your God. (the line that divides the world)
|
|
|
|
|
Try looking at std::wstring - that's an STL basic_string instantiated with wchar_t as the character type. There are also wchar_t streams as well.
And if 16 bits isn't wide enough, try using something like std::basic_string<unsigned long> .
And you can do something like
typedef std::basic_string<TCHAR> tstring;
to get a typedef that should work under ASCII or Unicode.
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Stuart Dootson wrote:
And if 16 bits isn't wide enough, try using something like std::basic_string<unsigned long="">.
But then you'd have to define character traits for unsigned long I reckon.
--
Sancte Míchael Archángele, defénde nos in proélio contra nequítiam et
insídias diáboli esto præsídium. Imperet illi Deus, súpplices deprecámur:
tuque, princeps milítiæ cæléstis, Sátanam aliósque spíritus malígnos, qui
ad perditiónem animárum pervagántur in mundo, divína virtúte,
In inférnum detrude. Amen.
|
|
|
|
|
I guess it might depend on what you're doing - the following code compiles & runs as expected under VC7.1:
#include <iostream>
#include <string>
int main(int,char**)
{
std::basic_string<unsigned long> ls;
std::basic_string<unsigned long> ls2;
ls.push_back('A');
ls2 = ls;
ls += ls2;
ls += ls;
ls += ls;
std::cout << ls.length() << std::endl;
}
There's a default implementation of char_traits in iosfwd .
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
yes, but it's only defined for char and wchar_t, is it not?
--
Watcha' gonna do, when Hulkamania runs wild on you!?
|
|
|
|
|
|
True - guess who's not done much Unicode programming with STL I have with ATL and COM (BSTR), but not STL...
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
I want to read some data to display from files and save some data to files, If having some samples, could you send to me? Thanks.
|
|
|
|
|
Try this:
fstream m_File;
ios::openmode m_Mode;
m_File.open(m_strFileName.c_str(), m_Mode);
while (!m_File.eof())
{
getline(m_File, strLine);
}
m_File.close();
// write to file
m_file << "Some text" << endl;
|
|
|
|
|
Thank you very much for your reply.
I need it and will try it.
Freehawk
|
|
|
|
|
I want to send a broadcast message, and then a lot of windows can receive and re-display datas which is stored in same memory. How to do? Thanks.
|
|
|
|
|
Hi mr hawk,
use this SendMessage(HWND_BROADCAST,yourMsg, yourwParam , yourlParam);
but this message should be a registered window message. coz this message should be unique so that every window can process it.
you can use RegisterWindowMessage API to create your own unique message.
Regards.
Abhishek Srivastava
Software Engg (VC++)
India ,Noida
Mobile no 9891492921
|
|
|
|
|
Thanks for your reply.
It is useful to me and I will try it.
Freehawk.
|
|
|
|
|
Are you using the ATL DBCLI templates?
If so, are you also calling Update() after calling SetData() ?
Steve S
|
|
|
|
|
If it's a wizard-generated one, then the odds are good that you don't need to call SetData(), just change the member data and call Update.
SetData is normally used in situations where you don't have automatic accessor population, if I remember rightly.
Steve S
|
|
|
|