Pb d'impression

cs_cecel Messages postés 17 Date d'inscription mercredi 26 février 2003 Statut Membre Dernière intervention 27 avril 2006 - 25 nov. 2004 à 17:46
BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019 - 26 nov. 2004 à 09:14
Salut

Je devellope une appli qui permet d'imprimer des etiquettes sur une imprimante ZEBRA.

J'utilise un driver "Generic text" car j'imprime un fichier texte qui contient des instruction dans le langage de l'imprimante.

mon souci c'est que je ne sais pas si l'impression a abouti.
j'utilise le code suivant :
char prog[]="write /p c:\\temp\\test.zpl";
STARTUPINFO si;
PROCESS_INFORMATION pi;
ZeroMemory( &si, sizeof(si) );
si.cb = sizeof(si);
ZeroMemory( &pi, sizeof(pi) );

// Start the child process.
CreateProcess( NULL, // No module name (use command line).
(LPSTR)prog, // Command line.
NULL, // Process handle not inheritable.
NULL, // Thread handle not inheritable.
FALSE, // Set handle inheritance to FALSE.
0, // No creation flags.
NULL, // Use parent's environment block.
NULL, // Use parent's starting directory.
&si, // Pointer to STARTUPINFO structure.
&pi ) ;// Pointer to PROCESS_INFORMATION structure.

///cout << "CreateProcess rate."<<endl;
//

// Wait until child process exits.
WaitForSingleObject( pi.hProcess, INFINITE );

// Close process and thread handles.
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );

si quelqu'un a une solution pour savoir si l'impression c'est bien passé.

Merci d'avance.

3 réponses

BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019
25 nov. 2004 à 18:27
GetExitCodeProcess() avant le CloseHandle(pi.hProcess) en esperant que ton process retourne un code significatif.

ciao...
BruNews, MVP VC++
0
cs_cecel Messages postés 17 Date d'inscription mercredi 26 février 2003 Statut Membre Dernière intervention 27 avril 2006
26 nov. 2004 à 09:02
Salut

J'ai essayé la fonction GetExitCodeProcess() mais elle renvoit rien de significatif le status est toujours le même.

n'aurai tu pas un code qui permet d'imprimer un fichier texte en controlant le resultat.

Merci

@+
0
BruNews Messages postés 21040 Date d'inscription jeudi 23 janvier 2003 Statut Modérateur Dernière intervention 21 août 2019
26 nov. 2004 à 09:14
Regarde dans Petzold, il y a tout ce qu'il faut:
http://brunews.free.fr/brunews/download/CP5.zip
http://brunews.free.fr/brunews/download/CP5Sources.zip

ciao...
BruNews, MVP VC++
0
Rejoignez-nous