What is HandleCreated Event?
-
Hello, I've recently found stranged things could happen when I set up an event handler for the
HandleCreated
Event in C# windows controls. So what isHandleCreated
Event? When will it be raised? Thanks in advance.:)Well, a handle is pretty much just a pointer to the object, and can be used for a variety of things. For example say you create a bitmap and draw a picture onto it, and you then wanted to pass this image to another form, instead of passing the whole image, you could just pass the handle and then use Bitmap.FromHandle(). But, i would have thought that the handle would be created at the same time as the instance of an object, unless you can somehow make more. I'm not so savvy with handles. If you check the MSDN documentation you should find the answers you seek. EDIT: Nevermind, MSDN doesn't help much. It just says that it fires when a handle is created (wow, really?!) and that it is useful for debugging.
My current favourite word is: PIE! Good ol' pie, it's been a while.
-
Well, a handle is pretty much just a pointer to the object, and can be used for a variety of things. For example say you create a bitmap and draw a picture onto it, and you then wanted to pass this image to another form, instead of passing the whole image, you could just pass the handle and then use Bitmap.FromHandle(). But, i would have thought that the handle would be created at the same time as the instance of an object, unless you can somehow make more. I'm not so savvy with handles. If you check the MSDN documentation you should find the answers you seek. EDIT: Nevermind, MSDN doesn't help much. It just says that it fires when a handle is created (wow, really?!) and that it is useful for debugging.
My current favourite word is: PIE! Good ol' pie, it's been a while.