Le forum (ô combien francophone) des utilisateurs de Powerbuilder.
ll_Result = ShellExecute(0, "open", ls_Exe, "toto.xls", '', 1)
j'ai un code retour ll_Result = 42 qui n'est pas une erreur, mais le doc ne peux s'ouvrir.
quelqu'un a-t-il rencontré ce problème avec cet API ?
Hors ligne
Salut
c'est pas un probleme de declaration ?
Tu peux essayer avec :
Public Function long ShellExecuteA (ulong hwnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, long nShowCmd) library "shell32.dll" alias for "ShellExecuteA;Ansi"
ls_mail = 'hotline@JCZ.com' SetNull (ls_Null) ll_return = ShellExecuteA (0, ls_Null, "mailto:" + ls_mail , ls_Null, ls_Null, 1)
Hors ligne
Desolé , j'ai tjrs le code retour = 42 avec message (impossible d'acceder au ficher toto.xls)
Hors ligne
le fichier toto.Xls n'est pas corrompu ?
sinon, essayes avec le 3, ou le 5 à la fin.
Hors ligne
JCZ a écrit:
Salut
c'est pas un probleme de declaration ?
Tu peux essayer avec :Code: pb
Public Function long ShellExecuteA (ulong hwnd, string lpOperation, string lpFile, string lpParameters, string lpDirectory, long nShowCmd) library "shell32.dll" alias for "ShellExecuteA;Ansi"
Code: pb
ls_mail = 'hotline@JCZ.com' SetNull (ls_Null) ll_return = ShellExecuteA (0, ls_Null, "mailto:" + ls_mail , ls_Null, ls_Null, 1)
Bonjour,
Pour ma part j'utilsie les fonctions suivantes :
////////////////////////////////////////////////////////////////////////////// //LANCEMENT D'UNE COMMANDE SHELL SUR UN FICHIER DONNE //Renvoi : une valeur < 32 si erreur // si ab_Wait=true alors on renvoie le handle de la fenêtre ouverte // sinon on renvoie le handle du process de l'application ////////////////////////////////////////////////////////////////////////////// CONSTANT long SW_NORMAL = 1 CONSTANT long SEE_MASK_NOCLOSEPROCESS = 64 CONSTANT long INFINITE = 4294967295 //&HFFFFFFFF string ls_Class long ll_ret long ll_Handle struc_shellexecuteinfo lstruc_shellexecuteinfo lstruc_shellexecuteinfo.cbsize = 60 lstruc_shellexecuteinfo.fMask = SEE_MASK_NOCLOSEPROCESS // Ne ferme pas le process lstruc_shellexecuteinfo.lpVerb = as_commande lstruc_shellexecuteinfo.lpParameters = as_Parametres lstruc_shellexecuteinfo.lpfile = as_fichier lstruc_shellexecuteinfo.lpClass = ls_class lstruc_shellexecuteinfo.nShow = SW_NORMAL ll_ret = ShellExecuteEx(lstruc_shellexecuteinfo) IF ll_ret = 0 THEN //Erreur lors du lancement RETURN lstruc_shellexecuteinfo.hInstapp END IF //Vérifie si on souhaite attendre l'ouverture de l'application pour continuer if ab_Wait then //Attend que l'application lancée reprenne la main et soit prete a être utilisée WaitForInputIdle(lstruc_shellexecuteinfo.hprocess, INFINITE) //Récupération du handle de la fenêtre se trouvant au premier plan (celle-ci doit être la fenêtre de l'application) ll_Handle = GetForegroundWindow() //Récupère le parent de la fenêtre récupérée pour que l'on soit sûr d'avoir la fenêtre Main de l'application ll_Handle=of_GetParent(ll_Handle) return ll_Handle end if //Retourne le handle du process return lstruc_shellexecuteinfo.hProcess avec el Local External Functions FUNCTION long ShellExecuteA( ulong hWnd, string Operation, string lpFile, string lpParameters, string lpDirectory, int nShowCmd ) LIBRARY "shell32.dll" FUNCTION long ShellExecuteEx(REF struc_shellexecuteinfo lpExecInfo) LIBRARY "shell32.dll" ALIAS FOR ShellExecuteExA Function ulong WaitForInputIdle (ulong hProcess, ulong dwMilliseconds) Library "USER32.DLL"
Et celà fonctionne bien.
Hors ligne