|
|
ifstream and wifstream (like all C++ stream and string classes) are char and wchar_t variants of
basic_ifstream< CharT, CharTraits = std::char_traits< CharT > >,
where CharT is the character type and CharTraits is a specialization of std::char_traits< CharT >, or a compatible class.
Therefore, you can have:
typedef std::basic_string< TCHAR > _tstring; // TCHAR string!
typedef std::basic_ifstream< TCHAR > _tifstream; // TCHAR input file stream
class std::char_traits< Unicode >{ ... }; // pseudo-code
typedef std::basic_ifstream< Unicode > uifstream; // Unicode input file stream
or
class UnicodeTraits{ ... }; // char_traits-like class
typedef std::basic_ifstream< Unicode, UnicodeTraits > uifstream2;
Note that the file path is const char *, so this will not support wide/Unicode paths.
HTH
Reece Haston Dunn
Software Engineer, Sophos
Web: www.sophos.com
Sophos - protecting businesses against viruses and spam
|
|
|
|
|
The Createinstance method is not working properly.It does not return
the handle what is the problem ..?
DG
|
|
|
|
|
I hope it will work..
CLSID clsid;
HRESULT hr;
here u possed application with interface...
hr=CLSIDFromProgID (L"Word.Application", &clsid);
if (hr!=S_OK)
AfxMessageBox(":failed to get the clsid");
// Create an instance of the Word application and obtain the pointer
IUnknown* pUnk;
IDispatch* pDispApp=NULL;
hr = ::CoCreateInstance( clsid,
NULL,
CLSCTX_SERVER,
IID_IUnknown,
(void**) &pUnk);
// Query IUnknown to retrieve a pointer to the IDispatch interface
hr = pUnk->QueryInterface(IID_IDispatch, (void**)&pDispApp);
ASSERT(pDispApp);
Thanks,
Anji.Manchikanti
|
|
|
|
|
Hi,
Better Register Dll using Regsvr32 and then use
CoCreateInstance for creating a COM instance.
|
|
|
|
|
The Createinstance method is not working properly.It does not return
the handle what is the problem ..?
DG
|
|
|
|
|
I'm quite experienced with MFC and MFC's "templatized collections". However, I'm writing an ATL server and need to track a map of client connections. I'd like to do this via a handle (actually a GUID) that I return to successfully connected clients. Therefore the map will be Handle-To-ConnectionObj. How is this done via ATL?
|
|
|
|
|
I've not used VC++ 7 but a casual look at the Help shows that there are a number of sample applications that illustrate using the collections. I assume you're using VC++ 7?
Kevin
|
|
|
|
|
Hi,
Any one know "How to develope old db provider in vc++ by ATL" help me...
thanks
Thanks,
Anji.Manchikanti
|
|
|
|
|
I'm having a CRichEditView for a long time in my code and suddenly the backcolor when typing something in the view is black....??like a square black around each letter I'm typing??
I patched it by doing a charformat in the OninitialUpdate
CHARFORMAT2 cf2;
m_editCtrl->GetDefaultCharFormat(cf2);
cf2.dwEffects = 0;
cf2.crBackColor = ::GetSysColor(COLOR_WINDOW);
SetCharFormat (cf2);
but when I'm doing an undo the black backcolor coming back and with the letter BOLD and with the letter higher than when I setted it at star....????
I overloaded functions OneditUndo and OnEditRedo and by writing the same code.
It works but it's not really nice...
Is there anybody who had that same problem??
|
|
|
|
|
can anyone briefly explain me about .NET porting ?
What are the significant changes need to be done after porting a VB application to VB.NET?
|
|
|
|
|
ATL, WTL and STL are all template libraries in C++. Why did you ask this question here ?
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
I have a BHO vs c++ project working!
I can write code in the DISPID_BEFORENAVIGATE2 of the invoke, or use the IWebBrowser. What I want to do is add my own http header attribute to every request going from the browser.
How can I do that?
|
|
|
|
|
I develop a tree control, it is displaying the drives and folders. In WTL the following two handlers are not working simultanously.
REFLECTED_NOTIFY_CODE_HANDLER(TVN_ITEMEXPANDING, OnItemExpanding )
MESSAGE_HANDLER(WM_LBUTTONDOWN,OnLButtonDown)
If i write the OnLButtonDown handler OnItemExpanding is not woring.
But MFC both are working simultanously.
plz reply to me.
Thank you.
|
|
|
|
|
|
I have Made one Com Dll for doing communication with
serial port.
This Dll contains all the funtions for communication
with Serial port.
and i am having one application which is having
2 threads..
and
These 2 threads continously calling the functions
of dll.so is there any need of syn.in side the dll
for communcating with comport..
because
for example my first thread calling one fun. of dll
and if it transmits the data and now it is waiting
for response getting data from serial port.At the
same time if my second thread call the same fun.
of dll then what happnes it will be called after
finishes first or it is called and creates the
problem in getting response of app. funcaiton
calling..means i want to know that
syn. is this handle by automatically com dll or have to
give some extra provistion for this ??
|
|
|
|
|
I have Made one Com Dll for doing communication with
serial port.
This Dll contains all the funtions for communication
with Serial port.
and i am having one application which is having
2 threads..
and
These 2 threads continously calling the functions
of dll.so is there any need of syn.in side the dll
for communcating with comport..
because
for example my first thread calling one fun. of dll
and if it transmits the data and now it is waiting
for response getting data from serial port.At the
same time if my second thread call the same fun.
of dll then what happnes it will be called after
finishes first or it is called and creates the
problem in getting response of app. funcaiton
calling..means i want to know that
syn. is handle by automatically com dll or have to
give some extra provistion for this
|
|
|
|
|
It depends how you have CoCreated the com component in your appllication. If you are sharing single com object between two threads then you definetly need sync code in your application. And sharing com object between two threads needs special sync mechanism
But I guess if you have seperate com objects in each thread then you may not need any synchronization code.
|
|
|
|
|
|
It's just a simple macro
#define STDMETHOD(method) virtual HRESULT STDMETHODCALLTYPE method
What do you not understand about it?
|
|
|
|
|
If you're asking what is it used for, it's used for most methods when you write a COM interface definition. The "standard" methods have a return type of HRESULT and a calling convention of __stdcall .
--Mike--
Visual C++ MVP
LINKS~! Ericahist | 1ClickPicGrabber | CP SearchBar v2.0.2 | C++ Forum FAQ
Strange things are afoot at the U+004B U+20DD
|
|
|
|
|
I'm currently working on an imaging application. I use a subclassed file dialog to allow the user to import items into my app.
I want to be able to allow the user to select images / folders so they can recursively import the items from the subfolders.
I've inserted a handler into my code to deal with the open button clicked command with the intention of creating a list of the currently selected images / folders.
However whenever I try and access the list view the number of selected items is zero.
I've tried calling CListBox::GetSelCount() and CListBox::GetSelItems() , both with no success.
Has anyone been able to access the contents of the file list in a WTL file dialog?
|
|
|
|
|
Errrrm - CListViewCtrl rather CLIstBox?
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
Hi
I have the following
class MyClass
{
private:
std::ofstream out;
public:
MyClass() {out.open("C:\\test.txt" , std::ios::out);}
template <typename T> MyClass& operator<<(const T& t)
{
out << t;
return *this;
}
};
and it works well...
MyClass myinstance;
myinstance << "Hello " << 2.4;
except...the logical way for a new line is std::endl so...
myinstance << "Hello" << std::endl;
but this throws a compiler error of
<br />
'class MyClass &__thiscall MyClass::operator <<(const T &)' : cannot use function template 'class std::basic_ostream<_Elem,_Traits> &__cdecl std::endl(class std::basic_ostream<_Elem,_Traits> &)' as a function argument<br />
Do I have to implement my own std::endl? Basically, I'm stuck...
Any info on this, much appreciated.
Cheers
Angel.
******************************************************
I once bought a book called 'Learn to read in 21 days'
Nigel Spoon - 1998
|
|
|
|
|
Your operator is missing some stuff that should be there - check out my article for info:
http://www.codeproject.com/vcpp/stl/iostreaminserters.asp[^]
To be honest, it's long enough since I did this sort of thing that I don't know if any of that will help, but it will improve your implimentation anyhow.
Don't forget that std::endl sends an endline AND flushes the stream. I don't know if this could cause your problem, but it's something that is often overlooked.
Christian Graus - Microsoft MVP - C++
|
|
|
|