Category: Windows

[Tips]How to get capture including mouse cursor

GOAL

To take screenshot with mouse cursor in Windows10 as below.

Environment

Windows10

Method1  Steps Recorder

1. Search the application “Steps Recorder” and start it.

2. Start Record

3. Move cursor to the position to capture and click

4. Stop Record

5. Save the result

Right-click on the result image, and click “Save picture as…”

Method2 Magnifier

1. Search the application “Magnifier” and start it.

2. Set the view “Docked” and resize the window

Resize the Magnifier window by dragging the corner of a window.

You can’t see the cursor in the magnifier window.

3. Press “PrintScreen” key or capture by Snipping Tool

Press “PtintScreen” key and capture the display.

Paste the copied image and trim the target area in the Magnifier window.

How to get PID in Windows10

GOAL

Getting PID, Process ID.

Environment

WIndows10

What is PID?

PID, the process ID, is a number used in some operating system kernels to identify processes uniquely.

Methods

Method 1

Open “Task Manager” and open “Details” tab. See the PID of each Process.

Method 2

Use tasklist command and you can get the list of currently running tasks.

>tasklist

Image Name   PID   Session Name  Session# Mem Usage
============ ===== ============= ========= =========
System Idle  0     Services      0         8 K
System       4     Services      0         2,728 K
Registry     120   Services      0         36,960 K
...

Appendix

How to find the task by using its PID

Use tasklist command as below.

tasklist /svc /fi "PID eq <PID number>"

[Tips] How To Turn Features on/off in Windows10

GOAL

To turn Windows features on and off in Windows10.

Environment

WIndows10

Method

1. Open Control Panel

Press Windows key + R and open “Control Panel”.

Or click Windows System > Control Panel

2. Open “Turn Windows features on or off”

Click “Programs”.

Click “Turn Windows features on or off”.

Select the feature you’d like to turn on or off.

“Apache Service detected with wrong path” in XAMPP

I had some trouble with Apache in XAMPP.

Problem

When I start xampp-control.exe, the message “Apache Service detected with wrong path” is displayed in XAMPP Control Panel.

Environment

Windows10
XAMPP 7.4.10

Cause of the message

Apache Service has already registered and it doesn’t match the Apache of xampp.

Open Windows Administrative Tools > Services.

Open the properties window of Apache2.4 and see the “Path to executable”. It should be changed to the path to the xampp Apache.

*If you’d like to know about “Windows Service” more, check the article “What is Windows Service?“.

Solution

1. Change the register data

Press Windows key + R and Open “regedit”.

Open Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services and open Apache2.4

Right-click ImagePath and Modify the Data.

Change the value data and click OK button.

2. Restart XAMPP Control Panel

Restart XAMPP Control Panel. The error disappeared.

What is Windows Service?

GOAL

To understand the Windows service and how to register an application as a service.

What is Windows service?

Microsoft Windows services, formerly known as NT services, enable you to create long-running executable applications that run in their own Windows sessions. 

from Introduction to Windows Service Applications

These services can be automatically started when the computer boots, can be paused and restarted, and do not show any user interface.

from Introduction to Windows Service Applications

These features make services ideal for use on a server or whenever you need long-running functionality that does not interfere with other users who are working on the same computer.

from Introduction to Windows Service Applications

You can see Windows service applications registered in your PC. Right-click “Start” and click “Computer Management.”

Open Services and you can see the list of Windows service application.

Windows service application contains updater, time setter and security software because these need to be executed automatically. And these applications should be executed without user login and user authority.

Status: Running or not

Srartup Type: Manual, Manual (Trigger Start), Automatic, Automatic (Trigger Start), Automatic (Delayed Start) and so on.

Features of Windows Service

  • It can be started automatically
  • It works in background
  • It works without user interface
  • It can work with any user

What is SCM?

SCM, Service Control Manager is a service for controlling services, which starts, stops, and monitors the status of services. SCM is started by the Winlogon process (winlogon.exe) when Windows starts and starts processes which have “Automatic” startup type.

SCM database

SCM has “SCM database” that is a database of registered services. You can see the SCM database with Register Editor. Press Windows key + R and run “regedit”.

Then you can find the registry “Services” in your computer.

How SCM starts and stops services

How to start

1. SCM starts the service process

2. StartServiceCtrlDispatcher that is the function to connect service to SCM is called in the service process

Then the calling thread, the main thread, is connected to the SCM and the control won’t returned until a services runnning in the process have terminated.

3. The main thread call RegisterServiceCtrlHandlerEx function to handle extended service control requests and create the service thread to execute ServiceMain() function.

4. The service thread starts ServiceMain function when accepting the control request. ServiceMain function is the main function of each service program.

5. The status of the started service is changed to “Running”.

How to end

1. SCM send stop request to the main thread.

2. The main thread stop the service thread and the service thread is removed.

3. The status of the stopped service is changed to “Stopped”.

4. StartServiceCtrlDispatcher is returned.

How to install the service application

Use command below to install with installUtil.

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installUtil.exe <Path to the application>

Use command below to uninstall.

C:\Windows\Microsoft.NET\Framework64\v4.0.30319\installUtil.exe /u <Path to the application>

You can use sc command too to install the service.

sc create SVC1 binPath= <Path to the application> DisplayName= "" description= "" start= auto

Sc command is used to check the status of services, create, delete, and manage them.

What is the difference between installUtil and sc?

Refer to some web sites such as the following.

installing windows service with SC.exe or InstallUtil.exe – there is difference but which?

installing windows service with SC.exe or InstallUtil.exe – there is difference but which?