IdentifiantMot de passe
Loading...
Mot de passe oublié ?Je m'inscris ! (gratuit)
Navigation

Inscrivez-vous gratuitement
pour pouvoir participer, suivre les réponses en temps réel, voter pour les messages, poser vos propres questions et recevoir la newsletter

Langage Delphi Discussion :

Problème depuis mauvaise manipulation


Sujet :

Langage Delphi

  1. #1
    Membre habitué
    Homme Profil pro
    retraité
    Inscrit en
    Mars 2003
    Messages
    382
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Saône et Loire (Bourgogne)

    Informations professionnelles :
    Activité : retraité

    Informations forums :
    Inscription : Mars 2003
    Messages : 382
    Points : 161
    Points
    161
    Par défaut Problème depuis mauvaise manipulation
    Bonjour,

    j'ai fait une erreur, en voulant créer un nouveau projet.

    Dans un projet exsistant, j'ai fait "ajouter au projet" et j'ai sélectionné toutes les unités puis j'ai validé.

    Depuis j'ai cette erreur dans un try

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
     
              index_cour:=indexmax;
              try
                seek(fichier,indexmax);read(fichier,enregcollec);
              except
               ShowMessage('Aucune collection ouverte.');
               exit;
              end;
    erreur E/S 103 sur la ligne "seek(fichier,indexmax);read(fichier,enregcollec)";

    cette erreur se répète sur tous les try !! comment resoudre mon problème ?

    Merci
    75 ans quelques dents en moins, mais toujours envie d'apprendre

  2. #2
    Expert éminent sénior
    Avatar de Cl@udius
    Homme Profil pro
    Développeur Web
    Inscrit en
    Février 2006
    Messages
    4 878
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 61
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Février 2006
    Messages : 4 878
    Points : 10 008
    Points
    10 008
    Par défaut
    Salut

    Il me semble que l'erreur "E/S 103" précise simplement que ton fichier n'est pas ouvert. D'où l'erreur sur le Seek.

    @+ Claudius

  3. #3
    Membre chevronné Avatar de philnext
    Profil pro
    Inscrit en
    Octobre 2002
    Messages
    1 552
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2002
    Messages : 1 552
    Points : 1 780
    Points
    1 780
    Par défaut
    En fait je ne vois pas le rapport entre ton erreur (erreur 103 c'est un accès impossible à un fichier : il n'existe pas ou pas en écriture) et ta manip' de création de projet.
    1/ il faudrait avoir plus d'infos sur ton code.
    2/ je te conseille de faire une sauvegarde quotidienne de tes projets avec un truc style Mozy https://mozy.com/?code=JY66BK (c'est gratos pour 2 Go) comme ça tu peux comparer avant/après en cas de pb.

  4. #4
    Membre habitué
    Homme Profil pro
    retraité
    Inscrit en
    Mars 2003
    Messages
    382
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Saône et Loire (Bourgogne)

    Informations professionnelles :
    Activité : retraité

    Informations forums :
    Inscription : Mars 2003
    Messages : 382
    Points : 161
    Points
    161
    Par défaut
    En fait tout marche sauf les boucles TRY except et c'est ça que je ne comprend pas ?
    75 ans quelques dents en moins, mais toujours envie d'apprendre

  5. #5
    Membre habitué
    Homme Profil pro
    retraité
    Inscrit en
    Mars 2003
    Messages
    382
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Saône et Loire (Bourgogne)

    Informations professionnelles :
    Activité : retraité

    Informations forums :
    Inscription : Mars 2003
    Messages : 382
    Points : 161
    Points
    161
    Par défaut
    Dans une boucle TRY si il se produit une erreur c'est bien la partie except qui est appliquée ?
    et là j'ai une erreur dans le try.
    75 ans quelques dents en moins, mais toujours envie d'apprendre

  6. #6
    Membre habitué
    Homme Profil pro
    retraité
    Inscrit en
    Mars 2003
    Messages
    382
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Saône et Loire (Bourgogne)

    Informations professionnelles :
    Activité : retraité

    Informations forums :
    Inscription : Mars 2003
    Messages : 382
    Points : 161
    Points
    161
    Par défaut
    Ci-dessous en grande partie de l'unité concernée

    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25
    26
    27
    28
    29
    30
    31
    32
    33
    34
    35
    36
    37
    38
    39
    40
    41
    42
    43
    44
    45
    46
    47
    48
    49
    50
    51
    52
    53
    54
    55
    56
    57
    58
    59
    60
    61
    62
    63
    64
    65
    66
    67
    68
    69
    70
    71
    72
    73
    74
    75
    76
    77
    78
    79
    80
    81
    82
    83
    84
    85
    86
    87
    88
    89
    90
    91
    92
    93
    94
    95
    96
    97
    98
    99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    207
    208
    209
    210
    211
    212
    213
    214
    215
    216
    217
    218
    219
    220
    221
    222
    223
    224
    225
    226
    227
    228
    229
    230
    231
    232
    233
    234
    235
    236
    237
    238
    239
    240
    241
    242
    243
    244
    245
    246
    247
    248
    249
    250
    251
    252
    253
    254
    255
    256
    257
    258
    259
    260
    261
    262
    263
    264
    265
    266
    267
    268
    269
    270
    271
    272
    273
    274
    275
    276
    277
    278
    279
    280
    281
    282
    283
    284
    285
    286
    287
    288
    289
    290
    291
    292
    293
    294
    295
    296
    297
    298
    299
    300
    301
    302
    303
    304
    305
    306
    307
    308
    309
    310
    311
    312
    313
    314
    315
    316
    317
    318
    319
    320
    321
    322
    323
    324
    325
    326
    327
    328
    329
    330
    331
    332
    333
    334
    335
    336
    337
    338
    339
    340
    341
    342
    343
    344
    345
    346
    347
    348
    349
    350
    351
    352
    353
    354
    355
    356
    357
    358
    359
    360
    361
    362
    363
    364
    365
    366
    367
    368
    369
    370
    371
    372
    373
    374
    375
    376
    377
    378
    379
    380
    381
    382
    383
    384
    385
    386
    387
    388
    389
    390
    391
    392
    393
    394
    395
    396
    397
    398
    399
    400
    401
    402
    403
    404
    405
    406
    407
    408
    409
    410
    411
    412
    413
    414
    415
    416
    417
    418
    419
    420
    421
    422
    423
    424
    425
    426
    427
    428
    429
    430
    431
    432
    433
    434
    435
    436
    437
    438
    439
    440
    441
    442
    443
    444
    445
    446
    447
    448
    449
    450
    451
    452
    453
    454
    455
    456
    457
    458
    459
    460
    461
    462
    463
    464
    465
    466
    467
    468
    469
    470
    471
    472
    473
    474
    475
    476
    477
    478
    479
    480
    481
    482
    483
    484
    485
    486
    487
    488
    489
    490
    491
    492
    493
    494
    495
    496
    497
    498
    499
    500
    501
    502
    503
    504
    505
    506
    507
    508
    509
    510
    511
    512
    513
    514
    515
    516
    517
    518
    519
    520
    521
    522
    523
    524
    525
    526
    527
    528
    529
    530
    531
    532
    533
    534
    535
    536
    537
    538
    539
    540
    541
    542
    543
    544
    545
    546
    547
    548
    549
    550
    551
    552
    553
    554
    555
    556
    557
    558
    559
    560
    561
    562
    563
    564
    565
    566
    567
    568
    569
    570
    571
    572
    573
    574
    575
    576
    577
    578
    579
    580
    581
    582
    583
    584
    585
    586
    587
    588
    589
    590
    591
    592
    593
    594
    595
    596
    597
    598
    599
    600
    601
    602
    603
    604
    605
    606
    607
    608
    609
    610
    611
    612
    613
    614
    615
    616
    617
    618
    619
    620
    621
    622
    623
    624
    625
    626
    627
    628
    629
    630
    631
    632
    633
    634
    635
    636
    637
    638
    639
    640
    641
    642
    643
    644
    645
    646
    647
    648
    649
    650
    651
    652
    653
    654
    655
    656
    657
    658
    659
    660
    661
    662
    663
    664
    665
    666
    667
    668
    669
    670
    671
    672
    673
    674
    675
    676
    677
    678
    679
    680
    681
    682
    683
    684
    685
    686
    687
    688
    689
    690
    691
    692
    693
    694
    695
    696
    697
    698
    699
    700
    701
    702
    703
    704
    705
    706
    707
    708
    709
    710
    711
    712
    713
    714
    715
    716
    717
    718
    719
    720
    721
    722
    723
    724
    725
    726
    727
    728
    729
    730
    731
    732
    733
    734
    735
    736
    737
    738
    739
    740
    741
    742
    743
    744
    745
    746
    747
    748
    749
    750
    751
    752
    753
    754
    755
    756
    757
    758
    759
    760
    761
    762
    763
    764
    765
    766
    767
    768
    769
    770
    771
    772
    773
    774
    775
    776
    777
    778
    779
    780
    781
    782
    783
    784
    785
    786
    787
    788
    789
    790
    791
    792
    793
    794
    795
    796
    797
    798
    799
    800
    801
    802
    803
    804
    805
    806
    807
    808
    809
    810
    811
    812
    813
    814
    815
    816
     
    unit timbres;
     
    interface
     
    uses
      Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
      Dialogs, Menus, ExtCtrls, StdCtrls, ExtDlgs,hh,hh_funcs,D6OnHelpFix;
     
    type
      Taffiche = class(TForm)
        MainMenu1: TMainMenu;
        Fichier1: TMenuItem;
        Collections1: TMenuItem;
        Crationdeslistes1: TMenuItem;
        Optionsdetri1: TMenuItem;
        Fentres1: TMenuItem;
        Prfrences1: TMenuItem;
        Aide1: TMenuItem;
        APropos1: TMenuItem;
        Visiterlesite1: TMenuItem;
        Panel1: TPanel;
        Panel3: TPanel;
        Label1: TLabel;
        Label2: TLabel;
        Label3: TLabel;
        Label4: TLabel;
        Label5: TLabel;
        Label6: TLabel;
        Label7: TLabel;
        Label8: TLabel;
        Label9: TLabel;
        Label10: TLabel;
        Label11: TLabel;
        Label12: TLabel;
        Label13: TLabel;
        Label14: TLabel;
        Label15: TLabel;
        Label16: TLabel;
        Label17: TLabel;
        Label18: TLabel;
        Label19: TLabel;
        Label20: TLabel;
        Label21: TLabel;
        Label22: TLabel;
        Label23: TLabel;
        Label24: TLabel;
        Label25: TLabel;
        Panel4: TPanel;
        Label26: TLabel;
        Label27: TLabel;
        Label28: TLabel;
        Label29: TLabel;
        Image1: TImage;
        Label30: TLabel;
        Panel5: TPanel;
        Label31: TLabel;
        Label32: TLabel;
        Label33: TLabel;
        Label34: TLabel;
        Label43: TLabel;
        Label44: TLabel;
        Label45: TLabel;
        Label46: TLabel;
        Label47: TLabel;
        Label48: TLabel;
        Panel6: TPanel;
        Label35: TLabel;
        Label36: TLabel;
        Label37: TLabel;
        Label38: TLabel;
        Label39: TLabel;
        Label40: TLabel;
        Label41: TLabel;
        Label42: TLabel;
        Label49: TLabel;
        Label50: TLabel;
        Panel7: TPanel;
        Label51: TLabel;
        Label52: TLabel;
        Label53: TLabel;
        Label54: TLabel;
        Label55: TLabel;
        Label56: TLabel;
        Label57: TLabel;
        Label58: TLabel;
        Label59: TLabel;
        Label60: TLabel;
        Label61: TLabel;
        Label62: TLabel;
        Label63: TLabel;
        Label64: TLabel;
        Label65: TLabel;
        Label66: TLabel;
        Label67: TLabel;
        Label68: TLabel;
        Label69: TLabel;
        Label70: TLabel;
        Label71: TLabel;
        Label72: TLabel;
        Label73: TLabel;
        Label74: TLabel;
        Label75: TLabel;
        Label76: TLabel;
        Label77: TLabel;
        Label78: TLabel;
        Panel8: TPanel;
        Button1: TButton;
        Button2: TButton;
        Button3: TButton;
        Button4: TButton;
        Label79: TLabel;
        Edit1: TEdit;
        Label80: TLabel;
        Label81: TLabel;
        recup_collec: TMenuItem;
        Open: TOpenDialog;
        Ourvirunecollection1: TMenuItem;
        Crerunecollectio1: TMenuItem;
        Supprimerunecollection1: TMenuItem;
        PAfiche: TPanel;
        Label123: TLabel;
        Label125: TLabel;
        Label126: TLabel;
        Label127: TLabel;
        Label128: TLabel;
        Label129: TLabel;
        Label130: TLabel;
        Label131: TLabel;
        Label132: TLabel;
        Label133: TLabel;
        Label134: TLabel;
        Label135: TLabel;
        Label136: TLabel;
        Label137: TLabel;
        Label138: TLabel;
        Label139: TLabel;
        Label140: TLabel;
        Label141: TLabel;
        Label142: TLabel;
        Label143: TLabel;
        Label144: TLabel;
        Label145: TLabel;
        Label146: TLabel;
        Label147: TLabel;
        Label148: TLabel;
        Label124: TLabel;
        Edit2: TEdit;
        Edit3: TEdit;
        Edit4: TEdit;
        Edit5: TEdit;
        Edit6: TEdit;
        Edit7: TEdit;
        Edit8: TEdit;
        Edit9: TEdit;
        Edit11: TEdit;
        Edit12: TEdit;
        Edit13: TEdit;
        Edit14: TEdit;
        Edit15: TEdit;
        Edit16: TEdit;
        Edit17: TEdit;
        Edit18: TEdit;
        Edit19: TEdit;
        Edit20: TEdit;
        Edit21: TEdit;
        Edit22: TEdit;
        Edit23: TEdit;
        Edit24: TEdit;
        Edit25: TEdit;
        Edit26: TEdit;
        Panel12: TPanel;
        Button10: TButton;
        Supprimerunecollection2: TMenuItem;
        voir_timbre: TButton;
        Label84: TLabel;
        Box1: TCheckBox;
        cherche: TFindDialog;
        Panel11: TPanel;
        Button8: TButton;
        Panel13: TPanel;
        Button7: TButton;
        Button9: TButton;
        Panel14: TPanel;
        Panel2: TPanel;
        Button5: TButton;
        Panel9: TPanel;
        Button11: TButton;
        Panel10: TPanel;
        Button6: TButton;
        Chercher1: TMenuItem;
        MAJrapide1: TMenuItem;
        Visualisationrapide1: TMenuItem;
        Label83: TLabel;
        Exportation1: TMenuItem;
        Ajouterdesimagesaufichier1: TMenuItem;
        CrerunfichierExcel1: TMenuItem;
        Open_image: TOpenDialog;
        Danslacollectionouverte1: TMenuItem;
        Danslabasededonnes1: TMenuItem;
        procedure FormActivate(Sender: TObject);
        procedure Ourvirunecollection1Click(Sender: TObject);
        procedure Prfrences1Click(Sender: TObject);
        procedure recup_collecClick(Sender: TObject);
        procedure Outils1Click(Sender: TObject);
        procedure Button5Click(Sender: TObject);
        procedure Supprimerunecollection2Click(Sender: TObject);
        procedure Crerunecollectio1Click(Sender: TObject);
        procedure voir_timbreClick(Sender: TObject);
        procedure Button1Click(Sender: TObject);
        procedure Button3Click(Sender: TObject);
        procedure Button2Click(Sender: TObject);
        procedure Button4Click(Sender: TObject);
        procedure Label124Click(Sender: TObject);
        procedure Button8Click(Sender: TObject);
        procedure Button10Click(Sender: TObject);
        procedure Supprimerunecollection1Click(Sender: TObject);
        procedure Button11Click(Sender: TObject);
        procedure Button7Click(Sender: TObject);
        procedure Button9Click(Sender: TObject);
        procedure Button6Click(Sender: TObject);
        procedure Crationdeslistes1Click(Sender: TObject);
        procedure Optionsdetri1Click(Sender: TObject);
        procedure Chercher1Click(Sender: TObject);
        procedure MAJrapide1Click(Sender: TObject);
        procedure Visualisationrapide1Click(Sender: TObject);
        procedure APropos1Click(Sender: TObject);
        procedure Exportation1Click(Sender: TObject);
        procedure Visiterlesite1Click(Sender: TObject);
        procedure CrerunfichierExcel1Click(Sender: TObject);
        procedure FormCreate(Sender: TObject);
        procedure Aide1Click(Sender: TObject);
        procedure Ajouterdesimagesaufichier1Click(Sender: TObject);
        procedure Danslacollectionouverte1Click(Sender: TObject);
        procedure Danslabasededonnes1Click(Sender: TObject);
     
     
       private
        { Déclarations privées }
        function HelpHook(Command: Word; Data: LongInt; var CallHelp: Boolean): Boolean;
      public
        { Déclarations publiques }
     
      end;
     
    var
      affiche: Taffiche;
      test_enreg,nouv_fich,maj_fich, cpt_nouv: integer;
      code_photo:string;
      mHelpFile: string; //Variable servant à stocker le chemin du fichier CHM
    implementation
     
    {$R *.dfm}
      uses generale, FRMpreferences, FRMtexte, FRMcreatfiche, FRMcreatcollec,
      FRMliste, FRMtri, FRMchercher, FRMmajrapide, FRMvisu, FRMapropos,
      FRMexport, FRMimport, FRMsite, FRMexportexcel, FRMimage;
    //=====================================================================  
    function Taffiche.HelpHook(Command: Word; Data: Integer; var CallHelp: Boolean): Boolean;
    begin
      CallHelp := False; //Désactivation des appels à l'aide 16-bit
      //Test sur le paramètre Command qui permet de savoir le type d'aide à ouvrir
      if (Command in [Help_Context]) then
        HtmlHelp(0, PChar(mHelpFile), HH_HELP_CONTEXT, Data) //Ouverture de l'aide
      else
        CallHelp := true; //En cas d'erreur, réactivation des appels à l'aide 16-bit
      result := true;
    end;
    //==============================================================
      function StrReplace(Substr,replace,s:string):string;
    {============================================================================}
    {remplace toutes les sous-chaines Substr par replace                         }
    { ex : StrReplace ('toto', 'tata', 'le toto est ..') renvoie 'le tata est ..'}
    {============================================================================}
    var ChaineSource,ChaineCible:string;
        i,TailleChaineRemplacement:integer;
    begin
      ChaineSource:=s;
      ChaineCible:='';
      TailleChaineRemplacement:=length(Substr);
      while pos(Substr,ChaineSource)>0 do  //tant que l'on trouve une sous-chaine
      begin
        i:=pos(Substr,ChaineSource)-1; // position de la sous-chaine à remplacer
        ChaineCible:=ChaineCible+copy(ChaineSource,1,i)+replace;
        delete(ChaineSource,1,i+TailleChaineRemplacement);//on retire de chaineTemp
      end;
      Result:=ChaineCible+ChaineSource;
     
    end;
    //=================================================================
     
     procedure efface();
    begin
    affiche.edit2.Text:='';
    affiche.edit3.Text:='';
    affiche.edit4.Text:='';
    affiche.edit5.Text:='';
    affiche.edit6.Text:='';
    affiche.edit7.Text:='';
     
    affiche.edit8.Text:='';
    affiche.edit9.Text:='';
    affiche.edit11.Text:='';
     
    affiche.edit12.Text:=enregprefer.catalogue;
    affiche.edit13.Text:='';
    affiche.edit14.Text:='';
    affiche.edit15.Text:=CurrToStr(0);
    affiche.edit16.Text:=IntToStr(0);
    affiche.edit17.Text:='99/99/9999';
    affiche.edit18.Text:=CurrToStr(0);
    affiche.edit19.Text:=IntToStr(0);
    affiche.edit20.Text:=IntToStr(0);
    affiche.edit21.Text:='99/99/9999';
    affiche.edit22.Text:=IntToStr(0);
    affiche.edit23.Text:=IntToStr(0);
    affiche.edit24.Text:=IntToStr(0);
    affiche.edit25.Text:='99/99/9999';
    affiche.edit26.Text:=IntToStr(0);
    test_enreg:=1;
    end;
    //===============================================================
    procedure efface_active();
    begin
      affiche.label1.Caption:='RECAPITULATIF DE LA COLLECTION';
      affiche.label19.Caption:='';
      affiche.label21.Caption:='';
      affiche.label27.Caption:='';
      affiche.label28.Caption:='';
      affiche.label30.Caption:='';
      affiche.label69.Caption:='';
      affiche.label63.Caption:='';
      affiche.label65.Caption:='';
      affiche.label67.Caption:='';
      affiche.label70.Caption:='';
      affiche.label72.Caption:='';
      affiche.label73.Caption:='';
      affiche.label75.Caption:='';
      affiche.label43.Caption:='';
      affiche.label44.Caption:='';
      affiche.label45.Caption:='';
      affiche.label46.Caption:='';
      affiche.label39.Caption:='';
      affiche.label40.Caption:='';
      affiche.label41.Caption:='';
      affiche.label42.Caption:='';
      affiche.label55.Caption:='';
      affiche.label56.Caption:='';
      affiche.label57.caption:='';
      affiche.label58.Caption:='';
      affiche.label78.Caption:='';
      affiche.Image1.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName)+ 'photo-timbre/0000.bmp');
     
    end; //fin de procedure
    //===================================================================
    procedure der_fich();
    begin
     efface;
              index_cour:=indexmax;
              try
                seek(fichier,indexmax);read(fichier,enregcollec);
              except
               ShowMessage('Aucune collection ouverte.');
               exit;
              end;
      code_photo:=enregcollec.photo;
     
      //affiche.label82.Caption:=IntToStr(index_cour);
      //affiche.label82.Caption:=IntToStr(enregcollec.index);
      affiche.label27.Caption:=enregcollec.num;
      affiche.label28.Caption:=enregcollec.catal;
      affiche.label30.Caption:=enregcollec.desi;
      affiche.label69.Caption:=enregcollec.grav;
      affiche.label63.Caption:=enregcollec.dessin;
      affiche.label65.Caption:=enregcollec.qtemis;
      affiche.label67.Caption:=enregcollec.annee;
      affiche.label70.Caption:=enregcollec.typ;
      affiche.label72.Caption:=enregcollec.couleur;
      affiche.label73.Caption:=enregcollec.dent;
      affiche.label75.Caption:=enregcollec.valfac;
      affiche.label43.Caption:=CurrToStr(enregcollec.cotneuf);
      affiche.label44.Caption:=IntToStr(enregcollec.qtneufpos);
      affiche.label45.caption:=enregcollec.dateneuf;
      affiche.label46.Caption:=CurrToStr(enregcollec.achatneuf);
      affiche.label39.Caption:=CurrToStr(enregcollec.cotneufchar);
      affiche.label40.Caption:=IntToStr(enregcollec.qtcharpos);
      affiche.label41.caption:=enregcollec.datechar;
      affiche.label42.Caption:=CurrToStr(enregcollec.achatneufchar);
      affiche.label55.Caption:=CurrToStr(enregcollec.cotoblit);
      affiche.label56.Caption:=IntToStr(enregcollec.qtoblitpos);
      affiche.label57.caption:=enregcollec.dateoblit;
      affiche.label58.Caption:=CurrToStr(enregcollec.achatoblit);
      affiche.label78.Caption:=enregcollec.info;
      affiche.label81.Caption:='non';
      if enregcollec.exclu=1 then affiche.label81.Caption:='oui';
        try
           affiche.Image1.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName)+ 'photo-timbre/' + enregcollec.photo);
       except
           affiche.Image1.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName)+ 'photo-timbre/0000.bmp');
        end; //fin try
     // affiche.button8.Visible:=false;
    end;
    //===================================================================
    procedure fich_prec();
    begin
    efface;
             index_cour:=index_cour-1;
             if index_cour<1 then
              begin
              try
                seek(fichier,1);read(fichier,enregcollec);
              except
               ShowMessage('Aucune collection ouverte.');
               exit;
              end;
                index_cour:=1;
                ShowMessage('Vous avez atteint la fin de la liste.');
              end;
          if index_cour>0 then seek(fichier,index_cour);read(fichier,enregcollec);
       code_photo:=enregcollec.photo;
      //affiche.label82.Caption:=IntToStr(index_cour);
      affiche.label27.Caption:=enregcollec.num;
      affiche.label28.Caption:=enregcollec.catal;
      affiche.label30.Caption:=enregcollec.desi;
      affiche.label69.Caption:=enregcollec.grav;
      affiche.label63.Caption:=enregcollec.dessin;
      affiche.label65.Caption:=enregcollec.qtemis;
      affiche.label67.Caption:=enregcollec.annee;
      affiche.label70.Caption:=enregcollec.typ;
      affiche.label72.Caption:=enregcollec.couleur;
      affiche.label73.Caption:=enregcollec.dent;
      affiche.label75.Caption:=enregcollec.valfac;
      affiche.label43.Caption:=CurrToStr(enregcollec.cotneuf);
      affiche.label44.Caption:=IntToStr(enregcollec.qtneufpos);
      affiche.label45.caption:=enregcollec.dateneuf;
      affiche.label46.Caption:=CurrToStr(enregcollec.achatneuf);
      affiche.label39.Caption:=CurrToStr(enregcollec.cotneufchar);
      affiche.label40.Caption:=IntToStr(enregcollec.qtcharpos);
      affiche.label41.caption:=enregcollec.datechar;
      affiche.label42.Caption:=CurrToStr(enregcollec.achatneufchar);
      affiche.label55.Caption:=CurrToStr(enregcollec.cotoblit);
      affiche.label56.Caption:=IntToStr(enregcollec.qtoblitpos);
      affiche.label57.caption:=enregcollec.dateoblit;
      affiche.label58.Caption:=CurrToStr(enregcollec.achatoblit);
      affiche.label78.Caption:=enregcollec.info;
      affiche.label81.Caption:='non';
      if enregcollec.exclu=1 then affiche.label81.Caption:='oui';
        try
           affiche.Image1.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName)+ 'photo-timbre/' + enregcollec.photo);
       except
           affiche.Image1.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName)+ 'photo-timbre/0000.bmp');
        end; //fin try
     //affiche.button8.Visible:=false;
    end;
    //===================================================================
    procedure fich_suiv ();
    begin
    efface;
             index_cour:=index_cour+1;
             if index_cour>indexmax then
              begin
              try
                seek(fichier,1);read(fichier,enregcollec);
              except
               ShowMessage('Aucune collection ouverte.');
               exit;
              end;
                index_cour:=indexmax;
                ShowMessage('Vous avez atteint la fin de la liste.');
              end;
          if index_cour<=indexmax then seek(fichier,index_cour);read(fichier,enregcollec);
       code_photo:=enregcollec.photo;
      //affiche.label82.Caption:=IntToStr(index_cour);
      affiche.label27.Caption:=enregcollec.num;
      affiche.label28.Caption:=enregcollec.catal;
      affiche.label30.Caption:=enregcollec.desi;
      affiche.label69.Caption:=enregcollec.grav;
      affiche.label63.Caption:=enregcollec.dessin;
      affiche.label65.Caption:=enregcollec.qtemis;
      affiche.label67.Caption:=enregcollec.annee;
      affiche.label70.Caption:=enregcollec.typ;
      affiche.label72.Caption:=enregcollec.couleur;
      affiche.label73.Caption:=enregcollec.dent;
      affiche.label75.Caption:=enregcollec.valfac;
      affiche.label43.Caption:=CurrToStr(enregcollec.cotneuf);
      affiche.label44.Caption:=IntToStr(enregcollec.qtneufpos);
      affiche.label45.caption:=enregcollec.dateneuf;
      affiche.label46.Caption:=CurrToStr(enregcollec.achatneuf);
      affiche.label39.Caption:=CurrToStr(enregcollec.cotneufchar);
      affiche.label40.Caption:=IntToStr(enregcollec.qtcharpos);
      affiche.label41.caption:=enregcollec.datechar;
      affiche.label42.Caption:=CurrToStr(enregcollec.achatneufchar);
      affiche.label55.Caption:=CurrToStr(enregcollec.cotoblit);
      affiche.label56.Caption:=IntToStr(enregcollec.qtoblitpos);
      affiche.label57.caption:=enregcollec.dateoblit;
      affiche.label58.Caption:=CurrToStr(enregcollec.achatoblit);
      affiche.label78.Caption:=enregcollec.info;
      affiche.label81.Caption:='non';
      if enregcollec.exclu=1 then affiche.label81.Caption:='oui';
        try
           affiche.Image1.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName)+ 'photo-timbre/' + enregcollec.photo);
       except
           affiche.Image1.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName)+ 'photo-timbre/0000.bmp');
        end; //fin try
    //affiche.button8.Visible:=false;
    end;
     
    //===================================================================
    procedure pre_fich();
     
    begin
    efface;
             index_cour:=1;
              try
                seek(fichier,1);read(fichier,enregcollec);
              except
               ShowMessage('Aucune collection ouverte.');
               exit;
              end;
      code_photo:=enregcollec.photo;
      //affiche.label82.Caption:=IntToStr(index_cour);
      affiche.label27.Caption:=enregcollec.num;
      affiche.label28.Caption:=enregcollec.catal;
      affiche.label30.Caption:=enregcollec.desi;
      affiche.label69.Caption:=enregcollec.grav;
      affiche.label63.Caption:=enregcollec.dessin;
      affiche.label65.Caption:=enregcollec.qtemis;
      affiche.label67.Caption:=enregcollec.annee;
      affiche.label70.Caption:=enregcollec.typ;
      affiche.label72.Caption:=enregcollec.couleur;
      affiche.label73.Caption:=enregcollec.dent;
      affiche.label75.Caption:=enregcollec.valfac;
      affiche.label43.Caption:=CurrToStr(enregcollec.cotneuf);
      affiche.label44.Caption:=IntToStr(enregcollec.qtneufpos);
      affiche.label45.caption:=enregcollec.dateneuf;
      affiche.label46.Caption:=CurrToStr(enregcollec.achatneuf);
      affiche.label39.Caption:=CurrToStr(enregcollec.cotneufchar);
      affiche.label40.Caption:=IntToStr(enregcollec.qtcharpos);
      affiche.label41.caption:=enregcollec.datechar;
      affiche.label42.Caption:=CurrToStr(enregcollec.achatneufchar);
      affiche.label55.Caption:=CurrToStr(enregcollec.cotoblit);
      affiche.label56.Caption:=IntToStr(enregcollec.qtoblitpos);
      affiche.label57.caption:=enregcollec.dateoblit;
      affiche.label58.Caption:=CurrToStr(enregcollec.achatoblit);
      affiche.label78.Caption:=enregcollec.info;
      affiche.label81.Caption:='non';
      if enregcollec.exclu=1 then affiche.label81.Caption:='oui';
        try
           affiche.Image1.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName)+ 'photo-timbre/' + enregcollec.photo);
       except
           affiche.Image1.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName)+ 'photo-timbre/0000.bmp');
        end; //fin try
     //affiche.button8.Visible:=false;
    end;
     
    //=====================================================================
    procedure prefer();
    begin
     
    //PAfiche.Visible:=false;
      donnee:= ExtractFilePath(Application.ExeName)+'pref.del';
       try
            AssignFile(fichprefer,donnee);
                    Reset(fichprefer);
                    Read(fichprefer,enregprefer);
           except
              on EInOutError do
              MessageDlg('Erreur d''E-S fichier.',mtError,[mbOk],0);
           end;
    affiche.label19.Caption:=IntToStr(enregprefer.ancote);
    affiche.label22.Caption:=enregprefer.sycote;
    affiche.label23.Caption:=enregprefer.sycote;
    affiche.label24.Caption:=enregprefer.sycote;
    affiche.label25.Caption:=enregprefer.sycote;
    affiche.label47.Caption:=enregprefer.sycote;
    affiche.label49.Caption:=enregprefer.sycote;
    affiche.label59.Caption:=enregprefer.sycote;
    affiche.label48.Caption:=enregprefer.syachat;
    affiche.label50.Caption:=enregprefer.syachat;
    affiche.label60.Caption:=enregprefer.syachat;
    test_enreg:=0;nouv_fich:=0;maj_fich:=0;
    end; //fin de procedure
    //=================================================================
    procedure Taffiche.FormActivate(Sender: TObject);
    begin
    affiche.Left:=2;affiche.top:=2;
    affiche.Height:=766; affiche.Width:=1017;
    //affiche.button8.Visible:=false;
    end;
    //===================================================================
    procedure Taffiche.Ourvirunecollection1Click(Sender: TObject);
    var
    nom_col,nom: string;
    index,i: integer;
     
    begin
        index:=0;efface;prefer;
        if Open.Execute then begin
        AssignFile(fichier,Open.FileName);
        chemin_fich:=Open.FileName;
        try
             Reset(fichier);
            seek(fichier,0);read(fichier,enregcollec);
            Label10.caption:= IntToStr(enregcollec.totqtneufpos);
            Label11.caption:= IntToStr(enregcollec.totqtcharpos);
            Label12.caption:= IntToStr(enregcollec.totqtoblitpos);
            Label13.caption:= IntToStr(enregcollec.totqtneufpos + enregcollec.totqtcharpos + enregcollec.totqtoblitpos);
            Label15.caption:= CurrToStr(enregcollec.totcotneuf);
            Label14.caption:= CurrToStr(enregcollec.totcotneufchar);
            Label16.caption:= CurrToStr(enregcollec.totcotoblit);
            Label17.caption:= CurrToStr(enregcollec.totcotneufchar + enregcollec.totcotneuf + enregcollec.totcotoblit);
             index:=enregcollec.index;
             seek(fichier,1); read(fichier,enregcollec);
             code_photo:=enregcollec.photo;
            for i:=pos('.del',Open.FileName) downto 1 do
              begin
                if ord(Open.FileName[i])<>92  then nom_col:=nom_col+char(ord(Open.FileName[i]));
                if ord(Open.FileName[i])=92  then Break;
              end;
                 nom:=nom_col;nom_col:='';
            for i:=length(nom) downto 1 do
              begin
                nom_col:=nom_col+char(ord(nom[i]));
                label83.Caption:=nom_col
              end;
             label1.Caption:='RECAPITULATIF DE LA COLLECTION :';
             label21.Caption:=IntToStr(index);
         except
           on EInOutError do
           MessageDlg('Erreur d''E-S fichier.',mtError,[mbOk],0);
          end;
        end;
      indexmax:=index;
      index_cour:=1;
      //label82.Caption:=IntToStr(index_cour);
      label27.Caption:=enregcollec.num;
      label28.Caption:=enregcollec.catal;
      label30.Caption:=enregcollec.desi;
      label69.Caption:=enregcollec.grav;
      label63.Caption:=enregcollec.dessin;
      label65.Caption:=enregcollec.qtemis;
      label67.Caption:=enregcollec.annee;
      label70.Caption:=enregcollec.typ;
      label72.Caption:=enregcollec.couleur;
      label73.Caption:=enregcollec.dent;
      label75.Caption:=enregcollec.valfac;
      label43.Caption:=CurrToStr(enregcollec.cotneuf);
      label44.Caption:=IntToStr(enregcollec.qtneufpos);
      label45.Caption:=enregcollec.dateneuf;
      label46.Caption:=CurrToStr(enregcollec.achatneuf);
      label39.Caption:=CurrToStr(enregcollec.cotneufchar);
      label40.Caption:=IntToStr(enregcollec.qtcharpos);
      label41.Caption:=enregcollec.datechar;
      label42.Caption:=CurrToStr(enregcollec.achatneufchar);
      label55.Caption:=CurrToStr(enregcollec.cotoblit);
      label56.Caption:=IntToStr(enregcollec.qtoblitpos);
      label57.Caption:=enregcollec.dateoblit;
      label58.Caption:=CurrToStr(enregcollec.achatoblit);
      label78.Caption:=enregcollec.info;
      label81.Caption:='non';
      if enregcollec.exclu=1 then label81.Caption:='oui';
     
        try
           Image1.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName)+ 'photo-timbre/' + enregcollec.photo);
       except
           Image1.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName)+ 'photo-timbre/0000.bmp');
        end; //fin try
    end;
    //===================================================================
    procedure Taffiche.Prfrences1Click(Sender: TObject);
    begin
    preferences.show;
    end;
    //====================================================================
    procedure Taffiche.recup_collecClick(Sender: TObject);
    begin
    import.show;
    end;
    //===================================================================
    procedure Taffiche.Outils1Click(Sender: TObject);
    begin
    creatfiche.show;
    end;
    //===============================================================
    procedure Taffiche.Button5Click(Sender: TObject);
    begin
    PAfiche.Visible:=true;
    num_modif:=index_cour;
    if enregcollec.exclu=1 then box1.Checked:=true;
    edit2.Text:=enregcollec.num;
    edit3.Text:=enregcollec.desi;
    edit4.Text:=enregcollec.grav;
    edit5.Text:=enregcollec.dessin;
    edit6.Text:=enregcollec.qtemis;
    edit7.Text:=enregcollec.annee;
     
    edit8.Text:=enregcollec.typ;
    edit9.Text:=enregcollec.couleur;
    edit11.Text:=enregcollec.info;
     
    edit12.Text:=enregcollec.catal;
    edit13.Text:=enregcollec.dent;
    edit14.Text:=enregcollec.valfac;
    edit15.Text:=CurrToStr(enregcollec.cotneuf);
    edit16.Text:=IntToStr(enregcollec.qtneufpos);
    edit17.Text:=enregcollec.dateneuf;
    edit18.Text:=CurrToStr(enregcollec.achatneuf);
    edit19.Text:=CurrToStr(enregcollec.cotneufchar);
    edit20.Text:=IntToStr(enregcollec.qtcharpos);
    edit21.Text:=enregcollec.datechar;
    edit22.Text:=CurrToStr(enregcollec.achatneufchar);
    edit23.Text:=CurrToStr(enregcollec.cotoblit);
    edit24.Text:=IntToStr(enregcollec.qtoblitpos);
    edit25.Text:=enregcollec.dateoblit;
    edit26.Text:=CurrToStr(enregcollec.achatoblit);
    maj_fich:=1;//label85.Caption:=IntToStr(index_cour);
    end;
     
    //===============================================================
     
    procedure Taffiche.Supprimerunecollection2Click(Sender: TObject);
    begin
     
     
     
           if MessageDlg('Supprimer la collection '+'?',
           mtConfirmation,[mbYes,mbNo],0)=mrYes
           then
               begin
                 CloseFile(fichier);
                 Erase(fichier);
            Label10.caption:='';
            Label11.caption:='';
            Label12.caption:='';
            Label13.caption:='';
            Label15.caption:='';
            Label14.caption:='';
            Label16.caption:='';
            Label17.caption:='';
            efface;efface_active;
               end;
     
     
    end;
     
    //======================================================================
    procedure Taffiche.Crerunecollectio1Click(Sender: TObject);
    begin
    creatcollec.show;
            label1.Caption:='RECAPITULATIF DE LA COLLECTION';
            Label10.caption:= '';
            Label11.caption:= '';
            Label12.caption:= '';
            Label13.caption:= '';
            Label15.caption:= '';
            Label14.caption:= '';
            Label16.caption:= '';
            Label17.caption:= '';
            label19.Caption:='';
            label21.Caption:='';
            label27.Caption:='';
            label28.Caption:='';
      label30.Caption:='';
      label69.Caption:='';
      label63.Caption:='';
      label65.Caption:='';
      label67.Caption:='';
      label70.Caption:='';
      label72.Caption:='';
      label73.Caption:='';
      label75.Caption:='';
      label43.Caption:='';
      label44.Caption:='';
      label43.Caption:='';
      label45.Caption:='';
      label39.Caption:='';
      label40.Caption:='';
      label41.Caption:='';
      label42.Caption:='';
      label55.Caption:='';
      label56.Caption:='';
      label57.Caption:='';
      label58.Caption:='';
      label78.Caption:='';
     
           Image1.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName)+ 'photo-timbre/0000.bmp');
     
     
     
    end;
     
     
    procedure Taffiche.Button1Click(Sender: TObject);
     
    begin
    pre_fich;
     
    end;
    //========================================================================
    procedure Taffiche.Button3Click(Sender: TObject);
     
    begin
    der_fich;
    end;
    //===================================================================
    procedure Taffiche.Button2Click(Sender: TObject);
     
    begin
    fich_suiv;
    end;
    //===================================================================
    procedure Taffiche.Button4Click(Sender: TObject);
    begin
    fich_prec;
     
    end;
    //==================================================================
    75 ans quelques dents en moins, mais toujours envie d'apprendre

  7. #7
    Modérateur
    Avatar de tourlourou
    Homme Profil pro
    Biologiste ; Progr(amateur)
    Inscrit en
    Mars 2005
    Messages
    3 858
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 61
    Localisation : France, Yvelines (Île de France)

    Informations professionnelles :
    Activité : Biologiste ; Progr(amateur)

    Informations forums :
    Inscription : Mars 2005
    Messages : 3 858
    Points : 11 301
    Points
    11 301
    Billets dans le blog
    6
    Par défaut
    je n'ai pas vu où tu déclares la variable fichier : es-tu sûr que depuis que tu as ajouté d'autres unités, elle ne désigne pas un homonyme dans une de ces unités ?

    dans ce cas, tu dois la préfixer par son nom d'unité : unit1.fichier pour éliminer toute ambiguïté
    Delphi 5 Pro - Delphi 11.3 Alexandria Community Edition - CodeTyphon 6.90 sous Windows 10 ; CT 6.40 sous Ubuntu 18.04 (VM)
    . Ignorer la FAQ Delphi et les Cours et Tutoriels Delphi nuit gravement à notre code !

  8. #8
    Membre habitué
    Homme Profil pro
    retraité
    Inscrit en
    Mars 2003
    Messages
    382
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Saône et Loire (Bourgogne)

    Informations professionnelles :
    Activité : retraité

    Informations forums :
    Inscription : Mars 2003
    Messages : 382
    Points : 161
    Points
    161
    Par défaut
    La variable fichier est déclarée dans l'unite "generale"
    75 ans quelques dents en moins, mais toujours envie d'apprendre

  9. #9
    Membre habitué
    Homme Profil pro
    retraité
    Inscrit en
    Mars 2003
    Messages
    382
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Saône et Loire (Bourgogne)

    Informations professionnelles :
    Activité : retraité

    Informations forums :
    Inscription : Mars 2003
    Messages : 382
    Points : 161
    Points
    161
    Par défaut
    J'ai créé un petit prog de test pour la fonction TRY (qui ne marche pas non plus)

    si quelqu'un pouvait avoir la gentillesse de l'essayer chez lui et me dire si en supprimant l'image 0001 la fonction EXCEPT marche ça me retirerai une sacrée épine du pied !!!

    Merci
    Fichiers attachés Fichiers attachés
    75 ans quelques dents en moins, mais toujours envie d'apprendre

  10. #10
    Expert éminent sénior
    Avatar de Jipété
    Profil pro
    Inscrit en
    Juillet 2006
    Messages
    10 730
    Détails du profil
    Informations personnelles :
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations forums :
    Inscription : Juillet 2006
    Messages : 10 730
    Points : 15 132
    Points
    15 132
    Par défaut
    Yep !

    Indépendamment du fait qu'il n'y a pas de code dans Unit1 (donc impossible de voir qui fait quoi), si je supprime 0001.bmp, ça m'affiche "Pas de photo disponible".
    Ça te convient ? (w2k, D7)
    --
    jp
    Il a à vivre sa vie comme ça et il est mûr sur ce mur se creusant la tête : peutêtre qu'il peut être sûr, etc.
    Oui, je milite pour l'orthographe et le respect du trait d'union à l'impératif.
    Après avoir posté, relisez-vous ! Et en cas d'erreur ou d'oubli, il existe un bouton « Modifier », à utiliser sans modération
    On a des lois pour protéger les remboursements aux faiseurs d’argent. On n’en a pas pour empêcher un être humain de mourir de misère.
    Mes 2 cts,
    --
    jp

  11. #11
    Membre habitué
    Homme Profil pro
    retraité
    Inscrit en
    Mars 2003
    Messages
    382
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Saône et Loire (Bourgogne)

    Informations professionnelles :
    Activité : retraité

    Informations forums :
    Inscription : Mars 2003
    Messages : 382
    Points : 161
    Points
    161
    Par défaut
    Excusez moi j'avais oublié de sauvegarder je vous joint le nouveau fichier.
    Fichiers attachés Fichiers attachés
    75 ans quelques dents en moins, mais toujours envie d'apprendre

  12. #12
    Expert éminent sénior
    Avatar de Cl@udius
    Homme Profil pro
    Développeur Web
    Inscrit en
    Février 2006
    Messages
    4 878
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 61
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Février 2006
    Messages : 4 878
    Points : 10 008
    Points
    10 008
    Par défaut
    Salut

    Cela fonctionne parfaitement !
    [D7, WinXP]

    @+ Claudius

  13. #13
    Membre habitué
    Homme Profil pro
    retraité
    Inscrit en
    Mars 2003
    Messages
    382
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Saône et Loire (Bourgogne)

    Informations professionnelles :
    Activité : retraité

    Informations forums :
    Inscription : Mars 2003
    Messages : 382
    Points : 161
    Points
    161
    Par défaut
    ET chez moi ça ne marche pas !!

    Pourtant j'ai désinstallé D7 réinstallé et toujours rien ??

    XP serait en cause ?

    Un grand merci à tous ceux qui se penchent sur mon problème
    75 ans quelques dents en moins, mais toujours envie d'apprendre

  14. #14
    Expert éminent sénior
    Avatar de Jipété
    Profil pro
    Inscrit en
    Juillet 2006
    Messages
    10 730
    Détails du profil
    Informations personnelles :
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations forums :
    Inscription : Juillet 2006
    Messages : 10 730
    Points : 15 132
    Points
    15 132
    Par défaut
    Citation Envoyé par michel71 Voir le message
    ET chez moi ça ne marche pas !!
    Ça veut dire quoi, ça ?
    • Ça n'affiche pas "Pas de photo disponible" ?
    • Ça affiche 0001.bmp ?
    • Ça affiche rien ?
    • ...

    Tu es en train de nous dire que juste ce petit bout de
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    8
    9
    procedure TForm1.FormActivate(Sender: TObject);
    begin
       try
          Image1.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName)+ '0001.bmp');
       except
          Image1.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName)+ '0000.bmp');
        end; //fin try
     
    end;
    ne fonctionne pas ?
    --
    jp
    Il a à vivre sa vie comme ça et il est mûr sur ce mur se creusant la tête : peutêtre qu'il peut être sûr, etc.
    Oui, je milite pour l'orthographe et le respect du trait d'union à l'impératif.
    Après avoir posté, relisez-vous ! Et en cas d'erreur ou d'oubli, il existe un bouton « Modifier », à utiliser sans modération
    On a des lois pour protéger les remboursements aux faiseurs d’argent. On n’en a pas pour empêcher un être humain de mourir de misère.
    Mes 2 cts,
    --
    jp

  15. #15
    Membre habitué
    Homme Profil pro
    retraité
    Inscrit en
    Mars 2003
    Messages
    382
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Saône et Loire (Bourgogne)

    Informations professionnelles :
    Activité : retraité

    Informations forums :
    Inscription : Mars 2003
    Messages : 382
    Points : 161
    Points
    161
    Par défaut
    A l'ouverture si les deux images sont dispo tu dois avoir une image de timbre qui s'affiche. (fonction TRY)

    Si tu supprimes l'image 0001.bmp et que tu lances ce bout de code du dois avoir l'image "pas de photo disponible" qui s'affiche (fonction EXCEPT).

    Chez moi le code plante sur " Image1.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName)+ '0001.bmp');" avec le message "le fichier spécifié est introuvable, processus stoppé, utilisez le pas à pas"
    75 ans quelques dents en moins, mais toujours envie d'apprendre

  16. #16
    Expert éminent sénior
    Avatar de Jipété
    Profil pro
    Inscrit en
    Juillet 2006
    Messages
    10 730
    Détails du profil
    Informations personnelles :
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations forums :
    Inscription : Juillet 2006
    Messages : 10 730
    Points : 15 132
    Points
    15 132
    Par défaut
    Citation Envoyé par michel71 Voir le message
    "le fichier spécifié est introuvable, processus stoppé, utilisez le pas à pas"
    Arf !
    Tu exécutes depuis l'IDE ? Mais chez moi aussi dans ce cas-là !
    Par contre, en lançant l'exe hors de l'IDE, j'ai bien "Pas de photo disponible" (dommage, il est joli ce Cérès, )
    --
    jp
    Il a à vivre sa vie comme ça et il est mûr sur ce mur se creusant la tête : peutêtre qu'il peut être sûr, etc.
    Oui, je milite pour l'orthographe et le respect du trait d'union à l'impératif.
    Après avoir posté, relisez-vous ! Et en cas d'erreur ou d'oubli, il existe un bouton « Modifier », à utiliser sans modération
    On a des lois pour protéger les remboursements aux faiseurs d’argent. On n’en a pas pour empêcher un être humain de mourir de misère.
    Mes 2 cts,
    --
    jp

  17. #17
    Expert éminent sénior
    Avatar de Cl@udius
    Homme Profil pro
    Développeur Web
    Inscrit en
    Février 2006
    Messages
    4 878
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Âge : 61
    Localisation : France, Haute Garonne (Midi Pyrénées)

    Informations professionnelles :
    Activité : Développeur Web
    Secteur : High Tech - Matériel informatique

    Informations forums :
    Inscription : Février 2006
    Messages : 4 878
    Points : 10 008
    Points
    10 008
    Par défaut
    Salut

    Citation Envoyé par michel71 Voir le message
    le fichier spécifié est introuvable, processus stoppé, utilisez le pas à pas
    Si tu lances ton exe depuis l'IDE, l'apparition de l'exception est normale. Lance le programme directement en dehors de l'environement Delphi.

    [edit]grillé. Philathéliste, hein ![/edit]

    @+ Claudius

  18. #18
    Membre habitué
    Homme Profil pro
    retraité
    Inscrit en
    Mars 2003
    Messages
    382
    Détails du profil
    Informations personnelles :
    Sexe : Homme
    Localisation : France, Saône et Loire (Bourgogne)

    Informations professionnelles :
    Activité : retraité

    Informations forums :
    Inscription : Mars 2003
    Messages : 382
    Points : 161
    Points
    161
    Par défaut
    Si je comprend bien j'ai fait tout ce cirque pour rien. Désolé, je ne suis qu'un "bidouilleur" mais si quelqu'un pouvait m'expliquer pourquoi à partir de l'IDE ça plante? Pour tester il faut absolument passer par l'EXE. ?

    Encore merci
    75 ans quelques dents en moins, mais toujours envie d'apprendre

  19. #19
    Expert éminent sénior
    Avatar de Jipété
    Profil pro
    Inscrit en
    Juillet 2006
    Messages
    10 730
    Détails du profil
    Informations personnelles :
    Localisation : France, Hérault (Languedoc Roussillon)

    Informations forums :
    Inscription : Juillet 2006
    Messages : 10 730
    Points : 15 132
    Points
    15 132
    Par défaut
    Citation Envoyé par michel71 Voir le message
    Si je comprend bien j'ai fait tout ce cirque pour rien.
    Vi !

    Citation Envoyé par michel71 Voir le message
    Pour tester il faut absolument passer par l'EXE. ?
    Ben vi ! ! !


    Citation Envoyé par michel71 Voir le message
    Désolé, je ne suis qu'un "bidouilleur" mais si quelqu'un pouvait m'expliquer pourquoi à partir de l'IDE ça plante?
    Bah, c'est bien pour ça que les forums (ou forii ?) existent,
    Pour l'explication technique, je passe la main...

    @Claudius : à peine, à peine, et encore, c'était y a looooongtemps...

    Tchô,
    --
    jp
    Il a à vivre sa vie comme ça et il est mûr sur ce mur se creusant la tête : peutêtre qu'il peut être sûr, etc.
    Oui, je milite pour l'orthographe et le respect du trait d'union à l'impératif.
    Après avoir posté, relisez-vous ! Et en cas d'erreur ou d'oubli, il existe un bouton « Modifier », à utiliser sans modération
    On a des lois pour protéger les remboursements aux faiseurs d’argent. On n’en a pas pour empêcher un être humain de mourir de misère.
    Mes 2 cts,
    --
    jp

  20. #20
    Membre chevronné Avatar de philnext
    Profil pro
    Inscrit en
    Octobre 2002
    Messages
    1 552
    Détails du profil
    Informations personnelles :
    Localisation : France

    Informations forums :
    Inscription : Octobre 2002
    Messages : 1 552
    Points : 1 780
    Points
    1 780
    Par défaut
    J'ai pas suivi en détail mais je pense que c'est un pb d'interprétation : en effet l'IDE gère les 'exceptions' qui arrivent dans les programmes qu'il est en train d'exécuter. Et ce, que tu ais prévu de gérer cette exception ou pas.

    Ceci dit pour ce genre de problèmes, où tu sais à l'avance que tu vas rencontrer des anomalies (fichier inexistant...), je pense qu'il est plus efficace de traiter le problème en amont exemple (pour ton cas) :
    Code : Sélectionner tout - Visualiser dans une fenêtre à part
    1
    2
    3
    4
    5
    6
    7
    if FileExist(ExtractFilePath(Application.ExeName)+ '0001.bmp') then
      Image1.Picture.Bitmap.LoadFromFile(ExtractFilePath(Application.ExeName)+ '0001.bmp') else 
        Begin
          //gestion de l'affichage de la vignette par defaut si ell existe
        end;
      
    Par contre tu peux mettre tout ça dans un bloc try pour gérer les problèmes moins courants style : le format du Bmp non reconnu...

    Dans l'IDE, dans Outils/Options du debogueur/ tu as des onglets qui te permettent de choisir les exceptions gérées par l'IDE.

+ Répondre à la discussion
Cette discussion est résolue.
Page 1 sur 2 12 DernièreDernière

Discussions similaires

  1. Petit problème avec la manipulation d'image
    Par Sargon dans le forum C#
    Réponses: 4
    Dernier message: 30/08/2007, 11h44
  2. Réponses: 3
    Dernier message: 01/08/2007, 14h15
  3. Réponses: 5
    Dernier message: 12/05/2007, 00h37
  4. Problème depuis passage de IE6 à IE7
    Par hfranck dans le forum Balisage (X)HTML et validation W3C
    Réponses: 2
    Dernier message: 08/01/2007, 11h23
  5. [Eclipse] Mauvaise manipulation
    Par patrick_lassaly dans le forum Eclipse Java
    Réponses: 2
    Dernier message: 23/12/2005, 14h41

Partager

Partager
  • Envoyer la discussion sur Viadeo
  • Envoyer la discussion sur Twitter
  • Envoyer la discussion sur Google
  • Envoyer la discussion sur Facebook
  • Envoyer la discussion sur Digg
  • Envoyer la discussion sur Delicious
  • Envoyer la discussion sur MySpace
  • Envoyer la discussion sur Yahoo