Re: SysTrayIconRemove
- Posted by andi49 Jul 07, 2011
- 2756 views
Maybe, this one helps you out. You haven't told what library you use (win32lib etc.). So this doesn't need any.
-- This closes (a freshly startet, no text loaded) notepad (at least on my machine) include dll.e include machine.e without warning constant WM_CLOSE = #0010, WM_QUIT = #0012, WM_DESTROY = #0002 constant caption_of_program_to_close = "untitled - notepad" -- change this to the caption of your prog -- constant caption_of_program_to_close = "c:\\windows\\system32\\cmd.exe" atom hwnd,void,szName constant user32 = open_dll("user32.dll") constant FindWindow = define_c_func(user32,"FindWindowA",{C_INT,C_INT},C_INT) constant SendMessage = define_c_func(user32,"SendMessageA",{C_INT,C_INT,C_INT,C_INT},C_INT) szName=allocate_string(caption_of_program_to_close) -- Findwindow (in this case) is searching for a Window with the Caption -- the string szName points to. Case doesn't matter hwnd=c_func(FindWindow,{0,szName}) -- If it is succesfull it returns the handle to the window free(szName) -- Send the WM_CLOSE (or any other message) void=c_func(SendMessage,{hwnd,WM_CLOSE,0,0})