Click here to Skip to main content
12,816,490 members (30,733 online)
Click here to Skip to main content


1.2K bookmarked
Posted 5 Apr 2002

API hooking revealed

, 2 Dec 2002 CPOL
The article demonstrates how to build a user mode Win32 API spying system
// TrayIcon.h
// SUBSYSTEM:   Hook system
// MODULE:      Hook server
// DESCRIPTION: This code has been based on the Paul DiLascia's sample
//              Copyright 1996 Microsoft Systems Journal.
// AUTHOR:		Ivo Ivanov (
// DATE:		2001 December v1.00
#ifndef _TRAYICON_H_
#define _TRAYICON_H_

// CTrayIcon manages an icon in the Windows 9x/NT/2K system tray. 
class CTrayIcon : public CCmdTarget 
	NOTIFYICONDATA m_nid;			// struct for Shell_NotifyIcon args

	CTrayIcon(UINT uID);

	// Call this to receive tray notifications
	void SetNotificationWnd(CWnd* pNotifyWnd, UINT uCbMsg);
	// SetIcon functions. To remove icon, call SetIcon(0)
	BOOL SetIcon(UINT uID); // main variant you want to use
	BOOL SetIcon(HICON hicon, char* lpTip);
	BOOL SetIcon(LPCTSTR lpResName, char* lpTip)
		return SetIcon(lpResName ? 
			AfxGetApp()->LoadIcon(lpResName) : NULL, lpTip); 
	BOOL SetStandardIcon(LPCTSTR lpszIconName, char* lpTip)
		return SetIcon(::LoadIcon(NULL, lpszIconName), lpTip); 

	virtual LRESULT OnTrayNotification(WPARAM uID, LPARAM lEvent);

//----------------------------End of the file -------------------------------

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.


This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


About the Author

Ivo Ivanov
United States United States
I specialize in OS Internals and Reverse Engineering.
Before joining my current employer I used to run a security blog for malware analysis:

You may also be interested in...

Permalink | Advertise | Privacy | Terms of Use | Mobile
Web01 | 2.8.170308.1 | Last Updated 3 Dec 2002
Article Copyright 2002 by Ivo Ivanov
Everything else Copyright © CodeProject, 1999-2017
Layout: fixed | fluid