[Prev][Next][Index][Thread]

Re: DUIM and OpenGL



"John Whittaker" <johncwhi@earthlink.net> writes:

> Is there a way to get at the window handle from DUIM?

There is a generic function called window-handle exported from library
win32-duim, module win32-duim. You can call it on a sheet provided by
the win32 backend if I recall. For example, I use it to set various
extended selection flags on the table control gadget:

define method handle-event( frame :: <genetics-editor-frame>, 
  event :: <frame-mapped-event> ) => ()
    let hwnd = frame.gene-list-pane.window-handle;
    let LVS-EX-FULLROWSELECT = #x20;
    let LVM-FIRST = #x1000;
    let LVM-GETEXTENDEDLISTVIEWSTYLE = LVM-FIRST + #x37;
    let LVM-SETEXTENDEDLISTVIEWSTYLE = LVM-FIRST + #x36;
    let lstyle = SendMessage(hwnd, LVM-GETEXTENDEDLISTVIEWSTYLE, 0, 0);
    lstyle := %logior(lstyle, LVS-EX-FULLROWSELECT);
    SendMessage(hwnd, LVM-SETEXTENDEDLISTVIEWSTYLE, 0, lstyle);
end method handle-event;  

I have also used get-dc to do bitmap drawing. I think that was in
win32-duim as well:

define method draw-image( m :: <drawing-pane>, 
  image :: <cnd-win32-bitmap>, x, y) => (record)
    let m = m.sheet-medium;
    let hdc = m.medium-drawable.get-dc;
    let newdbc = CreateCompatibleDC(hdc);
    let old = SelectObject(newdbc, image.bitmap-handle);
    let (height, width) = image-dimensions( image );
    BitBlt(hdc, x, y, width, height, newdbc, 0, 0, $SRCCOPY);
    SelectObject(newdbc, old);
    DeleteDC(newdbc);
end method draw-image;

Using these you should be able to call whatever API functions you want
using DUIM windows as the target. Just include the win32-duim library
and module. 

I can't remember the relationship between mirrors and sheets but I do
remember it being mentioned in comp.lang.dylan by Scott McKay. You
might be able to find a deja article about it from 1998
sometime. It was around about the time I was asking about how to wrap
Win32 controls as DUIM gadgets. 

Hopefully someone can expand on what mirrors do and when you need to
use them to get the window handle and what the difference between
using them and using the sheet itself is.

Chris.
-- 
http://www.double.co.nz/dylan


References: