|
Christian Graus wrote:
YEs, I've actually noticed that it isn't when using the memory window. But if you want zero terminated, then you're reading, not writing. In that case, c_str() is fine.
I frequently need to read and write the same buffer. (I use a library that does a lot of in-place modifications of string buffers.)
Christian Graus wrote:
You're kidding, right ? How is (0x%x) easy to ready, and not error prone ?
I find it easy to read
Of course, one has to know the printf format types and flags, but if you know them it is a very compact representation of what you intend to do...
Sometimes I got the feeling I am a bit old-fashioned.
(Actually the truth is, that I have learned C++ IO before I learned how to do it in C. Believe it or not: I was used to use ostream for quite a long time and then I moved to printf )
--
Daniel Lohmann
http://www.losoft.de
|
|
|
|
|
Check out _splitpath() .
CString strPath = "C\\I386\\IAS.MDB";
char* pFullPath = strPath.GetBuffer (0);
_splitpath (pFullPath, ...);
strPath.ReleaseBuffer();
I'm working on releasing my FileSystem class to CP, which will make stuff like this easy to do.
Btw, have you become "nss" now?
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Nope nss because its my home account. I wanted email to come here while I'm here, and you have to have another identity it appears for a different email(my experimentation). Thanks for that very interesting bit of code. Guess you're back now that the place has been cleaned up by the housekeeper ....
|
|
|
|
|
She spends 2-3 hours at my place (I'm a neat freak so it's easy to clean), but I spent most of the day at the bookstore and in search of food. Gonna lull myself to sleep with Petzold's C# tome.
I really should start posting articles again. I have a bunch of GUI helper code that would make the list control gymnastics you alluded to easy to do. Plus stuff for getting and validating edit controls, easily setting bunches of radio buttons, etc, etc. Stuff I got tired of duplicating in each project.
I'm going to crash now because I'm soooo sleepy. G'night!
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
...or alternatively you could use the Path functions in SHLWAPI. While _splitpath does this job, the Path ones will do some more difficult and tricky ones.
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
|
Thank you very much indeed!
ns
|
|
|
|
|
I have created a CConBttn Class with a CButton base class...
On the "OnKeyDown" event, im trying to add text in to a modal dialog.
Is this possible??
if so... HOW!!!
thanx in advance.
Scott
|
|
|
|
|
If your dialog is modal, then your keydown event will not be caught if it is not within the dialog in question.
Christian
come on all you MS suckups, defend your sugar-daddy now. - Chris Losinger - 11/07/2002
|
|
|
|
|
Ugh, that is soooo hard to read! Your name sounds familiar. Are you related to Mark Perham, the guy who wrote that cool Explorer look-alike way back when?
(Sorry, I didn't end up answering your question).
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I've got an SDI app with a CFormView in the main frame when it initializes. That works fine. I'd like to be able to toggle on/off that view to an empty client view via a menu command.
The MSDN docs say you can only have one view at a time in SDI but doesn't give any examples on how to remove the current view, create a new one and do I need a new frame window to do it?
I've tried to switch to a simple text view....but, I'm still trying to learn this doc/view stuff.
appPtr->pDocTemplate->RemoveDocument(GetActiveDocument());
delete appPtr->pDocTemplate;
appPtr->pDocTemplate = new CSingleDocTemplate(IDR_TEXTTYPE,
RUNTIME_CLASS(CTest3Doc),
RUNTIME_CLASS(CMainFrame),
RUNTIME_CLASS(CTextView));
appPtr->AddDocTemplate(appPtr->pDocTemplate);
|
|
|
|
|
|
Thanks. I found something here. D-OH-H-H-H!!!! I Should have checked first. Anyways, in case anyone else want to know:
http://www.codeproject.com/docview/replacingview.asp
http://www.codeproject.com/docview/switchingviews.asp
|
|
|
|
|
I Read the article http://www.codeproject.com/useritems/asyncwininet.asp;
and write the code like 'asyncdemo' which from msdn:
http://msdn.microsoft.com/downloads/samples/internet/default.asp?url=/downloads/samples/internet/networking/asyncdemo/default.asp
but I have a question
when I call InternetQueryDataAvailable() ,it return ERROR_IO_PENDING
then I will recieve a callback status :INTERNET_STATUS_REQUEST_COMPLETE
and the LPINTERNET_ASYNC_RESULT (lpvStatusInformation)->dwError!=0,
the download incorrect.
what's the matter???
the 'asyncdemo' alse download file incorrect
who have the source code of asynchronous download
thanks very much
|
|
|
|
|
I am interested in making a window similar to a start bar but creating it at the top of the desktop and having it so that when a window is maximized it won't cover over the window I have created (instead all windows) will think that the bottom of my window is the top of the screen.
I know this can be done but I don't even know what it is called. If anyone could even tell me what this is called or point me in the right direction it would be greatly appreciated.
Thanks
|
|
|
|
|
Check out the SHAppBarMessage API. I've been meaning to right my first CP article on this - I promise I will get round to it as soon as I have moved house (about a week to 10 days ish, if you can wait that long)
Dylan Kenneally
London, UK
|
|
|
|
|
After creation of ur window, use SetWindowPos(...) with HWND_TOPMOST property for the hWndInsertAfter parameter. This will ensure that your application maintains its topmost position even when it is deactivated, ie other applications are having focus.
|
|
|
|
|
Hello,
I'm trying to use TextOut() to put a string to a window, but when I put the \n or \r\n in the CString.Format(), they print as black-boxes, not linefeeds. My intent is to get one CString with linefeeds to print to the screen.
Any ideas? Thanks!
JennyP
|
|
|
|
|
|
Golly... that seems like a lot of work to keep track of the text positioning! What about word processors? Do they keep maps of each line of text and its position? I would assume this is available in some control....?
thanks! JP
JennyP
|
|
|
|
|
|
You can have Windows wrap text for you if you use DrawText() . Use the DT_CALCRECT flag to determine the rect's dimensions before writing. You should also use DT_WORDBREAK . As functions go, it's a most excellent function!
/ravi
Let's put "civil" back into "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I spotted that someone suggested you use DrawText() with DT_CALCRECT . When you have multiple lines MSDN states that DrawText() with DT_CALCRECT will not alter the .right attribute of your CRect , but when I tried to use that (with both \n and \r\n as line breaks) DrawText() always altered the .right attribute! To get round this, you might want to try the technique used in Roger Allen's 'Example of how to print a long CString across multiple pages' of output using the MFC print architecture
' article.
Dylan Kenneally
London, UK
|
|
|
|
|
I have a class - CVariable In the constructor I want to transfer the address of that instance to a CVariableManager class so that I can iterate though all my CVariable instances. I use
CVariableManager::Add(CVariable * pvar) and from the constructor add the CVariable m_VarMgr::Add(this)
The trouble is that the this value is always the same value. I assume that it points to the vtable for the function addresss.
How can I get a pointer to the data instance
HHEELLPP!
David
|
|
|
|