|
when copy the code to the codeproject I delete this & signature.
But now the error dispear, after I set the sort property of the CListCtrl to none.
thank you for your reply.
|
|
|
|
|
Hi all
Recently, I learned how to split a window using CSplitterWnd and OnCreateClient.
In my application, I need different window layout (2X2 , 3X3)for different function modules.
function modules are invoked by clicking on a menu item.
I need to show different layouts when the use calling different function modules.
Thanks
|
|
|
|
|
This should work but I'm not sure.
Create 2 views initially.
In one do a 2x2 and in the other do a 3x3.
Now you can try to show/hide the parent view.
|
|
|
|
|
I am getting brave(r) in my old age in “pasting” libraries into my project.
(OpenCV does that to me anyway!)
What is a preferred way to include "external" files and link libraries?
Using compiler command line parameters / options or using #pragma ?
I am using both methods and getting rather confused when debugging the mess I create.
Comments?
In this case I'll make an exception – any comments are welcome.
Thanks for your time.
Cheers Vaclav
|
|
|
|
|
Always use compiler options, #pragma's aren't portable in any sense of the word. If you stick to command line options then you're reducing the amount of vendor lockin you have to cart about. In my experience it's far easier modifying a makefile (or making a new one for a new compiler) than changing a shed load of source files to cope.
Cheers,
Ash
|
|
|
|
|
To link in libraries, the header files that require the library use #pragma to include the library. I do not use compiler options since I do not want to include libraries that I do not need or might not need in the future if I no longer use a specific header. Another reason I prefer not to use compiler options is that I have had a lot of extra work porting Visual C++ to newer editions when some compiler options such as include directories were thrown out.
Note that you should also might use #pragma message to list libraries that have included when you set a particular preprocessor flag. This would make porting to another compiler that does not support #pragma easier.
When I do use compiler options, I use one of a few .props files with some project specific settings for things like preprocessor macros. I do not modify project settings via the GUI provided with Visual C++, except for a handful of options that do not load properly from props files.
|
|
|
|
|
You have not mentioned whether you're developing cross-platform software or not. If true, your choice is clear: no way around makefile based compiler options. Platform (or better Win32) specific #pragmas-based configurations (if well done) are very comfortable to use (*). Think of boost configured for Windows, it just works with no problems and no need to mess around with build environment.
(*) I have to admit, I didn't like to be the guy who is responsible for writing the config-mess insinde the boost framework, that's the drawback of this kind of configuration. Changes to these "source" files are usually very fragile and difficult to test.
|
|
|
|
|
Sorry for the important omission.
As a hobbyist I use VC 6.0 and MFC and have no need for any other platform.
I briefly ventured into Linux and found the development process "challenging". I realize that there are plenty of feedback from various Linux development sources, as oppose MS stuff, but...
For my applications , I am relatively happy with VC6.0
I should also add that I try to keep all the #paragma stuff in StdAfx header file.
It just helped me to find a rather difficult error by allowing me to switch different libraries.
Thanks for all your input.
Vaclav
|
|
|
|
|
Is there a place (file) where I can see the entire command line parameters / options ?
Project Setting gives compiler and linker.
I would like to learn more about pre / post build steps etc.
Thanks for reading.
Cheers Vaclav
|
|
|
|
|
|
Why is this code placed at the begining of the .cpp file ignored by the compiler?
Anything to do with “precompiled headers” project option in VC 6.0?
Here is the snippet.
#pragma message( "Compiling " __FILE__ )
#pragma message( "Last modified on " __TIMESTAMP__ )
#include <cvhaartraining.h>
Works fine from here on
#include "stdafx.h"
#pragma message( "Compiling " __FILE__ )
#pragma message( "Last modified on " __TIMESTAMP__ )
#include <cvhaartraining.h>
....
Thanks for reading.
Cheers Vaclav
-- Modified Saturday, January 8, 2011 2:53 PM
|
|
|
|
|
It'll work if you force a rebuild (Build>Rebuild all) or delete the intermediate files first (Build>Clean).
Otherwise the compiler will recognise that part of the file hasn't been modified and won't be processed unless you force it to.
modified 13-Sep-18 21:01pm.
|
|
|
|
|
If the file is using precompile header, everything before
#include "stdafx.h"
will be ignored.
Watched code never compiles.
|
|
|
|
|
|
First thing I do in every C++ project is turn off precompiled headers.
And this is exactly the reason I do so.
I doubt precompiled headers are even relevant any more.
|
|
|
|
|
Agree on both counts, especially when one is ignorant about the "skipping code before the precompiled header" as I was.
With today's GB’s of memory and processing speed the time sawing is miniscule.
Maybe on large projects...
|
|
|
|
|
Hi all,
How to expand collapse a tree control all child items
with a single function.
|
|
|
|
|
CTreeCtrl::Expand[^] should do what you mean?
If you want to expand an item and expand all child items too, you'll have to loop through them.
modified 13-Sep-18 21:01pm.
|
|
|
|
|
you can do it by calling the function CTreeCtrl::Expand function
like ctrl.Expand( hCurrentParent,TVE_EXPAND );
if you have multiple items at the most outer level , you need to call Exapand function for each of the items. you can use GetNextItem in CTreeCtrl for getting items. http://msdn.microsoft.com/en-US/library/a1azz3kt(v=VS.80).aspx[^]
If u can Dream... U can do it
|
|
|
|
|
Hi,
Refer for
BOOL Expand(
HTREEITEM hItem,
UINT nCode
);
Method in MSDN. You can achieve that.
Thanks,
Uday.
|
|
|
|
|
Two people giving the exact same answer as me, it must be true
modified 13-Sep-18 21:01pm.
|
|
|
|
|
Hello ,
i have the problem in run of this code can you view this code and give me the solution
code of produit.h:
#pragma once
#include <iostream>
#include <string.h>
using namespace std;
class produit
{
private:
int code;
char* edsignation;
static int totalprod;
public:
produit(const produit&);
produit&operator=(const produit&);
friend ostream& operator<<(ostream&,const produit&);
friend istream& operator>>(istream&, produit&);
produit(int=0,char*p="");
~produit(void);
};
code of produit.cpp :
#include "produit.h"
int produit::totalprod=0;
produit::produit(int x,char* d)
{
this->code=x;
this->edsignation=new char[strlen(d)+1];
strcpy(this->edsignation,d);
produit::totalprod++;
}
produit::produit(const produit&p){
this->code=p.code;
this->edsignation=new char[strlen(p.edsignation)+1];
strcpy(this->edsignation,p.edsignation);
}
produit& produit::operator=(const produit&p){
if(this!=&p){
this->code=p.code;
this->edsignation=new char[strlen(p.edsignation)+1];
strcpy(this->edsignation,p.edsignation);
}
return (*this);
}
produit::~produit(void)
{
delete [] edsignation;
}
ostream& operator<<(ostream& o,const produit&p){
o<<p.code<<" "<<p.edsignation<<" "<<produit::totalprod<<endl;
return o;
}
istream& operator>>(istream& i,produit&p){
if(p.edsignation) delete [] p.edsignation;
i>>p.code;
i>>p.edsignation;
return i;
}
Thanks.
|
|
|
|
|
Welcome to CodeProject.
Amine MAMA wrote: i have the problem
and which problem would that be? what are the symptoms? the compile-time or run-time error messages?
Please show your code inside PRE tags, they preserve formatting and improve readability; you can still edit your message.
|
|
|
|
|
the problem is on run time
|
|
|
|
|
1. WHAT problem? explain, describe, specify!
2. please use PRE tags, not CODE tags.
|
|
|
|