• Advertisement
Sign in to follow this  

[.net] Understanding WinHandle System.Intptr

This topic is 4579 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Im having a hard time understanding what exactly using winhandle and system.intptr actually do... Ive been seeing it in alot of games where you want to hide and then reshow a gamefield so that the graphics can update. However I am having problems such as the block on tetris not updating its location visually and I think it has alot to do with me not understanding the two above statements. Maybe someone could write a tiny program that uses the above and includes drawing a graphic over a background on a form and updating its position or something Using a Right function or whatever. Or even point me to a article that might help although I have yet to find one that breaks it down into english for me :)

Share this post


Link to post
Share on other sites
Advertisement
It seems like you're asking an open-ended question. I'll answer what I know about the first part.

In C++ Win32 programming there are handles to windows which you create called "hwnd's". To manipulate the window (i.e. move it's position or change it's size, etc.), you would pass the hwnd for that window to the appropriate Win32 function that does what you want.

A C# Form is a wrapper around a window's hwnd, and the Form provides a lot of convenient functions and properties that manipulate that window. Usually you don't need to have the hwnd anymore since the Form class is doing all the work, but if for some reason you do, you would access the Handle property of a Form. That is where the hwnd is stored, and it's type happens to be casted to an IntPtr.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement