- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Hi,
I'm a DVF 6.0 user. I got my version from the Network at my workplace. In order to keep the size of their network down, they left out all of the examples of how to use the program. I'm a new user (pretty much learning as I go). I understand how to pass strings from VB to VF but can't seem to figure out how to get a string from VF to VB. I was hoping that either an example would help me out or one of you guys could help me. I'm using code that came before me so the code is not the issue. Just coding the passing strings is all I need to know.
Thanks,
Matt
I'm a DVF 6.0 user. I got my version from the Network at my workplace. In order to keep the size of their network down, they left out all of the examples of how to use the program. I'm a new user (pretty much learning as I go). I understand how to pass strings from VB to VF but can't seem to figure out how to get a string from VF to VB. I was hoping that either an example would help me out or one of you guys could help me. I'm using code that came before me so the code is not the issue. Just coding the passing strings is all I need to know.
Thanks,
Matt
Lien copié
5 Réponses
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Is VB the calling program? If so pass the string from VB to VF, set the value in VF and when you return to VB, the string will be set to the new value. I don't think you can change the length of a string in VF, so you need to set the length in VB first and then VF can change it.
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
VB is calling a Fortran Sub on a DLL, Fortran is calculating and giving the values back to VB. I'm ok with passing a string from VB to VF (ByVal strDataIn as String w/ Reference call in Fortran DLL). But for some reason, the string I want from Fortran is not passing to VB. I'm using:
Declare Sub Pandora Lib "Pandora2.dll" (IDataIn As Long, DataIn As Single, ByVal CDataIn As String, DataOut As Single, ByVal CFilename As String, IErr As Long)
....
Call Pandora(flngDataIn(1), fsngDataInput(1), fstrDataIn, fsngDataOut(1), fstrFileName, lngErr)
Here's in the DLL:
!DEC$ ATTRIBUTES STDCALL,DLLEXPORT :: PANDORA
!DEC$ ATTRIBUTES ALIAS : "Pandora" :: PANDORA
!DEC$ ATTRIBUTES REFERENCE :: CDATAIN
SUBROUTINE PANDORA(IDATAIN,DATAIN,CDATAIN,DATAOUT,CFILENAME,IERR)
CFilename is the string I want from Fortran. Why is it not going to VB like I think it should?
Declare Sub Pandora Lib "Pandora2.dll" (IDataIn As Long, DataIn As Single, ByVal CDataIn As String, DataOut As Single, ByVal CFilename As String, IErr As Long)
....
Call Pandora(flngDataIn(1), fsngDataInput(1), fstrDataIn, fsngDataOut(1), fstrFileName, lngErr)
Here's in the DLL:
!DEC$ ATTRIBUTES STDCALL,DLLEXPORT :: PANDORA
!DEC$ ATTRIBUTES ALIAS : "Pandora" :: PANDORA
!DEC$ ATTRIBUTES REFERENCE :: CDATAIN
SUBROUTINE PANDORA(IDATAIN,DATAIN,CDATAIN,DATAOUT,CFILENAME,IERR)
CFilename is the string I want from Fortran. Why is it not going to VB like I think it should?
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
You need to add CFILENAME to your reference statement:
!DEC$ ATTRIBUTES REFERENCE :: CDATAIN,CFILENAME
!DEC$ ATTRIBUTES REFERENCE :: CDATAIN,CFILENAME
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
Forgot to mention that I'm getting a runtime Error 49...which is a Bad Dll calling convention. Maybe that's what's wrong. Haven't figured out how to correct that either. uuhhh...little help? and ty sd
- Marquer comme nouveau
- Marquer
- S'abonner
- Sourdine
- S'abonner au fil RSS
- Surligner
- Imprimer
- Signaler un contenu inapproprié
I believe that fixing the reference will also fix the bad calling convention. I have gotten the bad calling convention before and I don't recall exactly what caused the problem, but the problem has to do with the parameters, either the number of parameters, parameter types or the string parameters missing in the reference statement.

Répondre
Options du sujet
- S'abonner au fil RSS
- Marquer le sujet comme nouveau
- Marquer le sujet comme lu
- Placer ce Sujet en tête de liste pour l'utilisateur actuel
- Marquer
- S'abonner
- Page imprimable