View Single Post
Old 02-27-2006, 09:16 PM   #1 (permalink)
DJMaze
Senior Contributor
 
DJMaze's Avatar
 
Join Date: Mar 2005
Posts: 733
DJMaze is on a distinguished road
shell32.dll + code:blocks + mingw howto?

while starting to use Code::Blocks and FLTK with the mingw compiler, i've noticed there's no library for shell32.dll functions.
Since i've always used MSVC and BCB i have no clue what to do now.

I am writing my own .h and .cxx file to call the Shell_NotifyIconA and Shell_NotifyIconW functions which reside in the shellapi.

Code:
#ifndef _NOTIFYICON_H
#define _NOTIFYICON_H

//#include <shellapi.h>

extern "C" {
#ifndef WINSHELLAPI
	#define WINSHELLAPI DECLSPEC_IMPORT
#endif

#define NIM_ADD         0x00000000
#define NIM_MODIFY      0x00000001
#define NIM_DELETE      0x00000002

#define NIM_SETFOCUS    0x00000003
#define NIM_SETVERSION  0x00000004
#define NOTIFYICON_VERSION 3

#define NIF_MESSAGE     0x00000001
#define NIF_ICON        0x00000002
#define NIF_TIP         0x00000004
#define NIF_STATE       0x00000008
#define NIF_INFO        0x00000010

#define NIS_HIDDEN      0x00000001
#define NIS_SHAREDICON  0x00000002

// Notify Icon Infotip flags
#define NIIF_NONE       0x00000000
#define NIIF_INFO       0x00000001
#define NIIF_WARNING    0x00000002
#define NIIF_ERROR      0x00000003

typedef struct _TRAYICONDATAA {
	DWORD cbSize;
	HWND  hWnd;
	UINT  uID;
	UINT  uFlags;
	UINT  uCallbackMessage;
	HICON hIcon;
#if (_WIN32_IE < 0x0500)
	char *szTip[64];
#else
	char *szTip[128];
	DWORD dwState;
	DWORD dwStateMask;
	char *szInfo[256];
	union {
		UINT uTimeout;
		UINT uVersion;
	} DUMMYUNIONNAME;
	char *szInfoTitle[64];
	DWORD dwInfoFlags;
#if (_WIN32_IE >= 0x600)
	GUID guidItem;
#endif /* _WIN32_IE >= 0x600 */
#endif /* _WIN32_IE < 0x0500 */
} TRAYICONDATAA, *PTRAYICONDATAA;

typedef struct _TRAYICONDATAW {
	DWORD    cbSize;
	HWND     hWnd;
	UINT     uID;
	UINT     uFlags;
	UINT     uCallbackMessage;
	HICON    hIcon;
#if (_WIN32_IE < 0x0500)
	wchar_t *szTip[64];
#else
	wchar_t *szTip[128];
	DWORD    dwState;
	DWORD    dwStateMask;
	wchar_t *szInfo[256];
	union {
		UINT uTimeout;
		UINT uVersion;
	} DUMMYUNIONNAME;
	wchar_t *szInfoTitle[64];
	DWORD    dwInfoFlags;
#if (_WIN32_IE >= 0x600)
	GUID guidItem;
#endif /* _WIN32_IE >= 0x600 */
#endif /* _WIN32_IE < 0x0500 */
} TRAYICONDATA, TRAYICONDATAW, *PTRAYICONDATAW;


// Function pointer declarations
typedef BOOL (WINAPI *pfShell_NotifyIcon)(DWORD dwMessage, PTRAYICONDATAW lpData);

extern pfShell_NotifyIcon __Shell_NotifyIcon;

} /* extern "C" */

#endif /* _NOTIFYICON_H */
is the following correct?
Code:
typedef BOOL (WINAPI *pfShell_NotifyIcon)(DWORD dwMessage, PTRAYICONDATAW lpData);
Since MSDN defines it as
Code:
WINSHELLAPI BOOL WINAPI Shell_NotifyIconW(DWORD dwMessage, PTRAYICONDATAW lpData);
And now should i build a .lib for shell32.dll and include it somehow?
DJMaze is offline   Reply With Quote