|
Hai,could any one pls help me out.....
I have statically created a splitter window with 2 views one is derived from CTreeView and the other from CListView.Then i have managed to insert items into the tree view retrieving from the database. Now i want to insert some columns into the listview but i couldn't do so since the style of the list view is to be LVS_REPORT . But, initially the style is LVS_SMALL.I don't find any way to change this style property using msdn functions.
Please tell me either how to change the style property or how to insert the columns into the listview as above.
-- modified at 4:40 Thursday 22nd December, 2005
|
|
|
|
|
Change the style:
m_List.ModifyStyle(0,LVS_REPORT);
Insert a few columns:
m_List.InsertColumn(0,"abcd");<br />
m_List.InsertColumn(1,"efgh");
this is this.
|
|
|
|
|
SetWindowLong(....)
Happy christmas friends. May the Love of My Lord and Saviour Jesus bring forth Joy and Happiness into your life too.
<marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" hspace="2" vspace="2">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
I need to display some visualizations base on output sound from speaker.
How could I do that? (No DirectX)
|
|
|
|
|
Get a flipchart and a pen. Open the flipchart and pump up the sound. Then, each time you hear a drum, move your pen up and down, while, during the song, slowly moving your pen from one side of the chart to the next.
If you do not want to use DirectX, try using an A/D-converter to feed your data back to the PC (USB or Legacy Ports).
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
If I was you, I would try, lets say, the Audacity source. Audacity is an open-source sound/wave editor/filterset, which might save you a lot of work.
They should do something like that somewhere.
If I was to record my own sound on the computer, I would retrieve the input from "Stereo Mixer" (which should also contain every sound your computer currently is playin, because it remixes the output stream into the input stream.
Cheers,
Sebastian
--
Contra vim mortem non est medicamen in hortem.
|
|
|
|
|
Hi,
I need to convert exe into windows 2000 service using vc++.
Can anybody suggest me how to do it.
|
|
|
|
|
trinadh_t wrote: I need to convert exe into windows 2000 service using vc++.
Start Your Windows Programs From An NT Service[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
thanks for giving me reply,
but i dont hav NT service in my pc. I hav windows 2000 professional in my PC. Can u tell me briefly how to do that.
regards
triadh
|
|
|
|
|
trinadh_t wrote: but i dont hav NT service in my pc. I hav windows 2000 professional in my PC
2000 is nothing just advance version of NT.... Please read that article... that contain readymade solution for your need
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi
Does anyone know how to use the SHChangeNotifyRegister API in a service.
|
|
|
|
|
Hope this helps...
http://www.codeproject.com/shell/shchangenotifyregister.asp[^]
Happy christmas friends. May the Love of My Lord and Saviour Jesus bring forth Joy and Happiness into your life too.
<marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" hspace="2" vspace="2">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
I have created a charater pointer which points to
a string . I need to copy an existing string in the
char pointer i created so i did this
In my class the code is as
char *m_FileName;<br />
m_FileName=new char[strlen(FileName)]; <br />
strcpy(m_FileName,FileName);
In the destructor of the class
<br />
~Class_temp()<br />
{<br />
if(m_FileName!=NULL)<br />
delete []m_FileName;<br />
}
I get a error at the delete keyword ,
Damage After normal Block 0x00000034
am i wrong some where
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
|
This won't work coz it's an array of memory.
Happy christmas friends. May the Love of My Lord and Saviour Jesus bring forth Joy and Happiness into your life too.
<marquee direction="up" height="50" scrolldelay="1" step="1" scrollamount="1" hspace="2" vspace="2">
--Owner Drawn
--Nothing special
--Defeat is temporary but surrender is permanent
--Never say quits
--Jesus is Lord
|
|
|
|
|
When using new[] you MUST always use delete[] , no matter if you allocate an array of char.
|
|
|
|
|
FileName is a zero-terminated string and strlen returns the number of charachters WITHOUT counting the '\0' char. When you allocate your new string, you need to allocate for one extra character otherwise when you make the copy, the ending zero will be written outside the boudaries of your allocated memory.
Instead of
m_FileName=new char[strlen(FileName)];
Write:
m_FileName=new char[strlen(FileName)+1];
|
|
|
|
|
You should allocate space for one more character than the length of the string:
m_FileName = new char[strlen(FileName)+1];
Also you should initialize m_FileName to NULL in the constructor:
m_FileName = NULL;
this is this.
|
|
|
|
|
Yeh i initialised
m_FileName = NULL;
but thanks for the suggestion that i should
add one more memory space for termination
charater .
But it dont work to solve my problem
Vikas Amin
Embin Technology
Bombay
vikas.amin@embin.com
|
|
|
|
|
Hello,
After the modification of the +1, your code should work. Are you modifying the string elsewhere?
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Also either call
memset(m_FileName,0,(strlen(FileName)+1));
after the new,
or call
m_FileName[strlen(FileName)] = '/0';
after strcpy.
These sort of issues are commonly caused by the program not seeing the end of the string and it overruns it's buffer.
Another possible issue is if you are assigning a pointer to that string elsewhere that is still using it. Check the debugger to ensure anything that needs to reference the string stored in m_FileName after it's deleted has made it's own copy.
eg. code like this is BAD
class MyClass
{
private:
char* mystring;
public:
void SetMyString(const char* const newstring) { mystring = newstring; }
};
void somefunction()
{
MyClass mc;
const char* conststring = "test me"
char* addstring = new char*[strlen(conststring)+1];
memset(addstring, 0, strlen(conststring)+1); // strlen(conststring)+1 could be assigned to an integer
strcpy(addstring, conststring);
mc.SetMyString(addstring);
delete[] addstring; // BAD - because mc now contains an invalid pointer!!!!!
}
-- modified at 3:12 Thursday 22nd December, 2005
|
|
|
|
|
lastgen wrote: Also either call
memset(m_FileName,0,(strlen(FileName)+1));
after the new,
or call
m_FileName[strlen(FileName)] = '/0';
after strcpy.
Nope. strcpy will copy the terminating zero so you don't need to do it yourself.
|
|
|
|
|
OK, I didn't think it did. I've been programming for about 20 years but not a lot of C until recently
|
|
|
|
|
Cedric Moonen wrote: Nope. strcpy will copy the terminating zero so you don't need to do it yourself.
Cedric, actual problem is that.. vikas is allocating memroy many time and deleting memory only one time... let me explain that by small example...
class MemLeak
{
char *pFile;
public:
void allocatemem()
{
pFile=new char[100];
}
~MemLeak()
{
if(pFile)
delete []pFile;
}
};
In this case it will work fine
MemLeak a;
a.allocatemem() ;
and on destruction 100 byte will deleted so no Memory leak, but let me consider a another case
MemLeak a;
a.allocatemem() ;
a.allocatemem() ;
so on destruction only 100 byte is freed so there is memory leak. i believe vikas can code something like this
class MemLeak
{
char *pFile;
public:
MemLeak()
{
pFile=NULL;
}
void allocatemem()
{
if(pFile)
delete [] pFile;
pFile=new char[100];
}
~MemLeak()
{
if(pFile)
delete []pFile;
}
};
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
We don't know if he allocates the memory several times or not. But something that is sure is that this is not the source of the crash: allocating several times memory without freeing it lead to memory leaks but it won't crashes for sure. So the problem must be somewhere else...
But still, your suggestion is good: memory leaks are a bad programming practice
|
|
|
|