Hey there...
I have been searching google.com for quite a while and I haven't been able to find a good tutorial on c handles. Can anyone give me a good site to go to or maybe a book to get a hold of.
Thank you!
Hey there...
I have been searching google.com for quite a while and I haven't been able to find a good tutorial on c handles. Can anyone give me a good site to go to or maybe a book to get a hold of.
Thank you!
-- Will you show me how to c++?
Are you asking about the HANDLE data type or on Windows programming in general?
In general, a HANDLE is some sort of identifier that, to you, is just something you have to pass back to identify some resource/object (a window, a file, a thread, a process, a mouse cursor image, a drawing pen, etc, etc). As you would have on a physical object, say a saw, hammer, suitcase or oscilloscope: a handle to hold it when using/moving the object.
How a handle is implemented depends on the architecture of the OS. The handle can be an index into an array of objects of that type, a pointer or a composite type (e.g. some sort of index combined with for example a "magic" number to identify which type of object). To you, it should not matter, since you can't do anything with a handle other than pass it to a function that accepts that sort of handle.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
The HANDLE data type... im sorry for not being clear enough before. I have found alot of articles on windows programming in general but not the HANDLE data type. I know how to use them in a very basic manor. I want more control etc. Thnk you mats i know what they are and your explenation actually gave me a better idea. But i need a book or something. Im sure there ahs to be something out there. Thank you!!
-mramazing
-- Will you show me how to c++?
Maybe you can explain in more detail what you actually would like to do with a handle (and what type of handle it is, that is, what type of object have you created).
In general, windows returns a pointer to some internal data structure when it gives you a handle. All handles have the same (but unknown to me) base data, but different data type added "after" the base. Essentially this implements a simple version of derived classes in C++.
But essentially, you can't "do" anything with these handles - as far as I know, it could even be a kernel only memory address that you get back, so it may not even be user-mode writable.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
Actually, HANDLE is a synonym for PVOID, which is a synonym to void *.
Windows Data Types
Of course, in the case of HANDLE, it's not really important to know this.
I hate real numbers.
Yes, but just the fact it's a void * doesn't really tell you anything about what it really points to, which I think was the point of matsp's description of abstraction of the type.
well i would like to know how to control external applications from mine. So that i can do scripting like tasks in c or c++.
-- Will you show me how to c++?
There are process control functions in Windows, and that is what you need to use to create, destroy and otherwise control processes from a Windows process.
See: http://msdn.microsoft.com/en-us/libr...47(VS.85).aspx
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.
C was not written for scripts. That's what console scripting was all about.