Important alert: (current site time 7/15/2013 4:48:25 PM EDT)
 

winzip icon

A way to subclass MSN Messenger, add hooks, dynamically modify menus and control its behavior

Email
Submitted on: 1/1/2002 4:16:41 PM
By: Syed Fahad Gilani 
Level: Advanced
User Rating: By 67 Users
Compatibility: C, C++ (general), Microsoft Visual C++, Borland C++, UNIX C++
Views: 37758
(About the author)
 
     This program will teach you how to create hooks and dynamically control the behavior, outlook or anything related to a window. This program shows subclassing for MSN Messenger, by setting up a hook and then dynamically adding Menu items to MSN Messenger and handling its behaviour to certain events. With this technique, you can virtually do anything to any window or application of which you do not have access to code. Subclassing and hooking can be VERY powerful when used properly. Please check it out and please vote (o= Thanks
 
winzip iconDownload code

Note: Due to the size or complexity of this submission, the author has submitted it as a .zip file to shorten your download time. Afterdownloading it, you will need a program like Winzip to decompress it.Virus note:All files are scanned once-a-day by Planet Source Code for viruses, but new viruses come out every day, so no prevention program can catch 100% of them. For your own safety, please:
  1. Re-scan downloaded files using your personal virus checker before using it.
  2. NEVER, EVER run compiled files (.exe's, .ocx's, .dll's etc.)--only run source code.

If you don't have a virus scanner, you can get one at many places on the net including:McAfee.com

 
Terms of Agreement:   
By using this code, you agree to the following terms...   
  1. You may use this code in your own programs (and may compile it into a program and distribute it in compiled format for languages that allow it) freely and with no charge.
  2. You MAY NOT redistribute this code (for example to a web site) without written permission from the original author. Failure to do so is a violation of copyright laws.   
  3. You may link to this code from another website, but ONLY if it is not wrapped in a frame. 
  4. You will abide by any additional copyright restrictions which the author may have placed in the code or code's description.


Other 5 submission(s) by this author

 


Report Bad Submission
Use this form to tell us if this entry should be deleted (i.e contains no code, is a virus, etc.).
This submission should be removed because:

Your Vote

What do you think of this code (in the Advanced category)?
(The code with your highest vote will win this month's coding contest!)
Excellent  Good  Average  Below Average  Poor (See voting log ...)
 

Other User Comments

1/2/2002 11:54:50 AMTerry Rules

Excellent work my friend! 5 globes from me :D
(If this comment was disrespectful, please report it.)

 
1/2/2002 12:01:19 PMSimon

man... I love you for making this! ITS GREAT!!! PLEASE CAN U TEACH US MORE ON HOOKS?!? 5 GLOBES FROM ME TOO!
(If this comment was disrespectful, please report it.)

 
1/2/2002 1:23:10 PMLCensoni

impressive
(If this comment was disrespectful, please report it.)

 
1/2/2002 1:31:29 PMLCensoni

could you teach us a little more about it?

(If this comment was disrespectful, please report it.)

 
1/3/2002 6:33:04 PMmehr

maan..thsi sithe most awesoen thign ever!ur a pure genius!
i love u for makign this!...it has change dmy life!
(If this comment was disrespectful, please report it.)

 
1/3/2002 6:33:41 PMFahad Gilani

sure LCensoni I can, drop in an email anytime and ask me what u want to :o)
(If this comment was disrespectful, please report it.)

 
1/3/2002 6:34:31 PMmehr

thisis teh most amazign thing!....ur a genius!
i love u for making this...it has changed my life!
(If this comment was disrespectful, please report it.)

 
1/3/2002 9:38:01 PMSyed Fahad Gilani

errr...uhh... riiiight .. :D Thanks anyways (o=
(If this comment was disrespectful, please report it.)

 
1/8/2002 5:02:35 PMSweetCoder

the code is a bit sloppy, average rating
(If this comment was disrespectful, please report it.)

 
1/10/2002 7:39:34 AMStavros

Well done ! Excellent piece of subclassing code.
(If this comment was disrespectful, please report it.)

 
1/10/2002 7:51:24 PMVisual C

I have no idea why this code got as many votes as it did. Its a simple win32 application which makes some api calls, hardly worth anything.
(If this comment was disrespectful, please report it.)

 
1/10/2002 8:34:44 PMSyed Fahad Gilani

Thankyou, Visual C, for your feedback on my code... yea you're right... just some silly bunch of win32 api calls... when I could've done some smart win64 api calls... yup.. dumb program...hardly worth anything, and who needs to know what subclassing is anyways, hah I bet people at microsoft feel stoopid writing programs and doing dumb win32 api calls..sheesh... mate u're right.. we all need a life.. thankyou so much for letting us know how great you are and how low we are :o) have a nice day


Fahad
(If this comment was disrespectful, please report it.)

 
1/14/2002 9:33:04 PMStocker

gr8 code dude! definitely! 5 globes comin' up!
(If this comment was disrespectful, please report it.)

 
1/16/2002 4:37:53 PME-man

This doesnt work with Borland C++, or Unix C++. You should change the compatiblity of your article so people know what it works for.
(If this comment was disrespectful, please report it.)

 
1/24/2002 2:08:03 PMAyesha

Good job Fahad!:)
(If this comment was disrespectful, please report it.)

 
3/21/2002 6:07:14 AMRuwan Sanjeewa

Good and Excellent work
(If this comment was disrespectful, please report it.)

 
3/22/2002 11:36:53 PMMike

Well...this code hasn't exactly changed my life, but it is quite good information on hooks for a beginner. 4 globes from me.

---------------------------------------
www.mscubed.com
(If this comment was disrespectful, please report it.)

 
4/3/2002 3:48:07 PMcyprus

E-Man's right. It doesn't work with BC++ or UNIX C++. It would be helpful to actually compile the code in all of the compilers you claim it works on. It would make life easier for those of us that using these compilers.

Thanks.
(If this comment was disrespectful, please report it.)

 
4/23/2002 7:38:37 AMCentralrock

Great job :-) it 's posible to do the same in vb?
(If this comment was disrespectful, please report it.)

 
4/27/2002 2:24:22 AMDaniel Winter

This is probly due to my lack of knowlegde in C++, but i cant make the menu drop down or do anything (events)
(If this comment was disrespectful, please report it.)

 
6/14/2002 2:19:23 PMnewbie

How do i compile it ? It keeps saying: Error: Unresolved external '_main' reference from (my borland lib path)
i use borland freecommandlinetools, and tried to compile with -tW in it. Could someone please tell me what command i must use.

(If this comment was disrespectful, please report it.)

 
6/14/2002 2:21:22 PMnewbie

Fu*k i feel dumb :-((


(If this comment was disrespectful, please report it.)

 
7/15/2002 1:26:11 PMhey

im a fellow vb'er..could u make a subclass oCX for me..cuz the only that i can find that works is spyworks and that costs money :\
(If this comment was disrespectful, please report it.)

 
7/31/2002 1:40:53 PMDM

I haven't read much of your code by I have to commend you on nice, clean code. Well formatted. Something you dont see here often.
(If this comment was disrespectful, please report it.)

 
7/31/2002 1:41:01 PMDM

I haven't read much of your code but I have to commend you on nice, clean code. Well formatted. Something you dont see here often.
(If this comment was disrespectful, please report it.)

 
7/31/2002 2:02:32 PMDM

One problem with SetWindowsLong()...

GWL_WNDPROC Sets a new address for the window procedure.
Windows NT/2000 or later: You cannot change this attribute if the window does not belong to the same process as the calling thread.
(If this comment was disrespectful, please report it.)

 
3/1/2003 7:19:11 AM

is der anyting in C++ or VB that could allow me 2 code in msn5... im on XP and its stopped me coding in msn 4x :(
(If this comment was disrespectful, please report it.)

 
4/16/2003 9:52:28 AM

By the way, I have MSN Messenger in french, and the class name is different. It's not
(If this comment was disrespectful, please report it.)

 
4/16/2003 9:53:54 AM

By the way, I have MSN Messenger in
french, and the class name is
different. It's not MSBLCLass, but MSNMSBLClass. I struggled with this during half an ahour. I can't drop-down the menu too...

(If this comment was disrespectful, please report it.)

 
6/2/2003 2:37:59 AM

Hi, would you mind explaining more about how it works?

thank you very much
(If this comment was disrespectful, please report it.)

 
2/6/2004 11:33:50 AMJCC

I have compile the sources,and i don't see any changes,it minimizes to the system tray,and apparently doesn't do anything else.What is it suppose to do?
Thank you guys
(If this comment was disrespectful, please report it.)

 
2/12/2004 12:34:54 AM

I change the classname to MSNMSBLClass, it does hook into msn messenger 6, but the appended menu didn't work, the main entry is added, but the submenus were not. any know what's going on?


(If this comment was disrespectful, please report it.)

 
4/15/2004 7:38:35 AM

Has anyone tried this in Visual Studio.Net? I opened the project and it does something weird with the IDE. The main window keeps flasshing, not sure what is happening here :)

(If this comment was disrespectful, please report it.)

 
8/1/2005 11:57:14 AMSAM

Thank you so much for your precious article. I have a question. After registering a new menu, How can I get the menu message from it, when someone click it?

thank you.
(If this comment was disrespectful, please report it.)

 
8/16/2005 4:38:58 PMPreeti

Thanks for the article. It is really helpful. I have a question. CAn we use this to detect any background window?

Also, CAn we use the same Shell_Hook for creating a hook to detect when a window closes. Because your program is to hook when MSN Messenger starts.

Thanks
(If this comment was disrespectful, please report it.)

 

Add Your Feedback
Your feedback will be posted below and an email sent to the author. Please remember that the author was kind enough to share this with you, so any criticisms must be stated politely, or they will be deleted. (For feedback not related to this particular code, please click here instead.)
 

To post feedback, first please login.