Impression sous windows

isirnet Messages postés 40 Date d'inscription lundi 28 février 2005 Statut Membre Dernière intervention 24 mai 2006 - 4 sept. 2005 à 21:39
josmaur Messages postés 8 Date d'inscription samedi 7 avril 2007 Statut Membre Dernière intervention 17 avril 2008 - 16 avril 2008 à 23:54
Bonjour
Je veux imprimer des lignes (chaînes de caractères), l'imprimante doit s'arrêtée a chaque fin de ligne (au début de la ligne suivante) sans éjecter la page en coure
Comment faire ce programme

12 réponses

cs_AlexMAN Messages postés 1536 Date d'inscription samedi 21 décembre 2002 Statut Membre Dernière intervention 24 mai 2009 1
4 sept. 2005 à 23:47
Si j'ai bien compris ce que tu veux faire : StartDoc(), StartPage(), GetJob()/SetJob(), EndPage(), EndDoc().
Direction MSDN pour explications.

+2(p - n)
0
isirnet Messages postés 40 Date d'inscription lundi 28 février 2005 Statut Membre Dernière intervention 24 mai 2006
5 sept. 2005 à 17:24
Je t?explique ce que je veux faire :
J'ai un programme qui envoi des chaines de caractère d'un PC a un autre
Ce que je veux faire :
Imprimer une chaine de caractères reçus, faire un retour a la ligne et attendre d'autres chaines a imprimé dans la meme page
0
cs_AlexMAN Messages postés 1536 Date d'inscription samedi 21 décembre 2002 Statut Membre Dernière intervention 24 mai 2009 1
5 sept. 2005 à 18:46
Je pense que tu t'y prends mal : et si tu attendais de tout recevoir pour ensuite tout imprimer d'un trait ?

+2(p - n)
0
isirnet Messages postés 40 Date d'inscription lundi 28 février 2005 Statut Membre Dernière intervention 24 mai 2006
6 sept. 2005 à 21:56
bonjour,
mais mon client demande ça.
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
cs_AlexMAN Messages postés 1536 Date d'inscription samedi 21 décembre 2002 Statut Membre Dernière intervention 24 mai 2009 1
6 sept. 2005 à 22:26
Ok donc avec les fonctions que j'ai donné plus haut, ca suffit : StartDoc() pour commencer, ensuite StartPage(), puis tu imprimes la ligne recue, SetJob() pour mettre sur pause l'impression, tu reprends des que tu recois une ligne, ainsi de suite...Puis EndPage(), puis EndDoc()...etc. Tu trouveras des commentaires sur les fonctions sur msdn.

+2(p - n)
0
isirnet Messages postés 40 Date d'inscription lundi 28 février 2005 Statut Membre Dernière intervention 24 mai 2006
8 sept. 2005 à 22:36
mais je ne veux pas que l'imprimete ejecte la page.
0
cs_AlexMAN Messages postés 1536 Date d'inscription samedi 21 décembre 2002 Statut Membre Dernière intervention 24 mai 2009 1
8 sept. 2005 à 23:18
Qui parle d'ejection de feuille ? La feuille sera ejectée lors de l'appel a EndPage(), je pense que tu fais une application utilisant Winsock (si non, c'est pas grave, a toi de trouver l'equivalent), donc l'appel a recv() sera bloquant (si socket bloquant...) et donc tu mets sur pause l'impression avec SetJob(), des que recv() te renvoie un truc, tu 'resume' l'impression et pis tu ecris la ligne recue, et ainsi de suite...ou est le pb ?

+2(p - n)
0
isirnet Messages postés 40 Date d'inscription lundi 28 février 2005 Statut Membre Dernière intervention 24 mai 2006
9 sept. 2005 à 13:50
bonjour
merci pour tes aides, mais, franchement ça marche pas pour moi, est ce que t a un petit programme de dimenstration ??
0
cs_AlexMAN Messages postés 1536 Date d'inscription samedi 21 décembre 2002 Statut Membre Dernière intervention 24 mai 2009 1
9 sept. 2005 à 14:03
Oula, ca demande pas mal de reflexion (donc des neurones, qui sont pour le moment réservés pour un autre projet) et du temps (lui mm consacré a ce mm projet), donc franchement te pondre un exemple, je pourrai pas, mais si tu as envie, fais un code, je le corrigerai si je peux.

