Bonjour j’aimerais savoir si quelqu’un aurait connaissance d’un problème avec le type variant sous borland c++ 6.0
Mon code fonctionne très bien sous l’ide mais dès que je lance l’exe en dehors de l’ide la mémoire est corrompue, et les variable locale sont écrasées , pourtant lorsque je trace pas à pas rien n'indique un dépassement de mémoire ????

Soit je fais une bétise soit c’est un bug sous borland ?

Merci de votre aide

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
// Variant   vMsExcel = Variant::CreateObject("Excel.Application");
// un peu plus haut dans le code
 
void __fastcall TExcelAppl::BuildExcell(AnsiString fName,Variant *vMsExcel,int maxCol)
{
 
    AnsiString Filter;
 
    Variant  cCell,
        cRange,
        cValue,
        vXLWorkbooks,
        vXLWorkbook,
        vSheetName,
        vWorkSheet;
 
    vXLWorkbooks =  vMsExcel->OlePropertyGet("Workbooks");
    vMsExcel->OlePropertySet("SheetsInNewWorkbook",(Variant)1);
    vXLWorkbook=vXLWorkbooks.OleFunction("Add");
 
    vXLWorkbook  = vMsExcel->OlePropertyGet("ActiveWorkbook");
    vWorkSheet	 = vXLWorkbook.OlePropertyGet("ActiveSheet");
 
    PropertyGet    Range("Range");
    PropertySet    SetFormula("Formula");
    Procedure      SaveAs("SaveAs");
    for(myRow=0;myRow<excellGrid->RowCount;myRow++)
    {
        myExcCol = 'A' ;
        for(myCol=0;myCol<maxCol;myCol++)
        {
            Filter=myExcCol;
            Filter += (myRow+1);
            Range.ClearArgs();
            SetFormula.ClearArgs();
            cRange =  vWorkSheet.Exec(Range << Filter);	[b]ici ça écrase mes variable locales quand je ne suis pas dans l'ide….[/b]
            Filter = excellGrid->Cells[myCol][myRow];
            cRange.Exec(SetFormula << Filter);
            myExcCol+=1;
        }
    }
 
    vXLWorkbook = vMsExcel->OlePropertyGet("ActiveWorkbook");
    vXLWorkbook.Exec(SaveAs<<fName);
    vXLWorkbook.OleFunction("Close", false);
 
    cCell=
    cRange=
    cValue=
    vXLWorkbooks=
    vXLWorkbook=
    vSheetName=
    vWorkSheet=false;
}