### XML Skin Configuration Example Source: https://github.com/zhongyang219/trafficmonitor/wiki/Skin Making-up Tutorial A comprehensive example of a skin.xml file, demonstrating the structure and common configuration options for TrafficMonitor skins. ```xml 16768959,10022341,16777215,16777215,16777215,16770992,16770992,16770992,16770992 1 zy 上传: 下载: CPU: 内存: 显卡: CPU温度: 显卡温度: b4zc373y ``` -------------------------------- ### Get Plugin Item Value Sample Text Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide Returns sample text for the item's value, used for preview images and width calculations. Ignored if IsCustomDraw returns true. ```c++ virtual const wchar_t* GetItemValueSampleText() const = 0; ``` -------------------------------- ### Get Plugin Item Width with Device Context Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide Gets the width of the display area using a device context handle. Called before GetItemWidth for compatibility. If it returns 0, GetItemWidth is called. ```c++ virtual int GetItemWidthEx(void* hDC) const; ``` -------------------------------- ### Get Plugin Item Width (for Custom Draw) Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide Gets the width of the display area when IsCustomDraw returns true. The main program scales this value based on system DPI. ```c++ virtual int GetItemWidth() const ``` -------------------------------- ### Get Plugin Item Label Text Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide Returns the label text for the displayed item. This is ignored if IsCustomDraw returns true. ```c++ virtual const wchar_t* GetItemLableText() const = 0; ``` -------------------------------- ### Get Plugin Item Name Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide Returns the name of the plug-in item. This name is displayed in various menus and dialogs within TrafficMonitor. ```c++ virtual const wchar_t* GetItemName() const = 0; ``` -------------------------------- ### Get Unique Plugin Item ID Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide Returns a unique string ID for the display item. Ensure this ID is unique and contains only letters and numbers. ```c++ virtual const wchar_t* GetItemId() const = 0; ``` -------------------------------- ### Get Plugin Item Value Text Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide Returns the value text for the displayed item. This is ignored if IsCustomDraw returns true. Avoid fetching monitoring data here; use ITMPlugin::DataRequired instead. ```c++ virtual const wchar_t* GetItemValueText() const = 0; ``` -------------------------------- ### GetItemWidth Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide Gets the width of the display area for self-drawn items. This function is only valid when IsCustomDraw returns true. The returned value is the base width at 96 DPI and will be scaled by the main program. ```APIDOC ## GetItemWidth ### Description This function is used to get the width of the display area. Override this function is valid only when the IsCustomDraw function returns true. ### Function Prototype ```c++ virtual int GetItemWidth() const ``` ### Note * The returned value is the width when the DPI is 96 (100%). The main program will automatically scale up according to the current system DPI setting, so you don't need to return different values for different DPI settings. * The return value here represents the minimum width required for the self-drawn area, and the value of the parameter *w* in the DrawItem function may be greater than this value. ``` -------------------------------- ### GetItemWidthEx Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide Gets the width of the display area, similar to GetItemWidth, but includes a device context handle (hDC) for more precise width calculations. The main program calls this function first; if it returns 0, GetItemWidth is called. ```APIDOC ## GetItemWidthEx ### Description Basically the same as GetItemWidth. This function is added while keeping the GetItemWidth function for compatibility with older versions of the plugin. Compared with the GetItemWidth function, this function adds the parameter *hDC*, which is the context handle of the drawing. It can be used to calculate the width of the display area. When the main program needs to get the width of the displayed item, it will call this function first. If the return value is 0, call the GetItemWidth function. ### Function Prototype ```c++ virtual int GetItemWidthEx(void* hDC) const; ``` ``` -------------------------------- ### Configure Layout for 'Show More Info' Checked Source: https://github.com/zhongyang219/trafficmonitor/wiki/Skin Making-up Tutorial Defines the window width and height when the 'Show More Info' option is checked. The aspect ratio should match the background image to avoid stretching. ```xml ``` -------------------------------- ### ShowOptionsDialog Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide Allows plugins to display an options settings dialog. If overridden, it should return OR_OPTION_CHANGED or OR_OPTION_UNCHANGED. If not overridden, the main program will indicate that no settings dialog is provided. ```APIDOC ## ShowOptionsDialog ### Description This function does not have to be rewritten. If the plug-in provides an option setting dialog, you should override this function and return OR_OPTION_CHANGED or OR_OPTION_UNCHANGED at the end. ### Method ```c++ virtual OptionReturn ShowOptionsDialog(void* hParent); ``` ### Parameters #### Path Parameters - **hParent** (void*) - The handle of the parent window of the option setting dialog. ### Returns - **OptionReturn** - An enumerate value indicating the result of the option settings. - OR_OPTION_CHANGED: The option settings are changed. - OR_OPTION_UNCHANGED: The option settings are not changed. - OR_OPTION_NOT_PROVIDED: The option setting dialog is not provided. ``` -------------------------------- ### Implement TMPluginGetInstance and Return Plugin Instance Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide This C++ code demonstrates how to export the TMPluginGetInstance function and return a pointer to an existing plugin instance, such as a singleton instance of a derived CPluginDemo class. ```c++ #ifdef __cplusplus extern "C" { #endif __declspec(dllexport) ITMPlugin* TMPluginGetInstance(); #ifdef __cplusplus } #endif ///////////////////////////////////////////////////////////// ITMPlugin* TMPluginGetInstance() { return &CPluginDemo::Instance(); } ``` -------------------------------- ### GetInfo Function Prototype Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide This is the function prototype for GetInfo. It is used by the main program to obtain plugin information based on the provided index. Do not return a null pointer. ```c++ virtual const wchar_t* GetInfo(PluginInfoIndex index) = 0; ``` -------------------------------- ### Configure Auto Run via Task Scheduler (Temperature Monitoring Version) Source: https://github.com/zhongyang219/trafficmonitor/blob/master/Help_en-us.md Versions with temperature monitoring use the Task Scheduler for auto-run. Verify that the TrafficMonitor scheduled task is created correctly and points to the right executable path. ```plaintext Control Panel\System and Security\Administrative Tools ``` -------------------------------- ### Configure General Layout Attributes Source: https://github.com/zhongyang219/trafficmonitor/wiki/Skin Making-up Tutorial Sets the height for all displayed items and controls whether labels are shown. Setting 'no_label' to 1 affects the 'Swap the position of upload and download' option. ```xml ``` -------------------------------- ### OnMonitorInfo Function Prototype Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide This is the function prototype for OnMonitorInfo. It receives monitoring information from the main program, such as network speed and CPU/memory utilization. ```c++ virtual void OnMonitorInfo(const MonitorInfo& monitor_info); ``` -------------------------------- ### Configure Auto Run via Registry (Older Versions) Source: https://github.com/zhongyang219/trafficmonitor/blob/master/Help_en-us.md For versions without temperature monitoring or prior to 1.80, auto-run is managed through the Windows registry. Ensure the 'TrafficMonitor' key exists and the program path is correct. Moving the program invalidates this setting. ```plaintext Computer\HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run ``` -------------------------------- ### GetTooltipInfo Function Prototype Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide This is the function prototype for GetTooltipInfo. It returns the text to be displayed in the tooltip. Returning an empty string will result in no tooltip text. ```c++ virtual const wchar_t* GetTooltipInfo(); ``` -------------------------------- ### ShowOptionsDialog Function Prototype Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide This is the function prototype for ShowOptionsDialog. It allows plugins to display an options dialog. It should return OR_OPTION_CHANGED or OR_OPTION_UNCHANGED if overridden. ```c++ virtual OptionReturn ShowOptionsDialog(void* hParent); ``` -------------------------------- ### GetTooltipInfo Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide Provides text to be displayed in a tooltip. If an empty string is returned, no tooltip text will be added. ```APIDOC ## GetTooltipInfo ### Description This function does not have to be rewritten. The function returns the text used to display in the tool tip. If it returns an empty string, no text will be added to the tool tip. ### Method ```c++ virtual const wchar_t* GetTooltipInfo(); ``` ### Returns - **const wchar_t*** - A string for the tooltip. Do not return a null pointer. ``` -------------------------------- ### Enable Portable Mode Configuration Source: https://github.com/zhongyang219/trafficmonitor/blob/master/Help_en-us.md This configuration snippet is used to manage settings saving. Setting 'portable_mode' to 'false' ensures settings are saved to a persistent location, typically AppData, rather than the program directory. ```ini [config] portable_mode = false ``` -------------------------------- ### Configure Display Item Position and Properties Source: https://github.com/zhongyang219/trafficmonitor/wiki/Skin Making-up Tutorial Sets the horizontal (x) and vertical (y) position, width, alignment, and visibility (show) for a display item within the layout. ```xml ``` -------------------------------- ### GetInfo Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide Retrieves information about the plugin, such as its name, version, or author. This information is displayed in the 'Plugin Management'-'Detailed' section of the main program. ```APIDOC ## GetInfo ### Description The main program calls this function to obtain information about this plug-in. Return the corresponding information according to the value of *index*. ### Method ```c++ virtual const wchar_t* GetInfo(PluginInfoIndex index) = 0; ``` ### Parameters #### Path Parameters - **index** (PluginInfoIndex) - Required - Specifies which piece of information to retrieve. Refer to the PluginInfoIndex type comment for possible values. ### Returns - **const wchar_t*** - A string containing the requested plugin information. Do not return a null pointer. ``` -------------------------------- ### OnMonitorInfo Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide Receives monitoring information from the main program, such as network speed, CPU, and memory utilization. This function can be overridden to access this data within the plugin. ```APIDOC ## OnMonitorInfo ### Description This function does not have to be rewritten. When the main program obtains the monitoring information, it will call this function to pass all the obtained monitoring information to the plug-in. It means that information such as network speed, CPU and memory utilization, temperature and other information obtained in the main program can also be obtained in the plug-in. ### Method ```c++ virtual void OnMonitorInfo(const MonitorInfo& monitor_info); ``` ### Parameters #### Path Parameters - **monitor_info** (MonitorInfo&) - An object of the MonitorInfo structure containing all the monitoring information obtained in the main program. ``` -------------------------------- ### GetItemValueSampleText Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide Returns a sample text string representing the item's value. This text is used in the 'Change Skin' dialog preview and for calculating taskbar item width. It is ignored if custom drawing is enabled and must not return a null pointer. ```APIDOC ## GetItemValueSampleText ### Description The function returns a string as sample text that displays the value of the item. The text returned here will be used as the text displayed in the preview image in the "Change Skin" dialog, and also used to calculate the width of the taskbar display item based on the length of this string. If the IsCustomDraw function returns true, the return value here will be ignored. ### Function Prototype ```c++ virtual const wchar_t* GetItemValueSampleText() const = 0; ``` ### Note Do not return a null pointer. ``` -------------------------------- ### GetItem Function Prototype Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide This is the function prototype for GetItem. It is used to return an instance of display items provided by the plugin. Implementers must check the index value to avoid returning null pointers incorrectly. ```c++ virtual IPluginItem* GetItem(int index) = 0; ``` -------------------------------- ### Configure Plugin Item Mapping Source: https://github.com/zhongyang219/trafficmonitor/wiki/Skin Making-up Tutorial Maps plugin items to node names for display in the main window. The value is the plugin item ID. ```xml b4zc373y ``` -------------------------------- ### Export TMPluginGetInstance Function Signature Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide This is the required function signature for exporting the plugin instance. The function returns a pointer to the ITMPlugin interface. ```c++ ITMPlugin* TMPluginGetInstance(); ``` -------------------------------- ### GetItem Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide Retrieves an instance of a display item provided by the plugin. Plugins can offer multiple display items, each corresponding to an IPluginItem interface. This function returns the appropriate item based on the provided index. ```APIDOC ## GetItem ### Description Returns the instance of the display items provided by this plug-in. A plug-in dll can provide multiple objects that implement the IPluginItem interface, corresponding to multiple display items. This function returns the corresponding object according to the value of *index*. ### Method ```c++ virtual IPluginItem* GetItem(int index) = 0; ``` ### Parameters #### Path Parameters - **index** (int) - Required - The index of the desired IPluginItem. ### Returns - **IPluginItem*** - A pointer to the IPluginItem interface if the index is valid, otherwise a null pointer. ``` -------------------------------- ### OnExtenedInfo Function Prototype Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide This is the function prototype for OnExtenedInfo. It is called by the main program to pass additional information to the plugin, identified by an index. ```c++ virtual void OnExtenedInfo(ExtendedInfoIndex index, const wchar_t* data); ``` -------------------------------- ### OnExtenedInfo Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide Receives extended information passed from the main program. The index parameter distinguishes the type of information being passed. ```APIDOC ## OnExtenedInfo ### Description This function does not have to be rewritten. The main program will call this function when needed to pass more information to the plug-in. Overriding this function can receive the information passed by the main program. ### Method ```c++ virtual void OnExtenedInfo(ExtendedInfoIndex index, const wchar_t* data); ``` ### Parameters #### Path Parameters - **index** (ExtendedInfoIndex) - Information index, used to distinguish the information passed to the plug-in. It's defined in the ExtendedInfoIndex enum. - **data** (const wchar_t*) - The passed data which represented by a string. ``` -------------------------------- ### IsCustomDraw Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide Determines if the plug-in will handle the drawing of the display item. If true, the plug-in must override the DrawItem function. If false, the main program handles drawing using GetItemLableText and GetItemValueText. ```APIDOC ## IsCustomDraw ### Description This function only needs to return true or false. It is used to set whether the display area of this display item is drawn by the plug-in itself. If this function returns false, the display item is not drawn by the plug-in itself, but drawn by the main program. The main program will draw the display area based on the text returned by GetItemLableText and GetItemValueText. At this time, overriding the DrawItem function will not work. If this function returns true, the display item is drawn by the plug-in itself. When the display area needs to be drawn, the main program calls the DrawItem function to draw. At this time, the DrawItem function must be override and the code for drawing the display area must be added. At this time, the return values of GetItemLableText, GetItemValueText, and GetItemValueSampleText will be ignored by the main program. ### Function Prototype ```c++ virtual bool IsCustomDraw() const; ``` ``` -------------------------------- ### GetItemName Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide Returns the name of the plug-in item. This name is displayed in various parts of the TrafficMonitor UI, such as context menus and settings dialogs. It is crucial that this method does not return a null pointer. ```APIDOC ## GetItemName ### Description Returns the name of the plug-in item. This name will be displayed in the "Display Items" submenu of the TrafficMonitor taskbar contex menu, as well as the "Display Settings" dialog and the text color settings dialog in the "Main Window Settings" and "Taskbar Window Settings" in the Option Settings dialog. ### Function Prototype ```c++ virtual const wchar_t* GetItemName() const = 0; ``` ### Note Do not return a null pointer. ``` -------------------------------- ### Mouse Event Handling Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide This function is called when a mouse event occurs within the plugin's display area. Returning 1 indicates the event has been handled. ```c++ virtual int OnMouseEvent(MouseEventType type, int x, int y, void* hWnd, int flag); ``` -------------------------------- ### DataRequired Function Prototype Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide This is the function prototype for DataRequired. The main program calls this at regular intervals to retrieve data for all displayed items. ```c++ virtual void DataRequired() = 0; ``` -------------------------------- ### DataRequired Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide This function is called by the main program at regular intervals. The plugin should use this method to retrieve data for all its displayed items. ```APIDOC ## DataRequired ### Description This function is called by the main program at regular intervals. The plug-in needs to get the data of all displayed items here. ### Method ```c++ virtual void DataRequired() = 0; ``` ``` -------------------------------- ### GetItemLableText Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide Returns the label text for the displayed item. This text is used by the main program for display if custom drawing is not enabled. It must not return a null pointer. ```APIDOC ## GetItemLableText ### Description The function returns a string as the label text of the displayed item. If the IsCustomDraw function returns true, the return value here will be ignored. ### Function Prototype ```c++ virtual const wchar_t* GetItemLableText() const = 0; ``` ### Note Do not return a null pointer. ``` -------------------------------- ### Determine if Plugin Handles Custom Drawing Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide Returns true if the plugin draws the display area itself, false otherwise. If true, the DrawItem function must be overridden. ```c++ virtual bool IsCustomDraw() const; ``` -------------------------------- ### Configure Taskbar Left Space in Windows 11 Source: https://github.com/zhongyang219/trafficmonitor/wiki/Option Settings Manually adjust the distance of the taskbar window from the left side of the taskbar in Windows 11 by modifying the 'task_bar' section in the 'config.ini' file. ```ini [task_bar] taskbar_left_space_win11 = 160 ``` -------------------------------- ### GetItemValueText Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide Returns the value text for the displayed item. Similar to GetItemLableText, this is used for display when custom drawing is disabled. It's recommended to fetch monitoring data in ITMPlugin::DataRequired and return the formatted string here. This method must not return a null pointer. ```APIDOC ## GetItemValueText ### Description The function returns a string as the value text of the displayed item. If the IsCustomDraw function returns true, the return value here will be ignored. ### Function Prototype ```c++ virtual const wchar_t* GetItemValueText() const = 0; ``` ### Note Since this function may be called frequently, do not get the monitoring data here, but get it in the ITMPlugin::DataRequired function. And return the obtained value as the string format for display here. Do not return a null pointer. ``` -------------------------------- ### GetItemId Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide Returns a unique string ID for the display item, ensuring it does not overlap with other plug-in items. The ID should only contain alphanumeric characters. This method must not return a null pointer. ```APIDOC ## GetItemId ### Description The function returns a string that is used as the unique ID of the display item to distinguish each display item. It should be ensured that this ID does not overlap with other plug-in display items. The ID should only contain letters and numbers. ### Function Prototype ```c++ virtual const wchar_t* GetItemId() const = 0; ``` ### Note Do not return a null pointer. ``` -------------------------------- ### Custom Drawing Area Source: https://github.com/zhongyang219/trafficmonitor/wiki/Plugin Development Guide Override this function to customize the drawing display area. This is only effective if CustomDraw returns true. ```c++ virtual void DrawItem(void* hDC, int x, int y, int w, int h, bool dark_mode) ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.