I have a DLL (gbasmsb_library.dll) made available by Popular Pharmacy responsible for returning some functions to interact with this environment. Home I think it's a DLL written in C, I need to consume this DLL in VB6 or C # .
In the programmer's Programmer's Guide I have the following information for using the DLL :
1:
Syntax:
const char* IdentificaEstacao();
Return Value: A string containing the machine's DNA.
2:
Syntax:
const char* PegaSolicitacao(
const char* CNPJ,
const char* CPF,
const char* CRM,
const char* UF_CRM,
const char* DT_EMISSAO );
A string that will be used to validate the request by generating the signature of the machine.
In VB6 I was able to consume the first function (1), the second one returns error:
49 Bad DLL calling convention
VB6 Code:
Private Declare Function PegaSolicitacao Lib "c:\temp\gbasmsb_library.dll" (ByRef CNPJ As String, ByRef CPF As String, ByRef CRM As String, ByRef UF_CRM As String, ByRef DT_EMISSAO As String) As String
Private Declare Function IdentificaEstacao Lib "c:\temp\gbasmsb_library.dll" () As String
Private Sub Form_Load()
MsgBox (IdentificaEstacao) //1 - retorno OK
Dim CNPJ As String, CPF As String, CRM As String, UF_CRM As String, DT_EMISSAO As String
Dim resp As String
CNPJ = "98352942000133"
CPF = "72794534491"
CRM = "7347"
UF_CRM = "AM"
DT_EMISSAO = "01/01/1991"
resp = PegaSolicitacao(CNPJ, CPF, CRM, UF_CRM, DT_EMISSAO) //2 - ERRO
end sub
I have already changed the function's signature to byVal, I changed the parameters to array too, without success.
C # code No success in calling any FUNCTION.
[DllImport(@"c:\temp\gbasmsb_library.dll")]
private static extern string PegaSolicitacao(string cnpj, string cpf, string crm, string ufCrm, string dtEmissao);
[DllImport(@"c:\temp\gbasmsb_library.dll")]
private static extern string IdentificaEstacao();
private void button1_Click(object sender, EventArgs e)
{
var cnpj = "98352942000133";
var cpf = "72794534491";
var crm = "7347";
var ufCrm = "PI";
var dtEmissao = "01/01/1991";
//MessageBox.Show(PegaSolicitacao(ref cnpj, ref cnpj, ref cnpj, ref cnpj, ref cnpj));
//ERRO
MessageBox.Show(PegaSolicitacao(cnpj, cpf, crm, ufCrm, dtEmissao));
//ERRO
IdentificaEstacao();
}