|
|
Thanx for this, very nice
|
|
|
|
|
Hi,
I am working on an application which can restrict notepad application from moving. For that, I am writing a HOOK dll and using WH_CALLWNDPROC to trap WM_WINDOWPOSCHANGED & WM_WINDOWPOSCHANGING messages. As per the MSDN we can not modify the message in WH_CALLWNDPROC hook.
Is there any way to restrict a window(Notepad, Word, IE) movement ?
Regards
Anuj
|
|
|
|
|
Nice liitle utility, just what I wanted.
|
|
|
|
|
This simple and neat utility basically does what i wanted and only that!!
Thanks.
SRV
|
|
|
|
|
It seems to be related to the nView menu that nVidia installs with its video drivers. Every time the nView menu pops up, a new "Tray Me" pops up into the System menu.
I can disable the nView menu since I don't use it, but this may get problematic over a long session with an application (days).
Oh, forgot to add - great little app. Thanks for writing it!
-- modified at 18:03 Monday 7th August, 2006
|
|
|
|
|
I have searched for days (it feels like months) to find an example of hooking messages in other process's windows (not just mouse and keyboard, like everyone else seems to be obsessed with).
You may have just saved my sanity
James Randle.
|
|
|
|
|
I was browsing the site to get some example to do something like this... and I found it ready to use! Thanks a lot! Really useful!
|
|
|
|
|
Could you provide me with a C# version of this? I'm still pretty new and am having a hard time understanding the code here.
|
|
|
|
|
HookDll.dll:Hooks.cpp
It appeared that share section has "g_iLastIndex" that is not actual. I have added SWM_TRAYUNINSTALL message and moved "free minimized windows" code to InitMenuHookProc.
A. Sakhno 2006/05/15
Summary of changes can be found below:
<br />
#pragma data_seg(".SHARE")<br />
HHOOK g_hInitMenuHook = NULL;<br />
HHOOK g_hMenuCommandHook = NULL;<br />
WNDDATA g_listWnd[255];<br />
UINT g_iLastIndex = 0;<br />
UINT SWM_TRAYMSG = 0;<br />
UINT SWM_TRAYUNINSTALL = 0; <br />
#pragma data_seg()<br />
<br />
BOOL APIENTRY DllMain( HANDLE hModule, <br />
DWORD ul_reason_for_call, <br />
LPVOID lpReserved<br />
)<br />
{<br />
...<br />
SWM_TRAYUNINSTALL= RegisterWindowMessage("MY_HOOK_UNINSTALL");<br />
...<br />
}<br />
.....
<br />
BOOL WINAPI UnInstallHook()<br />
{<br />
BOOL bSuccess = FALSE;<br />
SendMessage(HWND_BROADCAST,SWM_TRAYUNINSTALL,NULL,NULL);<br />
bSuccess = UnhookWindowsHookEx(g_hInitMenuHook);<br />
if(!bSuccess){<br />
return FALSE;<br />
}<br />
<br />
bSuccess = UnhookWindowsHookEx(g_hMenuCommandHook);<br />
if(!bSuccess){<br />
return FALSE;<br />
}<br />
<br />
return TRUE;<br />
}<br />
...
<br />
LRESULT CALLBACK InitMenuHookProc(int nCode, WPARAM wParam, LPARAM lParam)<br />
{<br />
if (nCode < 0){<br />
return CallNextHookEx(g_hInitMenuHook, nCode, wParam, lParam); <br />
}<br />
<br />
CWPSTRUCT *wps = (CWPSTRUCT*)lParam;<br />
if (wps->message == SWM_TRAYUNINSTALL) { <br />
for(UINT i = 0; i < g_iLastIndex; i++){<br />
if(g_listWnd[i].m_bMinimized){<br />
Shell_NotifyIcon(NIM_DELETE, &g_listWnd[i].m_niData);<br />
ShowWindow(g_listWnd[i].m_hWnd, SW_SHOW);<br />
g_listWnd[i].m_bMinimized = FALSE;<br />
}<br />
}<br />
}else.....<br />
Anatoly Sakhno
-- modified at 10:58 Monday 15th May, 2006
|
|
|
|
|
I assume what you mention is the reason that the "free minimized windows" code is commented out--it isn't global so can't track all the windows, in reality. [Making this broadcast message necessary]. Is that right?
-=r
|
|
|
|
|
On the first mouse click, the system menu is not getting populated with the new "Tray Me" menu item with many applications like Internet Explorer...
Why is this happenning, and what can be the solution?
|
|
|
|
|
I am trying this with Windows XP Media Center Edition and it doesn't seem to work - Jus shows a bunch of additional menus for Explorer but not for any other windows. Anybody noticed this?
|
|
|
|
|
This program is great! I just installed it at both home and work.
When I try to tray Novell GroupWise, the "Tray Me" option is disabled. Obviously, I would like to know if anyone has found a workaround, but more interestingly I would like to know how it does this. Could it have something to do with it already extending its popup menu for taskbar right clicks (It has an "always on top" option)? This could possibly be related to why you can't tray CMD windows (they also have a custom menu), although with them you don't even get the "Tray Me" option.
Thanks for you contribution, Chau.
- Xavier
|
|
|
|
|
Why doesn't it work with CMD windows?
|
|
|
|
|
Exactly, why?... would be nice to tray some tail -f's
|
|
|
|
|
heh..that was the sole reason i downloaded it. lol. ive tried other programs that also dont work for it.
|
|
|
|
|
Hey thanks for the app...
I was trying to compile your code to make some changes, but it gives missing semicolon error in TrayIcon.cpp
// Global Variables:
HINSTANCE hInst; // current instance
NOTIFYICONDATA niData; // notify icon data
HMODULE hInjectDLL = NULL;
BOOL bEnabled = FALSE;
right after HINSTANCE hinst
Basically I was trying to get rid of the tray icon by commenting out the line:
Shell_NotifyIcon(NIM_ADD, &niData);
Let me know if you know what's going on.
Thanks!
Shom
sombando at hotmail dot com
|
|
|
|
|
Tray icon works fine in XP, but in Win98 (tried on several computers) once a program is minimized to the system tray it can't be restored, even with tray icon still running.
Have to use ctrl-alt-del to kill the minimized program.
Suggestions?
|
|
|
|
|
Hi,
I have the Icon displayed on the Task Bar, but How do I associate my Outlook window(or any other window) to be minimized to the Task Bar.
|
|
|
|
|
First, ensure his program is enabled.
Then, right click on the program in the task bar and select "Tray Me" to put it in the system tray.
|
|
|
|
|
Its really handy, I've thought several times to write something similar.
Only one thing to concider : when you have some windows 'trayed' and exit from the the app those windows remain in tray forever. I think on app exite the best thing to is to untray all ...
|
|
|
|
|
Thanks for good suggestion, Vasko. Try to improve it if you have time, and please remember to announce to me if you finish. I'll try and let you know too.
Chau Nguyen
|
|
|
|
|
I try to learn to write this program, but i did not know how to start it... Please help me...
TL A new member of The code Project
write a program that maintains a list of books for a library. The program must accept commands to make insertions and deletions in this list, while simultaneously maintaining the list in alphabetical order for three keys: Subject, Author, and Title.
Input
1. The book information created in previous executions of this program, if any, is stored in text file "books.txt". Each book's information is on three consecutive lines. The format of each line is described in the table below:
Line Information
1 Book Title
2 Author (last name, first name)
3 Subject
2. The program inputs commands from the user (keyboard) to insert, delete, list by key, and quit. You are free to implement the "user interface" part of the program as you wish, as long as it is easy to use.
Output
1. The results of each operation should be written to the screen. In addition, transaction information describing the processing of each command should be written to an output file. (For instance, for an Insert command, the output file should contain the title, author, and subject information, as well as the location where the record was inserted and the location of its entry in each ordering array.) The information in the output file should be neatly formatted and clearly labeled.
2. The "books.txt" text file should be rewritten to contain the updated book information.
Data Structures
The records containing information about each book (subject, author, and title strings) must be stored in an unsorted list. These records may be stored in consecutive array slots in the order in which they are inserted. For example, if the book information is stored in an list called bookData, bookData.info[0] contains information about the first book inserted, bookData.info[1] contains information about the second book inserted and so on.
The list must be maintained in order by title, in order by author, and in order by subject by using arrays of pointers (indexes), one for each key. For instance, suppose the key order information is stored in sorted lists: titleOrder, authorOrder and subjectOrder.
The zero'th array slot contains the index of the first book record with the appropriate key. For example, titleOrder.info[0] indicates the index of the book that comes first alphabetically by title. If titleOrder.info[0] = 5, then bookData.info[5] contains the first alphabetical title. The next book, in alphabetical order by title, would be found in the bookData array at the index indicated by titleOrder.info[1]. For index >= 0, titleOrder.info[index]contains the index in bookData of the next title in the alphabetic ordering. The authorOrder and subjectOrder lists work similarly.
Commands
The program must be able to process the following commands:
Insert a Book
Prompt the user for the author, title, and subject. Add entry for this book in the next available location in the bookData list, then update the titleOrder, authorOrder, and subjectOrder lists. Print a message to the screen and write transaction information to the output file. If the bookData list is full, print an error message and abort the insertion, leaving all of the lists unchanged.
Delete a Book
Prompt the user for the name of the book to delete. (You can assume that this is a unique key.) Search for the title to be deleted. If it is found, all the ordering lists must be updated. Print a message to the screen and write transaction information to the output file. If the book is not found, leave the lists unchanged, and print an error message.
List by Key
Prompt the user to specify which key to use for ordering the output. Print out the information about each book, in the indicated order, to the screen and to the transaction file. Format this information clearly. If the list is empty, print an appropriate message.
Quit
Prompt the user to verify that he or she wants to quit; if so, save the book information to file "books.txt" and terminate the program.
thank....;P
write a program that maintains a list of books for a library. The program must accept commands to make insertions and deletions in this list, while simultaneously maintaining the list in alphabetical order for three keys: Subject, Author, and Title.
Input
1. The book information created in previous executions of this program, if any, is stored in text file "books.txt". Each book's information is on three consecutive lines. The format of each line is described in the table below:
Line In
|
|
|
|
|
Sounds like what you need is to create database. Then that database will look after all those things you want it to. Then all you need is to write a front end to control the database, in say MFC, PHP or XML maybe?
mySQL is a great place to start, it's free and it has examples and code of how to achive all those things.
Good luck...
|
|
|
|
|