+2(p - n)
0
isirnet Messages postés 40 Date d'inscription lundi 28 février 2005 Statut Membre Dernière intervention 24 mai 2006
9 sept. 2005 à 20:21
ok chef je le ferais ce soir
et merci
mes salutations
0
josmaur Messages postés 8 Date d'inscription samedi 7 avril 2007 Statut Membre Dernière intervention 17 avril 2008
16 avril 2008 à 23:52
un petit exexemple de gestion d'edition
je souhaite qu'il repondra à tes besoins apres adaptation qui  contient deux fontions :
0
josmaur Messages postés 8 Date d'inscription samedi 7 avril 2007 Statut Membre Dernière intervention 17 avril 2008
16 avril 2008 à 23:54
un petit exexemple de gestion d'edition
je souhaite qu'il repondra à vos besoins apres adaptation qui  contient deux fontions :
1 la commande PageGDIEcr dans une commande bouton d'une boite de dialog  .
2 fonction PageGDICalls qui contient l'édition contenant
      le format d'une ou plusieurs police
      le formatage des lignes qui constitue le contenu des lignes à répartir
 dans la page format A4. 




************************************************************
*************      commande   ************
*************   DANS UN BOUTON  ************
************************************************************


{ //  PageGDIEcr ();
 HDC   hdcPrn;
     static DOCINFO di = { sizeof (DOCINFO), "Print2: Impression en cours", NULL } ;
     BOOL           bError = FALSE ;
 
            hdcPrn = GetDefPrinterDC();
            if (hdcPrn == 0)
            { MessageBox(
                  "Création du DC d'imprimante impossible",
                  "Impression", MB_OK);
            }
  
   if (StartDoc (hdcPrn, &di) > 0)
          {
          if (StartPage (hdcPrn) > 0)
               {
               PageGDICalls (hdcPrn) ;


               if (EndPage (hdcPrn) > 0)
                    EndDoc (hdcPrn) ;
               else
                    bError = TRUE ;
               }
          }
     else
          bError = TRUE ;
     DeleteDC (hdc) ;


 }


**************************************************************
***********    lignes  contenant            **************
**************************************************************
***********    le format des elements  **************
***********      des polices pour l'edition **************  
**************************************************************
***********     les lignes formatées pour  ************** 
***********         de l'édition       **************
**************************************************************      


