diff options
author | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-07-31 05:07:21 +0000 |
---|---|---|
committer | sje <sje@4f64403b-2f21-0410-a795-97e2b3489a10> | 2007-07-31 05:07:21 +0000 |
commit | 0ff1d601dfadfd19e286c021fd1288e8b8b4b7c2 (patch) | |
tree | aafe89e4f6870ad528f00e081d31432cdfbb8d32 /ping/utils.cpp | |
parent | 87a314a0f8b3aa138601963c0e98d339997b9d6e (diff) |
use yapp api for popup classes
use fontservice for fame background colour
add beta changelog url link to svn log
use IPHLPAPI.dll if available, and use only one icmp file handle
git-svn-id: https://server.scottellis.com.au/svn/mim_plugs@316 4f64403b-2f21-0410-a795-97e2b3489a10
Diffstat (limited to 'ping/utils.cpp')
-rw-r--r-- | ping/utils.cpp | 55 |
1 files changed, 42 insertions, 13 deletions
diff --git a/ping/utils.cpp b/ping/utils.cpp index a8aaaef..6cf147a 100644 --- a/ping/utils.cpp +++ b/ping/utils.cpp @@ -1,5 +1,6 @@ #include "common.h"
#include "utils.h"
+#include "icmp.h"
LRESULT CALLBACK NullWindowProc( HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam )
{
@@ -39,21 +40,29 @@ void __stdcall ShowPopup( const char* line1, const char* line2, int flags ) return;
}
- POPUPDATAEX* ppd = ( POPUPDATAEX* )calloc( sizeof( POPUPDATAEX ), 1 );
+ if(ServiceExists(MS_YAPP_CLASSINSTANCE)) {
+ PopupClassInstance d = {sizeof(d), "pingpopups"};
+ d.pwszTitle = (wchar_t *)line1;
+ d.pwszText = (wchar_t *)line2;
+ CallService(MS_YAPP_CLASSINSTANCE, 0, (LPARAM)&d);
+ } else {
+
+ POPUPDATAEX* ppd = ( POPUPDATAEX* )calloc( sizeof( POPUPDATAEX ), 1 );
- ppd->lchContact = NULL;
- ppd->lchIcon = (flags ? hIconResponding : hIconNotResponding);
- strcpy( ppd->lpzContactName, line1 );
- strcpy( ppd->lpzText, line2 );
+ ppd->lchContact = NULL;
+ ppd->lchIcon = (flags ? hIconResponding : hIconNotResponding);
+ strcpy( ppd->lpzContactName, line1 );
+ strcpy( ppd->lpzText, line2 );
- ppd->colorBack = GetSysColor( COLOR_BTNFACE );
- ppd->colorText = GetSysColor( COLOR_WINDOWTEXT );
- ppd->iSeconds = 10;
+ ppd->colorBack = GetSysColor( COLOR_BTNFACE );
+ ppd->colorText = GetSysColor( COLOR_WINDOWTEXT );
+ ppd->iSeconds = 10;
- ppd->PluginWindowProc = ( WNDPROC )NullWindowProc;
- ppd->PluginData = NULL;
+ ppd->PluginWindowProc = ( WNDPROC )NullWindowProc;
+ ppd->PluginData = NULL;
- QueueUserAPC( sttMainThreadCallback , mainThread, ( ULONG )ppd );
+ QueueUserAPC( sttMainThreadCallback , mainThread, ( ULONG )ppd );
+ }
}
// service functions
@@ -72,7 +81,7 @@ int PluginPing(WPARAM wParam,LPARAM lParam) pa->responding = (pa->round_trip_time != -1);
} else {
- IP_ECHO_REPLY result;
+ ICMP_ECHO_REPLY result;
pa->responding = ICMP::get_instance()->ping(pa->pszName, result);
if(pa->responding)
pa->round_trip_time = (short)result.RoundTripTime;
@@ -310,7 +319,7 @@ int ReloadIcons(WPARAM wParam, LPARAM lParam) { return 0;
}
-void InitIcons() {
+void InitUtils() {
if(ServiceExists(MS_SKIN2_ADDICON)) {
SKINICONDESC sid = {0};
@@ -357,6 +366,26 @@ void InitIcons() { hIconTesting = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON_TESTING), IMAGE_ICON, 16, 16, 0);//LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS );
hIconDisabled = (HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_ICON_DISABLED), IMAGE_ICON, 16, 16, 0);//LR_LOADTRANSPARENT | LR_LOADMAP3DCOLORS );
}
+
+ if(ServiceExists(MS_YAPP_REGISTERCLASS)) {
+ PopupClass test = {0};
+ test.cbSize = sizeof(test);
+ test.flags = PCF_TCHAR;
+ test.hIcon = hIconResponding;
+ test.timeout = -1;
+ test.ptszDescription = TranslateT("Ping");
+ test.pszName = "pingpopups";
+ test.windowProc = NullWindowProc;
+ CallService(MS_YAPP_REGISTERCLASS, 0, (WPARAM)&test);
+ }
}
+void DeinitUtils() {
+ if(!ServiceExists(MS_SKIN2_ADDICON)) {
+ if(hIconResponding) DestroyIcon(hIconResponding);
+ if(hIconResponding) DestroyIcon(hIconNotResponding);
+ if(hIconResponding) DestroyIcon(hIconTesting);
+ if(hIconResponding) DestroyIcon(hIconDisabled);
+ }
+}
\ No newline at end of file |