|
I thought DoModal is only for CDialog derived classes. Use a Dialog to hold the ListBox. Call the Dialog with DoModal, and implement the code of your listbox there. You will be able to acces the ListBox from outside the dialog (your button to add the string) using a pointer or a CListBox member variable related to your listbox in the dialog
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
tyagineha wrote: CMyList myobj;
if(myobj.DoModal())
{
myobj.Addition("hye");
}
Called With DoModal() , a dialog is modal (blocking the GUI until it goes away). So DoModal() only returns after your dialog has been closed. IDOK is the return value when the OK-Button was used, IDCANCEL when the cancel button was used.
So you are filling the Listbox only after it has ended.
Add you call to addition between the instantiation of CMyList and the call to DoModal() .
You probably will have to store the data in a variable in your derived class, because there is no such thing as a ListBox window you could call AddString() on.
Your class can then handle OnInitDialog() and fill the ListBox after the call to the base class.
All this is made easier by using a CDialog -derived class.
If you do not want to use CDialog , you would have to Create() the listbox yourself.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Can you explain why you derived CListBox do you have any intent of derived?
|
|
|
|
|
Hello everyone,
I think there is a in-place re-write function which WriteFile supports, but fwrite does not support.
http://msdn2.microsoft.com/en-us/library/aa365747.aspx
Suppose I have a file, and the content is "foo is content", I want to change the content of the file to "goo is content".
If I am using WriteFile API and open with CreateFile API (generic read | write, and open existing option), I can only write one byte 'g' to replace content in-place.
But when using fwrite, there is no in-place re-write function, and I have to use "a+" mode to open a file and re-write all content "goo is content". Right?
Are there similar functions in fwrite providing in-place re-write function?
thanks in advance,
George
|
|
|
|
|
Is fseek serves your purpose ?
Please refer here[^] for more information.
Regards,
Paresh.
|
|
|
|
|
Hi Paresh,
fseek will insert content, other than in-place replace (re-write). Is that correct?
If yes, I think it could not be used to achieve my purpose.
How do you think I can achieve my purpose by using fseek?
regards,
George
|
|
|
|
|
Hi, my question is how to get the active console session id of the Microsoft Windows operating system earlier than Windows XP.
thanks a lot...
============
Einstein
Seeing is believing.
|
|
|
|
|
Hi
I am new in MFC programming. I confused about IDR_MAINFRAME in resorce file. I want to ask you a question about this.
When i create an SDI or MDI project, wizard generate codes for me. But in Resource file:
-Accelarator
-Toolbar
-Menus's names are same and IDR_MAINFRAME.
Why is this so? Isn't wrong to give same name different resouces?
If i use IDR_MAINFRAME in my code how can compiler undertand it is toolbar or menu or accelarator or something else? I am confused about IDR_MAINFRAME concept in MFC programming. I hope i can expalin the problem.
Thanks..
|
|
|
|
|
because since it uses the same name the it can load string table , icon etc with this same id.. try looking CSingleDocTemplate constructor (if single document project )here u can see , there is an argument for resource id.
If u can Dream... U can do it
|
|
|
|
|
It should be about IAT hook and api hooking well explained i mean noob friendly. I wanna hook functions but i dont know how hooking works so need a good tutorial ok thnx.
|
|
|
|
|
For IAT patching I advice you to read the codeproject article of Mr. A.Bassov "Process-wide API spying - an ultimate hack" wich contains a deep explanation of IAT hooking.
Concerning direct API hooking wich is far more efficient comparing to the IAT technique you can find in codeproject some good articles or look to the well known microsoft project with fully source code : "detours"
|
|
|
|
|
Guys please lets boil down to the best intermediate and advanced level of books on the following topics:-
1)C++
2)COM/DCOM
3)ATL
4)VC++/MFC
5)STL
6)Data Structures
7)Design Patterns
8)UML
|
|
|
|
|
How advanced? What are you looking to accomplish? Most of my advanced books focus on specific topics.
_____________________________________________
Flea Market! It's just like...it's just like...A MINI-MALL!
|
|
|
|
|
There are Terabytes of information in the net about this. And every manual/book with have something that maybe others don't have. And the higher level you want, the more specific will be the book or the manual. So every "little" thing can be various books about and they maybe don't say the same because everyone speaks about a different aspect and all of them are true.
The best solution is look for a while in the net, pick all the free content you find and start reading. If u see that it doesn't gives you good info, or info that u don't need at the moment... go to the next one.
In less than 1 hour you can have more than 500 Mb info (depending on your connection)
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Nelek wrote: The best solution is look for a while in the net, pick all the free content you find and start reading. If u see that it doesn't gives you good info, or info that u don't need at the moment... go to the next one.
This way, you can be reading for the rest of your life without getting to anything.
There are a few books which give you 90% of what you need, and then you go to the net to pick the missing specialties. CodeProject is an exellent starting point.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
He is asking for intermediate advance level, so once the basics are ok, you can make what i said and waste few time to know if one manual / book feats what you are looking for or not. I made it in that way, and worked. For basics is better to have a good book with good contents and good structure, but when you are specializiting (as he asks) in some particular questions... the best is look for it on your own.
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
Nelek wrote: intermediate advance
I did understand this as meaning "I know programming, so noone needs to tell me about the difference between while and do..until ".
This rules out the vast majority of net-tutorials.
But he did not ask for special topics, so I gave him books every C++-Programmer should have read (The Myers!) and books showing the basics of the MFC-Platform.
For the special topics, he would need to google (after he has read the articles here!
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
Some books I use almost dayly, numbered with your topic numbers:
All of these are some kind of timeless classics.
1) Scott Myers, Effective C++
Scott Myers, More Effective C++
4) Jeff Prosise, Programming Windows with MFC
Charles Petzold, Programming Windows
5) Nicolai Josuttis, The C++ Standard Library
Scott Myers, Effective STL
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
On the light side:
1.Select your book by weight!
2.Avoid "cut and paste" books with lots of pictures!( See item 1 )
3.Go to your local library.
4.Check educational institutions for courses study materials.
5.Go to local bookstore AFTER you narroved down the subject of your interest.
6.No matter what you selected - finish it first!
7.Make bookmarks and notes in YOUR book only!
|
|
|
|
|
class Fred;<br />
<br />
class FredBase {<br />
private:<br />
friend class Fred;<br />
FredBase() { }<br />
};<br />
<br />
class Fred : private virtual FredBase {<br />
public:<br />
...<br />
};
How does the above piece of code ensure that the class is non derivable?
|
|
|
|
|
tom groezer wrote: How does the above piece of code ensure that the class is non derivable?
It doesn't.
Can you explain, what you want to know ?
Prasad
MS MVP - VC++
|
|
|
|
|
There are two principles involved.
1. A friend class can access all members of the host class including private members. So Fred class will be able to access the constructor of FredBase.
2. The constructor of a virtual base class (FredBase) is always called by the most derived class. So if a new class is being derived from Fred, that new class will be the one calling the constructor of FredBase. This will fail as the constructor is private.
The error can be seen only when an object of the newly derived class is created as that is where the constructor call happens.
« Superman »
|
|
|
|
|
What is meant by operator functions? This is nothing to do with operator overloading. It has something to do with explicit conversions. This was a question that was asked by someone.
|
|
|
|
|
I haven't heard of operator functions but related to explicit conversions are conversion functions
(aka conversion operators, casting operators).
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Something like the operator LPCTSTR() that CString uses?
But this is about *implicit* conversion.
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|