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.
Is it possible to change a hWnd to a hDC or a hDC to a hWnd or if there are any VB API drawing functions that use a handle to window instead?
------ EDIT -------------
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?)?
Use the GetDC API, pass the HWND handle you have to get the DC handle.
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.
------ Posted too fast : Reading...------
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.
OK, I hope GetDC is what I need... Thanks
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.
Can you set the hDC or hWND for drawing with Allegro?
If you register your own Windows Class, you can ask Allegro to create an instance of that class with win_set_window:
void win_set_window(HWND wnd);
Registers an user-created window to be used by Allegro. This function is
meant to be called before initialising the library with allegro_init()
or installing the autodetected system driver (SYSTEM_AUTODETECT). It
lets you attach Allegro to any already existing window and prevents the
library from creating its own, thus leaving you total control over the
window; in particular, you are responsible for processing the events as
usual (Allegro will automatically monitor a few of them, but will not
filter out any of them). You can then use every component of the library
(graphics, mouse, keyboard, sound, timers and so on), bearing in mind
that some Allegro functions are blocking (e.g. readkey() if the key buffer
is empty) and thus must be carefully manipulated by the window thread.
If you have a BITMAP, you can use win_get_dc to get its HDC:
HDC win_get_dc(BITMAP *bmp);
Retrieves a handle to the device context of a DirectX video or system
bitmap.
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.
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?
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?
this appears in my subscription email
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.