|
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
|
|
|
|
|
Uhm, no George, unless the tongue sticking out of the faces is intentional.
Insert a blank between : and p in you code, otherwise you'll get :p.
Have a nice day.
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 followed your advice, cool! Do you think the format is ok now?
regards,
George
|
|
|
|
|
OK, now let's move to the question:
I think that the copy constructor can fail because it relies on the assignment operator
that in turn, relies on T copy constructor.
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 do not know why T's copy constructor can throw an exception. In what situation will it throw an exception?
regards,
George
|
|
|
|
|
Well, I haven't the book, so I take it as a hypothesis. If you have it, you can further investigate reading §10.4.11 .
The author also points out that allocation may fail.
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]
|
|
|
|
|
Maybe placement operator new will throw some exceptions? I do not know. It is appreciated if you or other people could give some insight.
regards,
George
|
|
|
|
|
|
Do you have a question in all of that gibberish somewheres?
"Real programmers just throw a bunch of 1s and 0s at the computer to see what sticks" - Pete O'Hanlon
|
|
|
|
|
Hello there ,
I want to get handle of specific application before start ,but i don't know how can i get that message and process it . in fact , i don't know exactly which message , i must be process .
Thank you .
DMASTER
|
|
|
|
|
I think for get a handle to a program you need to run it.
|
|
|
|
|
Dear Hamid, thanks to your reply.
But, my question is that, when ever the user runs an application, how can i make a notification of that process start, in my own application.
In fact, i want to query the process-start! I wonder if any system message (or any other method) exists, when an application starts?!
DMASTER
|
|
|
|
|
If you know name of program you can use of FindWindow but if you dont know name of program you can use of EnumDesktopWindows for Enumerates all windows or EnumWindows for enumerates all windows on the screen that it gives you a handle to each window.
|
|
|
|
|
I know these functions and their usage! but as you know, I should use them AFTER the process is already ran, and (for example) i should use them on the click of a button!
the problem is that, my application should be aware of the process start, AS SOON AS THE PROCESS STARTS, and do its job automatically. I'm looking for a method, to make my application aware of the start event FOR ALL THE APPLICATIONS, not just an specific one. Something like a system message (WM_*), which is sent to ALL the applications (including mine) to notify them of a process start.
DMASTER
|
|
|
|
|
Hello Developer611,
Sounds like you need SetWindowsHookEx() with WH_CBT. Look it up in MSDN. It may help you.
- Bio.
|
|
|
|
|
|
Could someone please help me to find out why the following code asserts:
CDialog dlg = new CDialog();
// hide edit control in dialog
CEdit *pEdit = (CEdit*)dlg.GetDlgItem(IDC_EDIT1);
pEdit->dlg.ShowWindow(SW_HIDE);
This line should read derefferenced pointer to pEdit but I cannot write it correctly here!! pEdit "points to" dlg.ShowWindow(SW_HIDE);
pEdit->dlg.ShowWindow(SW_HIDE);
dlg.DoModal();
This asserts in
CWnd* CWnd::GetDlgItem(int nID) const
{
ASSERT(::IsWindow(m_hWnd));
Thanks for reading
Vaclav
|
|
|
|