1. Need help: wrap System Tray for Win32lib
Still can't get the program to work, but it runs without error. Here's the
code. I need to pass the address of the pointer to IconData in the
ShellNotify function, but I don't know what type of variable to use for
that. I've tried both C_LONG and C_POINTER (which I know is wrong), and
neither works.
--------------------------------------------------------------------------
include win32lib.ew
constant
NIM_ADD = #0,
NIM_MODIFY = #1,
NIM_DELETE = #2,
NIF_MESSAGE = #1,
NIF_ICON = #2,
NIF_TIP = #4
constant
CXFULL = c_func(xGetSystemMetrics, {SM_CXSCREEN}),
CYFULL = c_func(xGetSystemMetrics, {SM_CYSCREEN}),
Win = create( Window, "Taskbar Window Hide", 0, 0, 0, CXFULL, CYFULL, 0)
constant
hIcon = create( Icon, "Blue", Win, 0, 0, 32, 32, 0)
setIcon(hIcon, "dbb.ico")
global constant
xShellNotify = linkFunc(shell32, "Shell_NotifyIconA", {C_UINT, C_LONG},
C_INT)
global constant
ncbSize = allot(Long),
nhWnd = allot(Long),
nUID = allot(UInt),
nUFlags = allot(UInt),
nCallBack = allot(UInt),
nhIcon = allot(Long),
nszTip = allot(Lpsz),
ndwState = allot(Long),
nszInfo = allot(Lpsz),
nUnion = allot(UInt),
nszInfoTitle = allot(Lpsz),
ndwInfoFlags = allot(Long)
global constant
SIZEOF_ICONDATA = allotted_size()
atom pIconData, winHandle, iconHandle
atom ok
winHandle = getHandle(Win)
iconHandle = getHandle(hIcon)
pIconData = allocate_struct(SIZEOF_ICONDATA)
store(pIconData, ncbSize, SIZEOF_ICONDATA)
store(pIconData, nhWnd, winHandle)
store(pIconData, nUID, 757)
store(pIconData, nUFlags, NIF_ICON)
store(pIconData, nhIcon, iconHandle)
procedure hide_taskbar(object style, object x, object y)
object junk
junk = style
junk = x
junk = y
ok = c_func( xShellNotify, {NIM_ADD, pIconData} )
end procedure
procedure open_taskbar()
ok = c_func( xShellNotify, {NIM_ADD, pIconData} )
end procedure
onResize[Win] = routine_id("hide_taskbar")
onOpen[Win] = routine_id("open_taskbar")
WinMain( Win, Minimize)