Changeset 6817602 in nscp for modules/SysTray


Ignore:
Timestamp:
02/22/06 21:47:57 (7 years ago)
Author:
Michael Medin <michael@…>
Branches:
master, 0.4.0, 0.4.1, 0.4.2, stable
Children:
1b7ae3d
Parents:
89f1a84
Message:

Lots of update (I really should checkin more often :)

Location:
modules/SysTray
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • modules/SysTray/SysTray.cpp

    re26cfe0 r6817602  
    55#include "SysTray.h" 
    66#include "TrayIcon.h" 
     7#include <ServiceCmd.h> 
     8#include <config.h> 
    79 
    810SysTray gSysTray; 
     
    1719SysTray::~SysTray() {} 
    1820bool SysTray::loadModule() { 
     21  std::cout << "Systray: " << serviceControll::GetServiceType(SZSERVICENAME) << std::endl; 
     22  if ((serviceControll::GetServiceType(SZSERVICENAME)&SERVICE_INTERACTIVE_PROCESS)!=SERVICE_INTERACTIVE_PROCESS) { 
     23    NSC_LOG_ERROR("SysTray is not installed (or it cannot interact with the desktop) SysTray wont be loaded. Run " SZAPPNAME " SysTray install ti change this."); 
     24    return true; 
     25  } 
    1926  icon.createThread(); 
    2027  return true; 
     
    2936} 
    3037 
     38int SysTray::commandLineExec(const char* command,const unsigned int argLen,char** args) { 
     39  if (stricmp(command, "install") == 0) { 
     40    try { 
     41      serviceControll::ModifyServiceType(SZSERVICENAME, SERVICE_WIN32_OWN_PROCESS | SERVICE_INTERACTIVE_PROCESS); 
     42      NSC_LOG_MESSAGE(MODULE_NAME " is now able to run as the SERVICE_INTERACTIVE_PROCESS flag has been set."); 
     43    } catch (const serviceControll::SCException& e) { 
     44      NSC_LOG_ERROR("Could not modify service: " + e.error_); 
     45      return -1; 
     46    } 
     47  } else if (stricmp(command, "uninstall") == 0) { 
     48    try { 
     49      serviceControll::ModifyServiceType(SZSERVICENAME, SERVICE_WIN32_OWN_PROCESS); 
     50      NSC_LOG_MESSAGE(MODULE_NAME " is now not able to run as the SERVICE_INTERACTIVE_PROCESS flag has been reset."); 
     51    } catch (const serviceControll::SCException& e) { 
     52      NSC_LOG_ERROR("Could not modify service: " + e.error_); 
     53      return -1; 
     54    } 
     55  } 
     56  return 0; 
     57} 
    3158 
    3259bool SysTray::hasCommandHandler() { 
     
    4067NSC_WRAPPERS_IGNORE_MSG_DEF(); 
    4168NSC_WRAPPERS_IGNORE_CMD_DEF(); 
     69NSC_WRAPPERS_CLI_DEF(gSysTray); 
    4270 
  • modules/SysTray/SysTray.def

    re26cfe0 r6817602  
    1212  NSUnloadModule 
    1313  NSGetModuleDescription 
     14  NSCommandLineExec 
  • modules/SysTray/SysTray.h

    re26cfe0 r6817602  
    44 
    55NSC_WRAPPERS_MAIN(); 
     6NSC_WRAPPERS_CLI(); 
    67 
     8 
     9#define MODULE_NAME "SystemTray" 
    710class SysTray { 
    811private: 
     
    1720 
    1821  std::string getModuleName() { 
    19     return "System Tray icon"; 
     22    return MODULE_NAME; 
    2023  } 
    2124  NSCModuleWrapper::module_version getModuleVersion() { 
     
    3033  bool hasCommandHandler(); 
    3134  bool hasMessageHandler(); 
     35  int commandLineExec(const char* command,const unsigned int argLen,char** args); 
     36 
    3237}; 
  • modules/SysTray/SysTray.vcproj

    rcea178b r6817602  
    170170      <File 
    171171        RelativePath="..\..\include\NSCHelper.cpp"> 
     172      </File> 
     173      <File 
     174        RelativePath="..\..\include\ServiceCmd.cpp"> 
    172175      </File> 
    173176      <File 
     
    216219      </File> 
    217220      <File 
     221        RelativePath="..\..\include\ServiceCmd.h"> 
     222      </File> 
     223      <File 
    218224        RelativePath=".\stdafx.h"> 
    219225      </File> 
Note: See TracChangeset for help on using the changeset viewer.