MFC DLL's
-
Hi, I want to create a DLL which puts and icon in the taskbar on click of tht icon an exe is run. I wrote the following code. The Compiler is not recognising the VERIFY Macro and AfxGetInstanceHandle method. This code might be wrong becoz i ma jus trying . Could someone help me out with this.
#include #include #include "example.h" #define MYWM_NOTIFYICON (WM_USER+2) BOOL WINAPI DllMain (HINSTANCE hinstDLL, // handle to the DLL module DWORD fdwReason, // reason for calling function LPVOID lpvReserved) // reserved { return TRUE; } EXPORT void WINAPI Systray () { // CString sTip(_T("System Configuration")); DWORD dwMessage=NIM_ADD; NOTIFYICONDATA tnd; HWND m_hWnd; tnd.cbSize = sizeof(NOTIFYICONDATA); tnd.hWnd = m_hWnd; tnd.uID = IDR_TRAYICON; tnd.uFlags = NIF_MESSAGE|NIF_ICON; tnd.uCallbackMessage = MYWM_NOTIFYICON; VERIFY( tnd.hIcon = LoadIcon(AfxGetInstanceHandle(), MAKEINTRESOURCE (IDR_TRAYICON)) ); tnd.uFlags = NIF_MESSAGE|NIF_ICON|NIF_TIP; //lstrcpyn(tnd.szTip, (LPCTSTR)sTip, sizeof(tnd.szTip)/sizeof(tnd.szTip[0]) ); Shell_NotifyIcon(dwMessage, &tnd); if(dwMessage == MYWM_NOTIFYICON) { if((LPARAM)tnd.uCallbackMessage==WM_LBUTTONDBLCLK) { if((WPARAM)tnd.uCallbackMessage==IDR_TRAYICON) { ShellExecute(NULL, "open", "http://www.brigsoft.com/", NULL, "", SW_SHOW); } } } }
Thanks U get wht u Give