|
I'm assuming that you want to keep supporting some of the functionalities of IString - but want to start moving to STL? I had a quick look at the documentation of IString, it seems to have a conversion operator to char*, so you should be able to directly construct a std::string from an IString, provided your IString's will never have embedded nulls.
What follows is a (hack) way of extracting the data in a way similar to what you are doing, because the stream extraction operators will read until they reach whitespace (and AFAIK, you can't change the definition of whitespace). One function which gets around this limitation is getline, which (optionally) stops at a delimiting character. This won't work without modification under VC6 (requires an STL patch from dinkumware)
#include <iostream>
#include <sstream>
int main()
{
std::istringstream iss("12#34#56#78#90#ab");
std::string I1,I2,I3,I4,I5,I6;
std::getline(iss,I1,'#');
std::getline(iss,I2,'#');
std::getline(iss,I3,'#');
std::getline(iss,I4,'#');
std::getline(iss,I5,'#');
std::getline(iss,I6,'#');
return 0;
}
'The Standard C++ Library' by Josuttis is a good reference if you get stuck, it covers all of this and more in depth.
If you can keep you head when all about you
Are losing theirs and blaming it on you;
If you can dream - and not make dreams your master;
If you can think - and not make thoughts you aim;
Yours is the Earth and everything that's in it.
Rudyard Kipling
|
|
|
|
|
Thanks Andrew..i am enlightened by this..
I went by another approach by writing a new class to over load the extraction operator
Sas
|
|
|
|
|
What is the interface against which one typically queries
IID_ITableCreation ? IID_IDBInitialize ? IID_IDBCreateSession ? I'm a bit lost
here.
Regards,
João Paulo Figueira
Embedded MVP
|
|
|
|
|
I've sorted this one out: one has to query for ITableDefinitionWithConstraints ...
Regards,
João Paulo Figueira
Embedded MVP
|
|
|
|
|
Among 256 colors in palette, 16 are allocated for
graphics and 240 are for grey-scale video.
I use same palette for selecting into hDC and for
making bitmap.
256 was returned by RealizePalette(hdc).
However, video quality under 8-bit display is worse
than 16-bit display.
Can you give me some clue ?
|
|
|
|
|
I am not sure what you are asking. When you are using the windows api in 8 bit mode you can only display 240 different colors no matter what palette you try to use. This restriction does not exist if you use full screen directdraw. As in full screen directdraw you can use 254 colors + white + black. In 16 bit mode you have 65K colors so it can and will look better.
John
|
|
|
|
|
So why does RealizePalette() return 256 ?
You mean I should keep the size of my palette under 240 ? This way I will leave the top 16 empty.
R/
|
|
|
|
|
hi,
this is my observation , correct me if i am wrong .
I was defining a UDT which consist of a
[uuid(D8B3861A-74C6-11d2-0000-00C04FB17CDB)]
struct _BSSID_INFO
{
BSTR name;
short grade;
//classification type;
VARIANT_BOOL graduate;
};
in the IDL file.
Now when i was compiling with Default Visual Studio IDE Compiler it gave the
following errors :-
error MIDL2072 : inapplicable attribute : [uuid] [ Struct '_BSSID_INFO' ]
error MIDL2072 : inapplicable attribute : [uuid] [ Struct '_BSSID_INFO' (
Parameter 'bssid_info' ) ]
warning MIDL2039 : interface does not conform to [oleautomation] attribute :
[ Parameter 'bssid_info' of Procedure 'get_BSSID_INFO' ( Interface
'ICWiFiMgr' ) ]
but when i compiled with new vesrion of compiler and replaced it with new
MIDL.exe in the bin dir of VS6 it compiled correctly.
Any Inputs
--
Tarun..
Knowledge Seeker............
**********************************************************************
Tarundeep Singh Kalra
(tarundeep1976_nospam_at_yahoo_dot_nospam_dot_com)
tarun_at_tarunsadhana_dot_com
visit:www.tarunsadhana.com
*************************************************************************
Blue Pill or Red Pill........??
|
|
|
|
|
Hi!, my wtl app has a dialog that contains some edit boxes whit the password style, however, when i run the app and i type something in these boxes, instead of getting those nice "black dots" like you do on all XP password-edit boxes, i get some "weird" vertical lines, they kinda look like thick binary OR operators " | ".
any idea of what im doing wrong?
Thanks!
|
|
|
|
|
You have to set the right font, I think it was Tahoma, but not 100% sure.
Jens
|
|
|
|
|
I had the same problem a while back when I added a manifest to a MFC project - the password edit boxes had vertical lines instead of nice round circle characters.
The issue was that the edit control had the wrong font associated with it.
In that project I added the following in the dialogs OnInitDialog() function...
GetDlgItem(IDC_EDIT_PASSWORD)->SetFont( CFont::FromHandle((HFONT)GetStockObject(DEFAULT_GUI_FONT)) );
In WTL, it might* look something like this...
::SendMessage(GetDlgItem(IDC_EDIT_PASSWORD), WM_SETFONT, (WPARAM)AtlGetStockFont(DEFAULT_GUI_FONT), MAKELPARAM(FALSE, 0));
*your mileage may vary
[ Jason De Arte | Toy Maker | 1001010.com ]
|
|
|
|
|
Make sure your dialog font is set to MS Shell Dlg and not MS Sans Serif . The dot thingy in XP is a Unicode character that MS Sans Serif does not contain.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Pinky, are you pondering what I'm pondering?
I think so Brain, but how will we fit the hamster inside the accordion?
|
|
|
|
|
I set the font to Tahoma in resource editor and the problem dissapeared
Thanks guys!
|
|
|
|
|
Hi,
i am facing some problem while working with streams in my C++ program using STL
main(){
..
..
char buf[256];
stringstream infLine(buf);
infline<
|
|
|
|
|
Hi. First of all, the line
infline<<string1<<string2<<infline; is a little suspicious. You sure you want to insert infline into itself? Won't you mean the following?
infline<<string1<<string2<<endl; Now with the rest. I guess (only guess since you provide little info) you are trying to postprocess the results inspecting buf , but this is not how stringstream works. When constructing infline , the contents of buf are copied to its internal buffer, so infline won't use buf anymore. If you want to postprocess what's left inside of infline , use the str() member function:
stringstream infline;
infline<<string1<<string2<<endl;
string result=infline.str(); Does this help?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
yeah..it did helped..
Thansk a lot
|
|
|
|
|
I am trying to develop an NT Service, novice in the field and running into following problems.
Let me simplify all the steps to explain problem i am facing, please let me know if i am doing anything wrong
I create a NT Service using Visual Studio 6 ATL Com wizard without a single line of my own code added here. Only thing i change is remove command from Project/Settings/Custom Build that re-registers the service. After that I compile the project. Let say name of the service is MyService. I use following commands to register and unregister service.
MyService -Service
.. start and stop the service
MyService -Unregserver
after this unregserver command this service goes in "Diabled" mode as shown in SCM and now if i want to re-register the service i can "Service cannot be deleted" message box. To only way to register the service again is to logoff the box.
Since I haven't added any of my code in this test project, there shouldn't be case of any dangling handle.
Any ideas?
|
|
|
|
|
hi,
yes, after we delete an NT service the SCM behaves this way. it is true for services created as console app also - not only for ATL NT services. Otherwise one thing we can do is:
Instaed of unregistering the service programaticaly do the following,
1) Close SCM if it is open
2) Go to the service database and directly remove it from there. service databse is HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services.
3) Open SCM. Now that service will not be listed there in the SCM with that 'disabled' status.I had done some services around two yr back and i think i solved it this way -i dont remember exactly.
rgds...mil10
|
|
|
|
|
Hi All,
I want to create a Toolbar in a Activex control. Activex Control is being created as a DLL which will be invoked in a HTML page and I am working on Visual C++ 7.1 version.... I am trying with the following code but te toolbar is not getting displayed on the dialog...I am trying out this code in OnInitDialog()...
-------------------------
HWND hWnd;
hWnd = CFrameWindowImplBase<atl::cwindow, atl::cframewintraits="">::CreateSimpleToolBarCtrl(m_hWnd, IDR_MARKUPTOOLBAR,
FALSE, dStyle);
CFrameWindowImplBase<atl::cwindow, atl::cframewintraits=""> *myFrame = new CFrameWindowImplBase<atl::cwindow, atl::cframewintraits="">;
myFrame->Attach(hWnd);
if(hWnd)
MessageBox("Working");
--------------------------------------------------
Can any one suggest me what is wrong or any other way to do the same....
|
|
|
|
|
Do anybody know a convenient way to compare a variant string to constant string?
VARIANT varName;
VariantInit(&varName);
// varName is given a string value here
// Now I want to find out if the string contained in varName equals to a const string
VariantClear(&varName);
Thanks
|
|
|
|
|
A VARIANT that holds a string has the type VT_BSTR , you can compare a BSTR with wcscmp() :
if ( 0 == wcscmp ( varName.bstrVal, L"some string" ) )
{ }
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
Pinky, are you pondering what I'm pondering?
I think so Brain, but if we shaved our heads, we'd look like weasels!
|
|
|
|
|
Thanks, exactly what I need
|
|
|
|
|
Hi,
While i want to use CComSafeArray by adding "atlsafe.h",i encounter some compilation error.
#include "atlsafe.h"
CComSafeArray<char> sa;
How can i resolve this problem.Could you tell me please what problem is about "atlsafe.h"? Even if i dont add
"CComSafeArray<char> sa;" in code page,i am getting some errors.
//////////////////////////////////////////////////////////////////////
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(84): error C2913: explicit specialization; 'ATL::_ATL_AutomationType' is not a specialization of a class template
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(84): error C2974: 'ATL::_ATL_AutomationType' : invalid template argument for 'T', type expected
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(85): error C2913: explicit specialization; 'ATL::_ATL_AutomationType' is not a specialization of a class template
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(86): error C2913: explicit specialization; 'ATL::_ATL_AutomationType' is not a specialization of a class template
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(87): error C2913: explicit specialization; 'ATL::_ATL_AutomationType' is not a specialization of a class template
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(215): error C2039: 'type' : is not a member of 'ATL::_ATL_AutomationType'
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(215): error C2039: 'type' : is not a member of 'ATL::_ATL_AutomationType'
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(87) : see declaration of 'ATL::_ATL_AutomationType'
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(215): error C2065: 'type' : undeclared identifier
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(215): error C2955: 'ATL::_ATL_AutomationType' : use of class template requires template argument list
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(87) : see declaration of 'ATL::_ATL_AutomationType'
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(572) : see reference to class template instantiation 'ATL::CComSafeArray<t>' being compiled
with
[
T=BSTR
]
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(215): error C2975: '_vartype' : invalid template argument for 'ATL::CComSafeArray', compile-time evaluatable constant expression expected
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(135) : see declaration of '_vartype'
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(215): error C3861: 'type': identifier not found, even with argument-dependent lookup
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(220): error C2039: 'type' : is not a member of 'ATL::_ATL_AutomationType'
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(220): error C2039: 'type' : is not a member of 'ATL::_ATL_AutomationType'
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(87) : see declaration of 'ATL::_ATL_AutomationType'
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(220): error C2955: 'ATL::_ATL_AutomationType' : use of class template requires template argument list
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(87) : see declaration of 'ATL::_ATL_AutomationType'
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(220): error C2975: '_vartype' : invalid template argument for 'ATL::CComSafeArray', compile-time evaluatable constant expression expected
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(135) : see declaration of '_vartype'
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(220): error C3861: 'type': identifier not found, even with argument-dependent lookup
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(220): error C3861: 'type': identifier not found, even with argument-dependent lookup
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(240): error C2039: '_typewrapper' : is not a member of 'ATL::_ATL_AutomationType'
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(87) : see declaration of 'ATL::_ATL_AutomationType'
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(240): error C2039: '_typewrapper' : is not a member of 'ATL::_ATL_AutomationType'
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(87) : see declaration of 'ATL::_ATL_AutomationType'
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(240): error C2143: syntax error : missing ';' before '&'
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(240): error C2143: syntax error : missing ';' before '&'
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(240): error C2955: 'ATL::_ATL_AutomationType' : use of class template requires template argument list
D:\Program Files\Microsoft Visual Studio .NET 2003\Vc7\atlmfc\include\atlsafe.h(87) : see declaration of 'ATL::_ATL_AutomationType'
|
|
|
|
|
Hi can we use the .NET assemblies in ATL.
Regards
Tarun
Blue Pill or Red Pill........??
|
|
|
|
|
If a .NET assembly is registered for COM interop (using regasm , the facilities from Windows Installer, or using the appropriate option in VS.NET), you can use it in the same way as any other COM object.
Stability. What an interesting concept. -- Chris Maunder
|
|
|
|