|
Okey..But Why it must know data type and also it's size? Can it just allocate memory run time?
|
|
|
|
|
vikrams wrote:
Can it just allocate memory run time?
I don't know why you want to use operator new, but I (and most other people) use it to allocate memody at runtime...
Blog[^]
|
|
|
|
|
Picture this: you have to allocate an object. What is the first question that you ask yourself? In most cases it will be: how much? In all the other cases that will be the second question.
Just remember that if you allocate an object, you have to allocate a certain amount of storage. If you don't know the amount of storage, you can never do a proper allocation..
Hope this helps
Blog[^]
|
|
|
|
|
if you overload the operator new for a class of your own, you know the type and the size of the class (with sizeof() ).
however, the operator need to know how much memory it has to allocate because it doesn't necessarily allocate space for only one object...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
1.How to get Audio & Video Stream data using Directshow?
2.How to send,replay this data on network?
shumyla
|
|
|
|
|
you can use sockets to send the data using a network. But you should have a "server" and "client" to do this.
Geert
Want to spread the newest version of your software automatically? Use Updater!
Visit my website: http://geert.yoki.org
|
|
|
|
|
Once VC++.Net code has been compiled, how difficult is it to convert the compild code back to the source code? Are there any simple tricks to make this more difficult? There were a couple of suggestions in earlier posts to this Message Board suggesting the use of a checksum of the preprocessed code or placing some code in #IFDEF preprocessor statements. Does anyone have simple examples of these techniques?
Any thoughts would be appreciated.
Regards
Jeremy
|
|
|
|
|
Hi everybody, i need help. I am working with toolBars and i dont know how i can set the text of the buttons in the toolBar. If any body can help me i will be gratefull.
|
|
|
|
|
neliocc wrote:
i dont know how i can set the text of the buttons in the toolBar
SetWindowText(HANDLE_OF_BUTTON, BUTTON_TEXT);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
I cant get the handle of a button in a toolBar, thats the problem.
|
|
|
|
|
m_wndToolBar.SetButtonText(0,"this text");
m_wndToolBar.GetToolBarCtrl().SetButtonSize(CSize(22,36));
Just set the button size CSize(22,36) to values which suit you.
this is this.
|
|
|
|
|
Yes but i am working with win32 API and i can not do that.
|
|
|
|
|
Send a TB_SETBUTTONINFO message to the toolbar.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it! Honoured as one of The Most Helpful Members of 2004
|
|
|
|
|
neliocc wrote:
i am working with win32 API
Then Look for TB_SETBUTTONINFO and TB_SETBUTTONWIDTH messages
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
|
|
|
|
|
hi,
We are doing a project on Live video conferencing in LAN.File is recoreded on a single PC but the actual thing must do is to send the data on a network.I m using directshow for this in which "IMediaControl Interface" is used for run and stop the file to record.But i need the actual data(streams).The question is:
1.How to get Audio & Video Stream data using Directshow?
2.How to send,replay this data on network?
plz reply me soon.
best regards
shumyla
|
|
|
|
|
I do this over and over and I can't figure out how to make this function into a template.
void CleanUpVector()
{
std::vector<Music_Item*>::iterator iter;
for (iter = vMusic.begin(); iter != vMusic.end(); ++iter)
{
delete *iter;
}
vMusic.clear();
}
struct TAG
{
string TrackNumber;
string Title;
string Artist;
string Genre;
string Year;
string Comment;
string Album;
string PersistsAs;
};
struct Music_Item
{
HSTREAM Stream;
TAG Tag;
};
Any ideas anyone? I can't figure this out.
|
|
|
|
|
You really don't want to be doing this - it's asking for trouble. You'd be much better using something like boost::shared_ptr in the vector rather than raw pointers - then, if required you can pass custom deleters into the function.
Below is an example of a template function which does what you requested. Depending on usage the call to clear() may be redundant, or may not do what you expected.
template<class T>
void cleaner(std::vector<T>& v)
{
typedef typename std::vector<T>::iterator iter;
iter cur(v.begin());
iter end(v.end());
for(; cur != end; ++cur)
{
delete (*cur);
}
v.clear();
}
EDIT: fixed typo
|
|
|
|
|
Thanks that worked great.
This is the part I couldn't figure out.
<br />
typedef typename std::vector<T>::iterator iter; <br />
iter cur(v.begin()); <br />
iter end(v.end());<br />
|
|
|
|
|
Perhpas I've mad a mistake here, but I'm writing an application, and the short question is the: My division seems to be incorrectly calculating:
....
double divisiontest = 5/9;
cout << setprecision (4) << divisiontest << endl
...
the result I'm getting is: 0.00000000000
as a minimum I should get .5556 ??????
|
|
|
|
|
try this :
double divisiontest = 5.0 / 9.0;
It was attempting to divide two integers and 0 would be the correct answer for that.
|
|
|
|
|
Thank for the simple solution, but just so I understanding this what's the difference between two syntaxs?
|
|
|
|
|
5 / 9 = .5556 in real life. The compiler interprets the 5 and the 9 as integers because nothing is telling it otherwise. So in your example, 5 / 9 = 0.5556 = 0 as an integer. I believe that the default data type is integer.
5.0 / 9.0 explicitly tells the compiler that the two numbers are a double data type so you would get the correct answer.
If you had written the first as:
double five = 5;
double nine = 9;
double answer = five / nine;
you would also get the correct answer since you had declared the variables as doubles to begin with.
|
|
|
|
|
According to the compiler, 5 and 9 are integers and divsion of an int by an int results in an int. If one (or both) of the numbers are of type double, then the result is a double. So
double divisiontest = 5.0 /9 ;
...
will give you the correct answer.
Regards
Senthil
_____________________________
My Blog | My Articles | WinMacro
|
|
|
|
|
This would also solve the problem
double divisiontest = (double)5/9;
m0n0
|
|
|
|
|
Hello fellows. I'm doing a class library in C++.NET, and I declared two classes, A and b, as follows:
<br />
public __gc class B; <br />
<br />
public __gc class A : public baseA <br />
{ <br />
private: <br />
B *entrada; <br />
B *salida; <br />
}; <br />
<br />
public __gc class B : public baseB <br />
{ <br />
private: <br />
A **entrantes; <br />
A **salientes; <br />
};<br />
However, while compiling I get the following error:
error C3160: 'entrantes' : cannot declare interior __gc pointer or reference as a member of 'espacio_nombres::B'
error C3160: 'salientes' : cannot declare interior __gc pointer or reference as a member of 'espacio_nombres::B'
Why this error happens? What can I do about it?
Thanks for your thoughts.
Regards,
KK.
One day you'll find
that I have gone,
for tomorrow may rain, so
I'll follow the sun...
|
|
|
|