![]() |
|
Convert a hDC to hWnd or vise versa |
Archon
Member #4,195
January 2004
![]() |
I am not sure how a hDC works (at all really), but ive got some API that rely on a hDC rather than a hWnd Declare Function SetPixel Lib "gdi32" (ByVal hDC as Long....) Yes its VB, anyway. ------ EDIT ------------- |
ReyBrujo
Moderator
January 2001
![]() |
Use the GetDC API, pass the HWND handle you have to get the DC handle. -- |
23yrold3yrold
Member #1,134
March 2001
![]() |
An hDC is simply a handle (pointer) to a Device Context (IIRC), while a hWnd is a handle to an actual window. The two are not interchangable. You can get a handle to a window's device context for drawing though. But you can't convert between the two. Do some reading up on how device contexts work. -- |
Archon
Member #4,195
January 2004
![]() |
------ Posted too fast : Reading...------ |
ReyBrujo
Moderator
January 2001
![]() |
Oh, you can read my reply above now. The problem was that I began the URL with [URL] and ended it with [/I], and no text was shown. Reporting that to Matthew. -- |
Archon
Member #4,195
January 2004
![]() |
OK, I hope GetDC is what I need... Thanks |
ReyBrujo
Moderator
January 2001
![]() |
X Archon said: I wouldve used DirectX but if another DirectX program was running then it would crash. For this problem, is it possible to run 2 directX programs simultaneously (one window, one full screen?)? Yes, you can usually run two or more Allegro games without problem... or at least that is what I think. -- |
Archon
Member #4,195
January 2004
![]() |
Can you set the hDC or hWND for drawing with Allegro? |
ReyBrujo
Moderator
January 2001
![]() |
If you register your own Windows Class, you can ask Allegro to create an instance of that class with win_set_window: Allegro.txt said: void win_set_window(HWND wnd); If you have a BITMAP, you can use win_get_dc to get its HDC: Allegro.txt said: HDC win_get_dc(BITMAP *bmp); And you can draw to the HDC with draw_to_hdc, blit_to_hdc, stretch_blit_to_hdc, blit_from_hdc and stretch_blit_from_hdc. Check the Allegro documentation. -- |
Archon
Member #4,195
January 2004
![]() |
Thats alot of help, but I can only credit you once... Another thing, are you suscribing to threads? Because if I copy the link in my hotmail to this thread, it asks for a username and password but they dont register with my own. Reasons? |
ReyBrujo
Moderator
January 2001
![]() |
No worries, in fact you are not forced to credit. Fair enough if the credit system bring faster and better answers than before. And no, I don't suscribe. I am online enough to have all the light bulbs off. Which link you are trying to copy? -- |
Archon
Member #4,195
January 2004
![]() |
this appears in my subscription email |
ReyBrujo
Moderator
January 2001
![]() |
Ugh... Matthew is testing something, and it seems somewhat the new code mixed with the old one. Send a private message to him, with a link to this thread (and telling him the title). Explain him you tried to suscribe and it gave you that URL which asks you for a user and password. -- |
|