|
TClarke wrote: When I started C++ I used MFC. I found CString a doddle to use sadly it turned out to be not exactly the finest of string implementations.
I assume you are referring to how it allocates memory, since other than that, it actually offers many features that even the STL string class doesn't give.
TClarke wrote: Has this been resolved in the WTL or should I stick with the STL string or lower level self made implementations?
The answer to this question largely depends on what you are doing. If you are trying to write portable code, I would use std::string. If you are writing Windows-only code and have need for doing certain kinds of string operations, CString is probably the way you want to go.
The newest versions of WTL/ATL/MFC all use the same implementation of CString. Older versions were slightly different for MFC than the other toolkits.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
|
Firstly, thank you to all of you for your respones
I'm using VS.NET creating code only to be used on Windows.
It's encouraging to hear that CString no longer has the reputation it did whilst in it's VC6 incarnation. The issue that alarmed me was that it was considered inefficient and slow, a heavy weight implementation included to bridge the gap until the STL string was completed. though I never noticed any cost to my programs in terms of speed or size.
"Also - what issues did you have with the MFC CString? Not that I've used it that much, I'm just interested"
My main issue is more with the STL implementaion as CString has never been any trouble to use. Why the STL string does not have an implemmentation of CString::Find, or CString::Format and all those Windows crucial overloads that makes CString a breeze to use I don't know but it's always put me off
Thanks
Tom
|
|
|
|
|
Hi
Does any know of a reason for not utilizing the WTL library when writing ActiveX controls in ATL?
Thanks
Tom
|
|
|
|
|
If you are doing windowless controls, then WTL is pretty much useless. If not, then WTL will serve you well.
--
Not based on the Novel by James Fenimore Cooper
|
|
|
|
|
Thanks
|
|
|
|
|
Hi,
I have an array A[10][2].
The first column of the array consists of marks and the second consists of student code number.
I want to sort the array based on the first column.
How do I use stl::sort() to achieve this?
Cutebug
|
|
|
|
|
You can't - arrays aren't assignable objects (i.e. you can't do x = y; where x and y are of type int[2] ), which is a requirement of any of the mutating algorithms.
I'd suggest you use records instead (oh, and std::vector s for storage rather than arrays):
#include <algorithm>
#include <vector>
struct Mark
{
int mark;
int studentCode;
};
bool operator<(Mark const& left, Mark const& right) { return left.mark < right.mark; }
int main(int, char**)
{
std::vector<Mark> marks;
std::sort(marks.begin(), marks.end());
}
Try to forget arrays ever existed...
|
|
|
|
|
Thank you!
Cutebug
|
|
|
|
|
Does anyone know how to use WTL's CToolTipCtrl in dialog box with TTN_NEEDTEXT?
I want to popup a tooltip when mouse hover each control in dialog box.
|
|
|
|
|
|
|
We try to execute a console application as a noninteractive user (NT AUTHORITY/SYSTEM).This console application is supposed to launch an IE process ,and perform certain steps.But it fails to launch the IE browser - is this a characterisitc of such user accounts?If so,is there some way I can make this account launch the browser?I am able to launch the IE broswer successfulyl when i execute as a normal domain account
|
|
|
|
|
Hello, im using wtl to create static text ctrls. The problem is that the background color of these controls does not default to the default color of a plain client window. Which is white in xp and system-grey in windows2000. The color of the static-ctrl is system-grey aswell.
It looks like crap, see it here:
http://hem.passagen.se/storage/bad-color-static-ctrls.jpg
Question: How do i set the background color of the static control, alt, the color of the window, to a default system color which they can share on any windows version.
Im looking for something like AtlGetDefaultGuiFont() but for color.
And how to set it.
Thanks in advance.
|
|
|
|
|
GetSysColor(COLOR_3DFACE) and GetSysColorBrush(COLOR_3DFACE) will give you the colour and a brush. To persuade a static to paint it's background a different colour, the parent needs to handle WM_CTLCOLORSTATIC and return the brush that it wants the static to use.
That help at all?
Steve S
Developer for hire
|
|
|
|
|
It looks like you're drawing a custom background in the dialog. You need to make the static controls' text transparent so that background remains intact.
Handle WM_CTLCOLORSTATIC , call SetBkMode(TRANSPARENT) on the DC, and return a null brush.
--Mike--
Visual C++ MVP
LINKS~! Ericahist | PimpFish | CP SearchBar v3.0 | C++ Forum FAQ
|
|
|
|
|
Dear All,
I stared using WinDbg for Debugging. I used !analyze extension command for analyzing crashed application dump file . it provides me FAILURE_BUCKET_ID. Please let me know how i will use this bucket id to find out the crash code???
With Regards
Manoj
|
|
|
|
|
The best resource I can offer is to go to All Programs, Debugging Tools for Windows, Debugging Help, look up !analyze in the index, then click the link to 'Using the !analyze extension' at the bottom of the page.
|
|
|
|
|
i have a variable whose type is long*.
i wanna assign it to a CComVariant variable.
//put value into variant
CComPtr< IMyInterface > spInter;
long *p = (long*)spInter.p;
CComVariant vt;
vt.plVal = spInter.p;
//how to get value from variant
CComPtr< IMyInterface > spNew;
spNew = (IMyInterface*)vt.plVal; (i can do this because i know the value type in variant, but how could i do if i don't know the type? should i call changetype() first?but what should i pass into ChangeType(???) as parameter?
-- modified at 1:18 Wednesday 16th August, 2006
|
|
|
|
|
An alternate way would be to Detach enclosed VARIANT.
A VARIANT has a member called "VARTYPE vt". You can use this to determine type of Variant.
S o h a i l K a d i w a l a
modified 21-Apr-21 21:01pm.
|
|
|
|
|
|
thanks guys,
here is my situation.
i have a class which hold a tree control(activex control), sure tree control offer setItemData(item, data), getITemData(item, &data);
here data's type is converted to long*.
i wanna store the interface pointer address in the item data, and get it back when i need.
VARIANT DelegateGetData(item)
{
long *data;
getItemData(item, data);
CComVariant vt;
vt.plVal = data;
return vt;
}
CComVariant vt = DeletgateGetData(item);
CComPtr<imyinterface> spData((IMyInterface*)vt.plVal);//it there any better way here???
|
|
|
|
|
Hi,
Does anybody know of a way that I can host an ActiveX control in such a way that it draws to a memory context instead of directly to the screen? I'd like to modify what the ActiveX control displays before it hits the screen, rather than try and draw on top of it once it has already been drawn, which is asking for trouble. Im currently using CAxWindow to host the control.
Thanks,
Andy
|
|
|
|
|
One possible approach that I have found after search the net for an answer is from a MS MVP who suggests: "...get the view image via IViewObject and use the view change notification. It seems you are supposed to derive a class from
CAxWindow and implement IAdviseSink's methods (it already derives from IAdviseSink)."
This seems a relatively straight forward approach in theory, but I wasn't aware that CAxWindow is derived from IAdviceSink, or at least it doesn't seem so from looking at CAxWindow's implementation in AtlWin.h. Does this sound at all feasible? If so, I would appreciate a little guidance with regards to going about implementing it.
Many thanks,
Andy
|
|
|
|
|
hi guys ,,,,,,,,,
please any one of u can provide me a vc++ TAPI sample which makes a call to the phoneee.........
its urgent man plz help........
thnx in advance........
best regards
Rocky
|
|
|
|