|
in the C++ program I am including a header which has (just an example) foo(int *class)
which compile cleanly in C but in C++ the word class is a keyword and get flagged as an error
|
|
|
|
|
Just change it?
The name should be irrelevant, the parameter position would be relevant.
Compile the C-Code as C-Code and link it to C++-code?
On C-Files, the compiler would automagically use the calling convention you otherwise enable with "extern C".
I don't know if it accepts C++-reserved keywords, though.
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
|
|
|
|
|
Thats The thing it doesn't extern C must be Just calling convention as far as Anything else if a C header is included in .cpp prog no matter what the prefix by that I mean by that (extern "C") the compiler will use C++ syntax checking
still the word class followed a data type e.g. int *class so.... even in C++ it should compile
Anyway thankx
|
|
|
|
|
ForNow wrote: the compiler will use C++ syntax checking
No he won't - but he is still bound to the C++ reserved words list. This can not ever be valid identifiers in a C++ program.
But I think they could in a C-Program compiled by the very same compiler.
As long as they do not appear in C++ context.
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
|
|
|
|
|
I think my only soultion is to #ifdef __cplusplus C++ code #else C code #endif
thankx
|
|
|
|
|
let me tell the whole method:
i want to diaplay a modeless listbox on button click.i.e when i click a button a listbox pops-up.for this i hav made a new class named CMyLIst which is derived from CListBox.in CMyList i have made my own addstring function which is like this:
int CMyList::Addition(LPCTSTR lpszItem)
{
return CListBox::AddString(lpszItem);
}
In my Parent class which contains the button
i have declared an object of CMyList as:
CMyList myobj;
and i hav used it as
void CMyDemo::OnButton1()
{
CMyList myobj;
if(myobj.DoModal())
{
myobj.Addition("hye");
}
}
but i m getting error that DoModal() is not function of CMYList
May be this problem is because i have derived C
|
|
|
|
|
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!
|
|
|
|