[REBOL] Cool API Function... Almost there.
From: tbrownell::yahoo::com at: 3-Feb-2003 15:34
Well, I've almost got it, the notepad window is popping up, but it's transparency is
seriously messed up (on WinXP anyways)
Any thoughts?
Try this...
rebol []
call "notepad" ;Path to Notepad.
wait 1 ;Give Notepad a chance to load
;Load the library
win-user: load/library %user32.dll
;Find the Windows by class name function
find-window-by-class: make routine! [
ClassName [string!]
WindowName [integer!]
return: [integer!]
] win-user "FindWindowA"
;Set it to the varialbe
hwnd: find-window-by-class "notepad" 0
GWL_EXSTYLE: -20
LWA_COLORKEY: 0
LWA_ALPHA: 128
WS_EX_LAYERED: 128
GetWinLongR: make routine![
hWnd [integer!]
nIndex [integer!]
return: [integer!]
]win-user "GetWindowLongA"
setWinLongR: make routine![
hwnd [integer!]
nIndex [integer!]
return: [integer!]
]win-user "SetWindowLongA"
SetAttributes: make routine! [
hwnd [integer!]
crKey [integer!]
bAlpha [integer!]
dwFlags [integer!]
] win-user "SetLayeredWindowAttributes"
SetWinLongR hwnd GWL_EXSTYLE 0 GetWinLongR hwnd GWL_EXSTYLE
SetAttributes hwnd 95 128 0