1. Need help learning to wrap functions in Dlls in Win32
I'm trying to learn how to wrap functions in Dlls, and thought I would
start by wrapping the Shell_NotifyIcon function in shell32.dll. I want to
use Win32lib for other things, so I didn't use Bernie Ryan's win32api.ew,
but I did look at it and try to understand it.
I THINK I've got the gist, but I'm still having some trouble. Here's the
code:
code begin/
constant
Win = create( Window, "Taskbar Window Hide", 0, 0, 0, 640, 480, 0)
global constant
xShellNotify = linkFunc(shell32, "Shell_NotifyIconA", {C_LONG, C_LONG},
C_INT)
global constant
niccbSize = allot(Long),
nichIconData = allot(Long),
nicUID = allot(UInt),
nicUFlags = allot(UInt),
nicCallBack = allot(UInt),
nichIcon = allot(Long),
SIZEOF_ICONDATA = allotted_size()
atom NOTIFYICONDATA
NOTIFYICONDATA = allocate_struct(SIZEOF_ICONDATA)
atom pIconData
atom ok
pIconData = allocate_struct(SIZEOF_ICONDATA)
procedure hide_taskbar(object style, object x, object y)
ok = c_func( xShellNotify, {#10005, pIconData} )
end procedure
onResize[Win] = routine_id("hide_taskbar")
WinMain( Win, Normal)
/end code
This does nothing but put the window on the screen. Did I wrap the function
right? What am I doing wrong?
Thanks,
Sherm
2. Re: Need help learning to wrap functions in Dlls in Win32
Your structure is not correct. Go here for the structure discription :
TA.htm
This is not a easy function to use, maybe you want to try something a
little easier until you become familiar declaring and using functions.
3. Re: Need help learning to wrap functions in Dlls in Win32
I see that the structure is wrong now. Thanks. The API documentation on the
RDS website doesn't match this.
Additional questions: Once I get the structure set right, how do I set the
uID of the Icon, and the hwnd to the Icon? Also, do I need to set the
values of the other structure members if I'm not going to use them?
Thanks again,
Sherm
4. Re: Need help learning to wrap functions in Dlls in Win32
- Posted by Bernie Ryan <xotron at BUFFNET.NET>
Apr 12, 2000
-
Last edited Apr 13, 2000
On Wed, 12 Apr 2000 18:48:08 -0400, SR Williamson <SR.Williamson at OSHA.GOV>
wrote:
>I see that the structure is wrong now. Thanks. The API documentation on the
>RDS website doesn't match this.
>
>Additional questions: Once I get the structure set right, how do I set the
>uID of the Icon, and the hwnd to the Icon? Also, do I need to set the
>values of the other structure members if I'm not going to use them?
>
>Thanks again,
>Sherm
I do not know how to do everything using david's library. I think you
will have to get David or Brian to help you.
uID can be any unique ID number that you want to assign to the structure
so that your program can identify who the window's data is intended for.
5. Re: Need help learning to wrap functions in Dlls in Win32
On Wed, 12 Apr 2000 18:48:08 -0400, SR Williamson <SR.Williamson at OSHA.GOV>
wrote:
>I see that the structure is wrong now. Thanks. The API documentation on the
>RDS website doesn't match this.
>
>Additional questions: Once I get the structure set right, how do I set the
>uID of the Icon, and the hwnd to the Icon? Also, do I need to set the
>values of the other structure members if I'm not going to use them?
>
>Thanks again,
>Sherm
uID is any unique number you want to set it to (I think). Using win32lib,
you can call the getHandle() function to return the hWnd (more
appropriately, hIcon) to the icon object. As a standard percaution, any
unused members of a structure should be set to NULL. Otherwise, you could
inadvertantly end up feeding the C routines bad pointers, and that, as a
general rule, is a 'Bad Thing'.
Good Luck,
Brian
6. Re: Need help learning to wrap functions in Dlls in Win32
Hello Sherm,
Thursday, April 13, 2000, 12:48:08 AM, you wrote:
SW> I see that the structure is wrong now. Thanks. The API documentation on the
SW> RDS website doesn't match this.
SW> Additional questions: Once I get the structure set right, how do I set the
SW> uID of the Icon, and the hwnd to the Icon? Also, do I need to set the
SW> values of the other structure members if I'm not going to use them?
SW> Thanks again,
SW> Sherm
i wrapped the Shell_NotifyIconA function successfully for a simple
program with a tray icon. i was just curious if i would be able to do
this. the program does only move the mouse pointer every 5 seconds.
if you want, i can send you my code as zip or whatever.
Best regards,
Hendrik mailto:hm-1704 at gmx.de
homepage: http://www.spaceports.com/~thc98/