|
Do you need to SetCurrentDirectory?
|
|
|
|
|
Hi , I am using .dll file of another company. they provide me the sample
that use LoadLibary method .but I do not want to use LoadLibrary Method. they also do not provide be import library . so can any one tell me how
to generate a import library from the .dll file
Trioum
|
|
|
|
|
|
I got the same solution before i read your reply. By the thanks indeed for your generosity.
But actually i wanted to know about using CArchive with CFile.
Regards,
Hemang
|
|
|
|
|
Hi,
What are the methods to skin the systray clock?
Thank you
|
|
|
|
|
Hello all,
I have used CFile for writing. I want the same to be opened in appending mode. i.e. i want to add some contents more to it. I know little that this might be done with CArchive bu don't know how to use it. or is there any other alternative in CFile to do so?
Regards,
Hemang
|
|
|
|
|
Hemang Raval wrote: I have used CFile for writing. I want the same to be opened in appending mode. i.e. i want to add some contents more to it.
To add content, simply call CFile::SeekToEnd and then write.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
When processing the above message in DllMain
would GetCurrentThreadId get the ID of the Newly created Thread
|
|
|
|
|
It should, form MSDN http://msdn2.microsoft.com/en-us/library/ms682583.aspx[^]:
The current process is creating a new thread. When this occurs, the system calls the entry-point function of all DLLs currently attached to the process. The call is made in the context of the new thread.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Thankx from this I could probably figure out who is calling me
|
|
|
|
|
Does anyone know if you can use Cfile::typeText in a "text file" only File? I've seen eamples of Stdiofile and Memfile but no examples of a simple textfile.
A C++ programming language novice, but striving to learn
|
|
|
|
|
I'm not sure what you're asking. A CStdioFile opened in
CFile::typeText mode would be for working with text files, right?
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm asking the wrong question I guess.Must you have a class "CStdioFile" in order to use CFile::typeText.
Here's my code:
TCHAR szBuffer[512];
UINT nActual = 0;
csFileName = "C:\\Shop Maintenance System\\REPORT FORMS\\TruckMaint.txt";
HANDLE hFile = CreateFile(_T(/*"CFile_File.dat"*/csFileName),
GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE,
NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL);
if (hFile == INVALID_HANDLE_VALUE)
{
AfxMessageBox(_T("Couldn't create the file!"),MB_OK|MB_ICONEXCLAMATION);
}
else
{
// Attach a CFile object to the handle we have.
CFile m_fle(hFile);
//static const TCHAR sz[] = _T("I love CFile!");
m_fle.SetFilePath(csFileName);
// write string
//m_fle.Write(sz, sizeof(sz)); //Write( szBuffer, sizeof( szBuffer ) );
//m_fle.Write( szBuffer, sizeof( szBuffer ) );
m_fle.Seek( 0, CFile::begin );
nActual = m_fle.Read( szBuffer, sizeof( szBuffer ) );
// We can call Close() explicitly, but the destructor would have
// also closed the file for us. Note that there's no need to
// call the CloseHandle() on the handle returned by the API because
// MFC will close it for us.
m_fle.Close();
What the buffer contains is a bunch oontains is a bunch of "ffffffffffffffffffffffffffff...." so I think it's not giving me the text that I know is in the file. How do I get the text with the carrage returns, etc.?
A C++ programming language novice, but striving to learn
|
|
|
|
|
Larry Mills Sr wrote: Must you have a class "CStdioFile" in order to use CFile::typeText
Yes, or some other CFile-derived class that supports the flag.
The docs specifically state the flag is for CFile-derived classes.
If you try to use it with a straight CFile, it will assert.
If you want to use the CreateFile()/CFile method as shown, you'll need
to parse the file as text yourself.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Could you explain what you mean, exactly, by "you'll need
to parse the file as text yourself.". I have no idea what you mean.
Please excuse my ignorance.
A C++ programming language novice, but striving to learn
|
|
|
|
|
If you use CStdioFile , you can read the file line-by-line. With CFile , you read the file in chunks, which may (not) cross line boundaries.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
In addition to DavidCrow's reply...
The file will be opened in binary mode. That means you just
read or write bytes. These bytes can be anything. If you
choose to treat them as text, then you'll have to parse for whitespace,
line endings, and/or whatever else. The framework will give you no
built-in help for treating the file contents as text.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I have asked this question before and were given some good answers. The problem is I am a beginner. I have no idea of where to get started. So when I am told about coordinates and bitmaps I am lost. I have written a C++ program. I can run it now by clicking on the default blue and white box. I want to have like a nice Box with the name of the program written on it. When you click on the box the program runs. Are there books on how to do this? Can someone give me some advice for dummies? If you are unsure of what i am asking let me know.
Thank You and have a Merry Christmas and Happy New Year
|
|
|
|
|
Did you search on the codeproject?
|
|
|
|
|
Hi,
What is the best place to dertermine the item height of a CListCtrl item in report mode, even when there are no items present yet and how exactly is it done ?
tia.
|
|
|
|
|
Have you looked at CListCtrl::GetItemRect(...)?
|
|
|
|
|
create a CImagelist for this list control. then call SetImageList with LVSIL_STATE , the image height is item height.
Are you have gtalk ? please add me: xiangyangzhao@gmail.com
|
|
|
|
|
Hello everyone,
Here is Bjarne's exception safe sample,
http://www.research.att.com/~bs/3rd_safe.pdf
template <class t=""> class Safe {
T* p ;
public :
Safe () : p (new T ) { }
˜Safe () { delete p ; }
Safe& operator =(const Safe&a) { *p = *a .p ; return *this; }
};
template <class t=""> class Unsafe {
T* p ;
public :
Unsafe (T* pp ) : p (pp ) { }
˜Unsafe () { if (!p->destructible ()) throw E(); delete p; }
Unsafe& operator =(const Unsafe&a)
{
p->˜T ();
new(p)T (a.p );
return *this;
}
};
</class></class>
What makes me confused is, the description about why it is not exception safe,
--------------------
The assignment operator may fail by throwing an exception from T ’s copy constructor. This would
leave a T in an undefined state because the old value of *p was destroyed and no new value
replaced it.
--------------------
In my study, I can not find a case why there is exception thrown from Unsafe's copy constructor. Any ideas?
BTW: it is also appreciated if you could share some experiences about what in your minds does invariant status mean
(in Bjarne's minds, exception safety means making the object into invariant status). I find the word *invariant* is
somethings hard to understand.
thanks in advance,
George
modified on Monday, December 24, 2007 3:02:32 AM
|
|
|
|
|
Hey George, please reformat your post (it is a difficult question even with well formatted one!).
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
[my articles]
|
|
|
|
|
Thanks CPallini,
I have re-formatted it. Is that ok now?
regards,
George
|
|
|
|