Is it possible (using only the class name and window text) to change the bitmap/picture in another program by using it's the API and the window's DC??
[Edited by OB1 on 03-26-2000 at 06:39 PM]
Printable View
Is it possible (using only the class name and window text) to change the bitmap/picture in another program by using it's the API and the window's DC??
[Edited by OB1 on 03-26-2000 at 06:39 PM]
Yes and No, The API can't get at the bitmap in the form's background, it's something vb Does all by itself without telling windows,(it might be possible to find the process handle, set up a pipe etc but that's pretty much impossible even if it's possible.)
What you can do is Get the window handle and subclass the window, trap it's paint event and put your own bitmap there, This'd still be pretty hard but not quite as impossible as other methods.
In conclusion VB is a language of impossible contradiction.
hope this helps
Thanks. I think I got it.
that's weird - VB ignores Windows normal painting methods?
so how does it do it behind the scenes?
cos in C++ its like:
GetWindowDC(hWnd)
BeginPaint(wnddc);
//draw..
EndPaint(wnddc);
or something :)
I don't think VB ignores them, It just overwrites them, If you set autoredraw to true and check the value of
It will return a false when you'd think It would always be true, If AutoRedraw is true then the hDC property is a handle to a Memory DC containing a persistant bitmap for the window, when VB recieves a WM_PAINT (ie just before it fires the paint event) it blits the persistant bitmap onto the window in question.Code:CBool( (Object.hDC) = (GetWindowDC(Object.hWnd) )
I hope this answers your question (It's quite a useful thing to know anyway)