void CDialogDlg::PageGDICalls (HDC hdcPrn)
     {
 HFONT hFontCour;
 HFONT hFontCour2;


 int          cxInch;
 int          cyInch;
 int          cyLine;
 TEXTMETRIC  tm;
 int X,Y;
  LOGFONT m_lf;


 memset(&m_lf,0,sizeof(LOGFONT));
 m_lf.lfHeight=40;//hauteur
 m_lf.lfWidth=40;  //largeur
 m_lf.lfWeight=999;
 m_lf.lfItalic=TRUE;
    strcpy(m_lf.lfFaceName,"Courier");
 m_lf.lfFaceName;
 hFontCour=CreateFontIndirect(&m_lf);


  memset(&m_lf,0,sizeof(LOGFONT));
 m_lf.lfHeight=35;//hauteur
 m_lf.lfWidth=35;  //largeur
 m_lf.lfWeight=300;
 m_lf.lfItalic=FALSE;
    strcpy(m_lf.lfFaceName,"Courier");
 m_lf.lfFaceName;
 hFontCour2=CreateFontIndirect(&m_lf);


**********  genere les polices**************************
********************************************************


    SelectObject(hdcPrn,hFontCour);
 GetTextMetrics(hdcPrn, &tm);
 cxInch = GetDeviceCaps(hdcPrn, LOGPIXELSX);
 cyInch = GetDeviceCaps(hdcPrn, LOGPIXELSY);
  X = tm.tmAveCharWidth * 2;  Y cyLine tm.tmHeight + tm.tmExternalLeading;


 TextOut(hdcPrn, X, Y, pre,strlen(pre));
      Y += cyLine ;
 TextOut(hdcPrn, X, Y, nom,strlen(nom));
   Y += cyLine ;
    TextOut(hdcPrn, X, Y, ref1,strlen(ref1));
   Y += cyLine ;
  TextOut(hdcPrn, X, Y, pre,strlen(pre));
   Y += cyLine ;
 
    SelectObject(hdcPrn,hFontCour2);
 GetTextMetrics(hdcPrn, &tm);  Y +cyLine tm.tmHeight + tm.tmExternalLeading;


  OnDate(date);
  strcpy(chaine1,dat);strcat(chaine1,date);
  TextOut(hdcPrn, X, Y, chaine1,strlen(chaine1));


  Y += cyLine ;
    TextOut(hdcPrn, X, Y, prof,strlen(prof));
 
   Y += cyLine ;
 strcpy(chaine2,rec1);strcat(chaine2,Resultat4);
   TextOut(hdcPrn, X, Y, chaine2,strlen(chaine2));
 
   Y += cyLine ;
 strcpy(temp,Resultat10);
 OnDecal(temp);
 OnPoint(temp);
 strcpy(chaine3,rec2);strcat(chaine3,temp); strcat(chaine3,rec3);
 TextOut(hdcPrn, X, Y, chaine3,strlen(chaine3));


   Y += cyLine ;
  strcpy(chaine4,dep);strcat(chaine4,Resultat5);
   TextOut(hdcPrn, X, Y, chaine4,strlen(chaine4));


      Y += cyLine ;
    
 strcpy(chaine5,arr);strcat(chaine5,Resultat6);
   TextOut(hdcPrn, X, Y, chaine5,strlen(chaine5));


      Y += cyLine ;


 strcpy(chaine6,hede);strcat(chaine6,Resultat7);
   TextOut(hdcPrn, X, Y, chaine6,strlen(chaine6));


      Y += cyLine ;


 strcpy(chaine7,hear);strcat(chaine7,Resultat8);
 TextOut(hdcPrn, X, Y, chaine7,strlen(chaine7));


      Y += cyLine ;


     TextOut(hdcPrn, X, Y, chaine16,strlen(chaine16));
      Y += cyLine ;
      Y += cyLine ;


 strcpy(temp,ResultatA);
 OnDecal(temp);
 OnPoint(temp);
 strcpy(chaine8,val1);
 strcat(chaine8,temp);
    TextOut(hdcPrn, X, Y, chaine8,strlen(chaine8));


      Y += cyLine ;


 strcpy(temp,ResultatB);
 OnDecal(temp);
 OnPoint(temp);
    strcpy(chaine9,val2);
 strcat(chaine9,temp);
 TextOut(hdcPrn, X, Y, chaine9,strlen(chaine9));


      Y += cyLine ;


 strcpy(temp,ResultatC);
 OnDecal(temp);
 OnPoint(temp);
 strcpy(chaine10,val3);
 strcat(chaine10,temp);
    TextOut(hdcPrn, X, Y, chaine10,strlen(chaine10));


      Y += cyLine ;


 strcpy(temp,ResultatD);
 OnDecal(temp);
 OnPoint(temp);
 strcpy(chaine11,val4); 
 strcat(chaine11,temp);
 TextOut(hdcPrn,X, Y, chaine11,strlen(chaine11));


      Y += cyLine ;
   
 strcpy(temp,ResultatE);
 OnDecal(temp);
 OnPoint(temp);
 strcpy(chaine12,val5);
 strcat(chaine12,temp);
 TextOut(hdcPrn, X, Y, chaine12,strlen(chaine12));


      Y += cyLine ;


 strcpy(temp,ResultatF);
 OnDecal(temp);
 OnPoint(temp);
   strcpy(chaine13,val6);
 strcat(chaine13,temp);
    TextOut(hdcPrn, X, Y, chaine13,strlen(chaine13));


      Y += cyLine ;
 strcpy(temp,ResultatG);
 OnDecal(temp);
 OnPoint(temp);
 strcpy(chaine14,val7);
 strcat(chaine14,temp);
    TextOut(hdcPrn, X, Y, chaine14,strlen(chaine14));
      Y += cyLine ;


 strcpy(temp,ResultatH);
 OnDecal(temp);
 OnPoint(temp);
 strcpy(chaine15,val8);strcat(chaine15,temp);strcat(chaine15,val9);
  TextOut(hdcPrn, X, Y, chaine15,strlen(chaine15));
      Y += cyLine ;


      Y += cyLine ;




     TextOut(hdcPrn, X, Y, tar1,strlen(tar1));
       Y += cyLine ;
     TextOut(hdcPrn, X, Y, tar2,strlen(tar2));
       Y += cyLine ;
     TextOut(hdcPrn, X, Y, tar3,strlen(tar3));
       Y += cyLine ;
     TextOut(hdcPrn, X, Y, tar4,strlen(tar4));
       Y += cyLine ;
     TextOut(hdcPrn, X, Y, tar5,strlen(tar5));
       Y += cyLine ;
     TextOut(hdcPrn, X, Y, tar6,strlen(tar6));


 }
0
Rejoignez-nous