|
No, it wont do that. The kernel API does exactly what it says it does. If it says it create a file it does, it doesnt copy a file.
Believe me, I have spent 16 years writing windows kernel code.
--edit--
Oh look a one voter. Well, NtCreateFIle etc is the API you use inside the kernel and I have used it a lot. so mr one voter, ypu are wrong.
--edit--
Oh look, another 1 voter. What fun!
modified 20-Aug-13 8:50am.
|
|
|
|
|
Hi, Erudite ,
I graduated about one year so I don't have much experience about Win kernel .Thank you for helping me
Thong Le Trung
|
|
|
|
|
Hi I created 3 views on a view to make it like Windows Explore. I did not used CSplitterWnd class to split instaed created seperate on a view.
I need to make these view resizable, how can I do it?
|
|
|
|
|
Hi.
But that's exactly what a splitter is for. I don't understand why you wouldn't use it.
You can handle resize-events of the frame/dialog easily enough to layout the 3 children windows. But re-writing code to handle individually resizing them wouldn't be my idea of a nice way to round-off the week.
Is there any reason that you can't use a splitter window?
"Science adjusts its views based on what's observed. Faith is the denial of observation, so that belief can be preserved." - Tim Minchin
|
|
|
|
|
|
I am trying to builld my application using VS2008 but getting error "cannot open program database vc90.pdb". I tried to deleted debug folder manually but getting same error.
Can you please help m to build?
|
|
|
|
|
|
<pre lang="Is it my old IDE or by design that static library with MFC support wizard will add only "generic class" and not MFC classes? "></pre>
|
|
|
|
|
What does that mean, and what does it have to do with C++?
Use the best guess
|
|
|
|
|
Whats the name of this forum?
|
|
|
|
|
Do you understand the OP's question?
Use the best guess
|
|
|
|
|
Did you? It is clearly an MFC question.
|
|
|
|
|
On the contrary, it's not clearly anything.
Use the best guess
|
|
|
|
|
MFC is about all there is that is clear though.
|
|
|
|
|
Do you have the answer then?
Use the best guess
|
|
|
|
|
Nope. It still doesnt make sense, even after reading it 10 times.
|
|
|
|
|
So this thread was totally pointless.
Use the best guess
|
|
|
|
|
It was, but it was pointless in the right forum.
|
|
|
|
|
I don't think so; read the question again.
Use the best guess
|
|
|
|
|
User error - I missed the additional option to derive the class from any MFC class.
|
|
|
|
|
I am practicing c++ template programming and got a very confusing question. My purpose is to write a program to output the data of classes. If the the class is an POD (plain old data), use a global function (say Serialize) for output, if it's not, use the class's own Serialize function (assume every non-pod class in this program has implemented its own Serialize method). To better illustrate this idea, I have a little program to do that:
#include <assert.h>
#include <iostream>
using namespace std;
class myclass
{
public:
myclass(void):_nID(10) { _nOldID = _nID; };
void Serialize(std::ostream &os)
{
os << _nID;
}
void Serialize(std::istream &is)
{
is >> _nOldID;
}
private:
int _nID, _nOldID;
};
template <typename T>
void Serialize(std::ostream &os, const T& Obj)
{
os << Obj;
}
int main(int argc, char* argv[])
{
typedef unsigned int T;
T Obj;
if (!std::is_pod<T>::value) {
std::cout << "T != POD";
Obj.Serialize(cout); }
else {
Serialize(cout, Obj); std::cout << "T = POD";
}
return 0;
}
The problem is that the compiler giving an error that error C2228: left of '.Serialize' must have class/struct/union in the if clause, which I think it shouldn't because T is defined as unsigned int which is of POD type. On the other hand, if T is defined as myclass, the compiler complains the global Serialize function saying "binary '<<' : no operator found which takes a right-hand operand of type 'const T' (or there is no acceptable conversion)", which is in the "else" clause which should not be reached.
Anybody can explain this?
|
|
|
|
|
You want to do this if I'm right: You want to generate a call to the Serialize() method of the object if the method is implemented in the object otherwise you want to call a fallback method or maybe you want to generate a compile time error. Then you are looking for SFINAE[^]. The solution I provided is much simpler than the one found on the wiki page but I made use of C++11.
#include <assert.h>
#include <iostream>
using namespace std;
class myclass
{
public:
myclass():_nID(10) { _nOldID = _nID; };
void Serialize(std::ostream &os)
{
os << _nID;
}
void Deserialize(std::istream &is)
{
is >> _nOldID;
}
private:
int _nID, _nOldID;
};
class otherclass
{
};
namespace Serialize_SFINAE
{
template <typename T>
auto Serialize(T& obj, std::ostream &os) -> decltype(obj.Serialize(os),void())
{
obj.Serialize(os);
}
template <typename T>
void Serialize(T& obj, ...)
{
obj.this_class_doesnt_have_a_serialize_method;
}
}
template <typename T>
void Serialize(std::ostream &os, T& obj)
{
Serialize_SFINAE::Serialize(obj, os);
}
void Serialize(std::ostream &os, int obj)
{
os << obj;
}
void Serialize(std::ostream &os, bool obj)
{
os << obj;
}
int test_code()
{
myclass Obj;
Serialize(cout, Obj);
return 0;
}
|
|
|
|
|
Thanks for the code and explanation. That's exactly what I intended to do. Your codes get compiled and worked fine.
One more question: If for any class/struct object without Serialize method implemented, I want to use the default serialization for them such as os << Obj or call the global Serialize template function. I just cant use a specialization method for every such class because I can possibly have many such classes.
modified 14-Aug-13 10:30am.
|
|
|
|
|
The fallback sfinae method (void Serialize(T& obj, ...)) is for that case. You can put there a compile error (I did that) but you can put there a default handler code too as an alternative for the case when the struct/class doesn't have a Serialize() method.
I almost forget to mention: When you have to handle primitive types (int, bool, ...) and structs/classes together then it can usually be done by calling an overloaded function/method that has overloads for the primitive types and a template method for the rest (structs/classes). In the template method you can do different kind of magic with the type it is called with, you can call one of its methods, sfinae,... When creating the overload for primitive types there is one strange thing to be aware of: char, signed char, and unsigned char are 3 different types and you need 3 overloads!
|
|
|
|
|
I did learn a lot from what you have explained. Thanks again for your help and patience.
For POD type of data, I used a std::is_class<> predicate to handle and I only need two specializations.
Within your namespace Serialize_SFINAE {...}, I just cannot simply add a default Serialize function which compiler will complain an ambiguous call. Could you be more specific?
|
|
|
|