|
reinhard_jd wrote: I've tried some of the hints and esp. the SendKeys object helped a lot.
you can try keybd_event Function tooo
"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
|
|
|
|
|
Anyone give me some hints or source code how capture video from usb device and get pixels values to memory.
9ine
|
|
|
|
|
You need to install DirectX SDK,
SDK includes a lot of Multimedia sample codes
There you can find video capture source codes with DirectShow
|
|
|
|
|
In the following code snippet which delete should I use??
char *ptr1=new char[100];
char arr[10]="abcdefghi";
strcpy(ptr1,arr);
//delete ptr1;
delete []ptr1;
Should I use delete ptr1; or delete []ptr1;
|
|
|
|
|
delete[]
but they get to the same place anyway..
|
|
|
|
|
__yb wrote: but they get to the same place anyway..
What do you mean by going to the same place ? If you mean that you can use one instead of the other, it's not true. Check this link[^]
|
|
|
|
|
They in fact do not. However, it is common for POD arrays to both compile down to a call to free. But you should never rely on that since it is implementation specific.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
u're right, its per implementation, I was refering to mine - VC6
|
|
|
|
|
delete[] because the memory has been allocated with new[].
The rule is simple: if memory is allocated with new[], then use delete[]. If memory is allocated with new, use delete.
|
|
|
|
|
if u r allocating an array of data
say
*ptr=new [100]
then go for delete[]
complier will know an array of data has to be deleted.Otherwise if u dont do this only the first block of data (depending upon data type say char only first byte in case of char will be deleted this memory leak!)
remember this combination
new-->delete
new[]-->delete[]
|
|
|
|
|
new ------> delete
new [] ---> delete[]
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Hallo, I must copy/save every file my program find.
There are files from Access, Windows and so on...
SHFileOperation or other standard-Routines cant work so.
Have any an idea? Thanks.
|
|
|
|
|
I have h2200,i wish run ,my application at startup ,windows ce.
please help me.
|
|
|
|
|
doesn't Windows CE have a registry too ?!
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
No,No.i wish use function cerunappatevent().
where do write this function?
|
|
|
|
|
Why Virtual constructors are not allowed in C++??
|
|
|
|
|
Because virtual constructor are simply useless ! When constructing an object, the compiler knows exactly which object it needs to create (as opposed to the destructors). Take the following example (CChild1 and CChild2 both derive from CBase):
CBase* pData = new CChild1;<br />
CBase* pData2 = new CChild2;<br />
delete pData;<br />
delete pData2;
If you look at the above example, when creating pData and pData2, the compiler knows explicitly the type of the object being created (new CChild1 or new CChild2). But when you delete the object, the compiler doesn't know it explicitly, thus requiring a virtual destructor.
|
|
|
|
|
Hello,
The virtual keyword is used to say to the compiler that a pointer to an object might be a pointer to the base class instead of the class that was instantiated. This way the code looks in a virtual function pointer table for the right function to call. Since this mechanism is used to determine which member function should be called for the instance of a class, constructors cannot be virtual, since they create instances of classes.
If virtual constructors would be allowed, I figure that it would never be possible to instantiate a class with a virtual constructor, once a class has been derived from it. This would be far from nice.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
powerful explaination bob
this worthes '5' !
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote: this worthes '5' !
Thanks!
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Objects are created from the inside out, and destroyed from outside in.
class A {
public:
A( void );
virtual ~A( void );
virtual void F( void );
long DA;
};
class B : public A {
B( void );
virtual ~B( void );
virtual void F( void );
long DB;
}; When you create an instance of A or B (or any class with a vtable) an pointer is placed at the start of the object. This pointer points to the class vtable.
e.g.
A a;
B b;
When b is created:
- memory is taken from the stack to hold size B object (12 bytes)
- vtable ptr is set to A vtable
- A::A() is called
- vtable ptr is set to B vtable
- B::B() is called
Setting the vtable ptr and calling the approriate constructor method can be considered an atomic action from our point of view.
From the above you can also see why you can't call virtual methods from a constructor and have them resolve forward - the vtable matches the class of the current constructor.
e.g.
A::A( void ) {
F();
}
This is part of the reason many frameworks adopt 2 part object construction:
1. create an instance, don't do anything important in constructor (init members)
2. call an Init() method that does the real construction - will resolve virtual methods properly
When b is destroyed:
- (vtable already set to B vtable)
- B::~B() is called
- vtable ptr is set to A vtable
- A::~A() is called
- memory is returned to stack
From the above you can also see why you can't call virtual methods from a destructor and have them resolve forward - the vtable matches the class of the current destructor.
e.g.
A::~A( void ) {
F();
}
...cmk
Save the whales - collect the whole set
|
|
|
|
|
Can anybody tell me the difference between Abstract Base classes vs Interfaces??
|
|
|
|
|
If I remember correctly (I'm not sure anymore ) an abstract class is a class that contain at least one pure virtual function (a pure virtual function is a function that MUST be redefined in every class that inherits from the base class)
A pure virtual function looks like:
virtual void Test() = 0;
If you try to declare an instance of a class containing a pure virtual function, you will have an compile error saying that it cannot create an instance of the class due to a pure virtual function. It is used to 'forbid' an instanciation of the class (the class is just used as base class for another class and cannot be used 'alone').
Concerning the interface, also called pure abstract class, it's a class that contain only pure virtual functions and no member variables (for this last point, I think there are different opinions). So, the class itself is 'empty' because no functions has been defined.
Hope this helps
|
|
|
|
|
All the member functions in an Interface are pure virtual functions. But in the Abstract clas not like this, at least one pure virtual function must be there in a class to be called it as abstract base class.
|
|
|
|
|
if you are talking in a pure standard C++ point of view, Cedric already gave you the right answer.
now, if you heard with an interface, the keyword that we get as in java or in .NET languages, that's easy, such a thing don't exist.
but the difference would be easy to do :
when you inherit an abstract class, you get "as a gift" all the methods that are already implemented (and so, you don't have necessarily to write them if they do what you want).
you have to be laziness when you implement interfaces because you have to provide the code for each function...
to finish, abstract is not a C++ keayword, so sometimes, you could have difficulties to set your class abstract. that happened to me last month, and thanks to Mr Surhedayan, i now have it. the point is, when you have a base class that already provide some function bodies, that will not be overloaded in the children classes, you cannot set the function as pure virtual (with =0 ) ; and if you dont want the users to instanciate this class, the simple thing to do is to set the constructors protected...
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|