OK, I’ve found how to deal with it. At least, it’s one of possible solutions:
int nFiles = (int) SendNppMsg(NPPM_GETNBOPENFILES, 0, 0); if ( !SendNppMsg(NPPM_DOOPEN, (WPARAM) 0, (LPARAM) params.c_str()) ) { nCmdResult = CMDRESULT_FAILED; DWORD dwAttr = ::GetFileAttributes(params.c_str()); if ( (dwAttr != INVALID_FILE_ATTRIBUTES) && ((dwAttr & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) ) { // NPPM_DOOPEN unexpectedly returns 0 when a folder is specified // as its argument, though in fact it does open all the files // from that folder. int nFilesNow = (int) SendNppMsg(NPPM_GETNBOPENFILES, 0, 0); if ( nFilesNow != nFiles ) { nCmdResult = CMDRESULT_SUCCEEDED; } } }