summaryrefslogtreecommitdiff
path: root/ping/utils.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'ping/utils.cpp')
-rw-r--r--ping/utils.cpp55
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