Salut tout le monde!


Je cherche à intégrer une DLL C++ dans mon application en D7, afin d'utiliser une fonction de conversion dont j'ai vraiment besoin!!!

Mon PB c'est que je ne sais vraiment pas comment faire...

et je n'arrive pas à translater le code fourni comme exemple en Delphi...

voici une description fournie avec la DLL:


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
If you want to add a possibility to convert DBF files in your application
you could use our library for this purpose.
 
There are only two functions:
 
int		DBFtoDBF_Converter(HWND hwnd, int argc, char *argv[]);
 
	It accepts three parameters.
	The first  "hwnd" must be NULL. It is not used.
	The second "argc" must be equal to number of parameters.
	The third  "argv" contains parameters.
 
int		DBFtoDBF_ConverterStr(HWND hwnd, char *params);
 
	It accepts two parameters.
	The first  "hwnd" must be NULL. It is not used.
	The second "params" contains parameters which are delimited with sign #, 
	for example: source.dbf#target.dbf#/dBase3#/overwrite=1
 
The functions return:
	0 - success
	1 - not recognized a source file
	2 - not recognized a target file or folder
	3 - cannot open one or more source dbf files
 
Drive:\Path\FileName1.dbf   Source DBF file 
Drive:\Path\FileName1.dbf   Target DBF file 
Drive:\Path\                Target DBF folder
 
/OVERWRITE=1                Overwrite existing file.  (default)
/OVERWRITE=0                Do not overwrite existing file. (Append to existing file). 
 
/SKIPDEL=1                  Skip records marked as deleted. 
/SKIPDEL=0                  Do not skip records marked as deleted. 
 
/RECALL=1                   Remove a deleteion mark from the output file.
/RECALL=0                   Keep a deletion mark in the output file. (default)
 
/DBASE3                     Convert to dBase III format. 
/DBASE4                     Convert to dBase IV format. 
/FOXPRO                     Convert to FoxPro format. 
/VFP                        Convert to Visual FoxPro format. 
/LEVEL7                     Convert to dBase Level 7 format. 
 
/BLOCKSIZE=?????            Set blocksize for memo fields.
Example:
/BLOCKSIZE=128 
 
/RECORDS=0                  Do not export records of the table.
 
    Output codepage
/ASIS                       Codepage as is.  (default)
/ANSI                       Convert to ANSI codepage. 
/OEM                        Convert to OEM codepage. 
 
    Source codepage
/SOURCE=ANSI
/SOURCE=OEM
 
/FILTER=condition           It allows you to convert records which satisfy the condition. 
 
/CHANGETYPE:FIELD=TYPE(LENGTH,WIDTH)	
							Set field type in the output file
 Example:							
  /CHANGETYPE:FIELDNAME1=N(10,2)
  /CHANGETYPE:FIELDNAME2=C(128)
  /CHANGETYPE:FIELDNAME3=D(8)
  /CHANGETYPE:FIELDNAME4=M
 
 
////////////////////// sample1.cpp ////////////////////////////
//parameters in the command line
//
//sample1.exe source.dbf target.dbf ...
//
 
#include <windows.h>
 
int __declspec(dllexport)   __stdcall   DBFtoDBF_Converter(HWND hwnd, int argc, char *argv[]);
 
 
int
main(int argc, char *argv[])
{
    return DBFtoDBF_Converter(NULL, argc, argv);
}
 
//
////////////////////// sample1.cpp ////////////////////////////
 
 
 
////////////////////// sample2.cpp ////////////////////////////
//parameters in the source code
//
//sample2.exe
//
 
#include <windows.h>
 
int __declspec(dllexport)   __stdcall   DBFtoDBF_Converter(HWND hwnd, int argc, char *argv[]);
 
int
main()
{
    int     n=0;
    char    *params[10];
 
    params[n++]=strdup(__argv[0]);
    params[n++]=strdup("source.dbf");
    params[n++]=strdup("target.dbf");
    params[n++]=strdup("/ansi");
    params[n++]=strdup("/overwrite=1");
 
    return DBFtoDBF_Converter(NULL, n, params);
}
 
//
////////////////////// sample2.cpp ////////////////////////////
 
//////////////////////// net.cpp //////////////////////////////
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
 
namespace WindowsApplication1
{
    public partial class Form1 : Form
    {
        [DllImport("dbf2dbf_d.dll", CharSet = CharSet.Ansi)]
        
        static extern void DBFtoDBF_Converter(string hwnd, int argc, string[] argv);
 
        public Form1()
        {
            InitializeComponent();
        }
 
        private void Form1_Load(object sender, EventArgs e)
        {
        }
 
        private void button1_Click(object sender, EventArgs e)
        {
 
                int    n=6;
                string[] parms = new string[] 
                { 
                "dbf2dbf", 
                "/OVERWRITE=1", 
                "/SKIPDEL=1", 
                "/ASIS", 
                "C:\\in.dbf", 
                "C:\\out.dbf"
                };
 
                DBFtoDBF_Converter(null, n, parms);
        }
    }
}
/////////////////////// net.cpp ////////////////////////////////

Merci d'avance