Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

pb shellexecuteex

1 réponse
Avatar
bobofdacosmos
voici un bout de mon code :

#include <windows.h>
#include <stdio.h>

int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
SHELLEXECUTEINFO info = {sizeof(info)};
info.lpVerb = "open";
info.lpFile = "iexplore";
info.lpParameters = "-nohome";
info.fMask = SEE_MASK_NOCLOSEPROCESS | SEE_MASK_FLAG_DDEWAIT;
info.nShow = SW_HIDE;

if (!ShellExecuteEx(&info))
{
MessageBox(0,"Erreur lors de l'execution de IE","info",0);
DWORD err = GetLastError();
char texte[200];
sprintf(texte,"valeur : %d\n",err);
MessageBox(0,texte,"info",0);
return 0;
}
HANDLE Proc = info.hProcess;

...

CloseHandle(Proc);
return 0;
}

le problème est que de manière assez aléatoire, shellexecuteex ne
marche pas. GetLastError renvoie alors 5, cad ERROR_ACCESS_DENIED.

le truc c'est que je vois pas du tout pourquoi !! (aléatoire = en
général ca marche, desfois non... ca n'a pas l'air de dépendre si une
fenetre de IE est déja ouverte ou non (ici je n'ouvre pas un document
avec shellexecuteex, mais un programme!))

quelqu'un a une idée ?!?

1 réponse

Avatar
patrox
un petit nettoyage de la structure peut etre ?

memset( &info , 0 , sizeof(SHELLEXECUTEINFO ) ) ;

et n'oublie pas de mettre un HWND valide si possible.

pat.