HONG KONG — Hewlett-Packard, one of the world’s largest makers of computers and other electronics, is imposing new limits on the employment of students and temporary agency workers at factories across China. The move, following recent efforts by Apple to increase scrutiny of student workers, reflects a significant shift in how electronics companies view problematic labor practices in China.

Many factories in China have long relied on high school students, vocational school students and temporary workers to cope with periodic surges in orders as factory labor becomes increasingly scarce. Students complain of being ordered by school administrators to put in very long hours on short notice at jobs with no relevance to their studies; local governments sometimes order schools to provide labor, and the factories pay school administrators a bonus.

For much of the last decade, many of the world’s big electronics companies have largely neglected the problem, beyond in some cases tracking reports of the abuses. Apple made the unusual move last year of joining the Fair Labor Association, one of the largest workplace monitoring groups, which inspects factories in China that make computers, iPhones and other devices under contract from Apple. And last month, Apple said it would begin requiring suppliers to provide information about their student workers “so we can monitor this issue more carefully.”

Now H.P. is pushing even harder. Its rules, given to suppliers in China on Friday morning, say that all work must be voluntary, and that students and temporary workers must be free “to leave work at any time upon reasonable notice without negative repercussions, and they must have access to reliable and reprisal-free grievance mechanisms,” according to the company.