Hi i have this issue when i work with PDFCREator. :
So i create a projet on VS2010 on Xp 32b --> the dll i use on xp 32 --> no prob but on seven 64b error. 🙂
So for use my dll on the both 32/64b :
in you projet :
1 - remove your COM.
2 - add the com and check is local is true.
3 - build you projet --> new file .ddl in you debug/release of you app.
4 - Rename this DDL with no . in the name.
5 - remove your com.
6 - add the com but not in the COM but Browse and select the file you have rename.
7 - build
Now on you all machin you have to convert the com with a exe on you machine :
here the main program you have to use :
on XP :
"C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bin\tlbimp.exe"
On Seven :
"C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\tlbimp.exe"
So : on DOS: the command you have to make :
tlpimp.exe "Path+Name of COM" /out:"Path+name of you DLL in you debug/release path"
replace the first in "" with your COM
replace the last in "" with your DLL.
Dont remove the ""
i have too created a function for this : (sorry mu native language is french. So use a translator)
'*************************************************************************************
'*** Fonction de Vérification des fichiers InterOp (ex : PDFCreator) *****************
'*************************************************************************************
'== Entrée :
'== NomProg : Le nom du programme qui utilisera l'InterOp
'== NomApp : Le nom + path de l'application à charger
'== NomDll : Le nom du fichier (avec le .DLL) (qui doit exister à coté du prog)
'
'== FichierDeBase32 : Le fichier qui doit générer la DLL. (Exe ou autre)
'== FichierDeBase64 : Le fichier qui doit générer la DLL. (Exe ou autre)
'==
'==
'== Sortie
'== NomFichier : Le chemin complet + le nom.dll du programme compilé sinon retourne ""
'==
'==
'*************************************************************************************
Public Function VerifieInterOp(ByVal NomProg As String, _
ByVal NomApp As String, _
ByVal NomDll As String, _
ByVal FichierDeBase32 As String, _
ByVal FichierDeBase64 As String) As Boolean
Dim OkRetour As Boolean = False
Dim NomFichierInterOp As String = NomApp.Remove(NomApp.LastIndexOf(NomProg)) & NomDll
If Not (IO.File.Exists(NomFichierInterOp)) Then
Dim NomFichierTLPImp As String
Dim NomFichierBaseDLL As String
If IntPtr.Size > 4 Then
'64 bits
NomFichierTLPImp = "C:\Program Files (x86)\Microsoft SDKs\Windows\v7.0A\Bin\tlbimp.exe"
NomFichierBaseDLL = FichierDeBase64
Else
'32bits
NomFichierTLPImp = "C:\Program Files\Microsoft SDKs\Windows\v7.0A\Bin\tlbimp.exe"
NomFichierBaseDLL = FichierDeBase32
End If
Dim RetourProcess As System.Diagnostics.Process
Try
MsgBox("Le programme va essayer de créer le lien avec le programme : " & vbCrLf & _
NomFichierBaseDLL & vbCrLf & _
"Une fenêtre va s'ouvrir et le programme va attendre sa fermeture.", _
vbOKOnly & vbCritical, "Information")
Dim ParamTxt = """" & NomFichierBaseDLL & """" & " /out:" & """" & NomFichierInterOp & """"
RetourProcess = Process.Start(NomFichierTLPImp, ParamTxt)
Do While RetourProcess.HasExited = False
GestionAUTOCAD.EcrireSurLigneDeCommande(vbCrLf & "En attente du programme de lien...")
Loop
GestionAUTOCAD.EcrireSurLigneDeCommande(vbCrLf & "Fin du programme de lien, analyse du résultat.")
If RetourProcess.ExitCode = 0 Then
'vérification si le fichier existe
If IO.File.Exists(NomFichierInterOp) = False Then
MsgBox("Le fichier " & NomFichierInterOp & " n'a pas été créé" & vbCrLf & _
"Contacter le responsable pour vérifier ce problème.", _
vbOKOnly & vbCritical, "Erreur de Programmation")
GestionAUTOCAD.EcrireSurLigneDeCommande(vbCrLf & "Programme : " & NomFichierTLPImp)
GestionAUTOCAD.EcrireSurLigneDeCommande(vbCrLf & "Paramêtre : " & ParamTxt)
Return False
Else
Return True
End If
End If
Return False
Catch ex As Exception
MsgBox("Le programme de lien InterOP " & NomFichierTLPImp & "est introuvable." & vbCrLf & _
"Contacter le responsable pour vérifier le bon répertoire." & vbCrLf & vbCrLf & _
"", vbOKOnly & vbCritical, "Erreur de Programmation")
Return False
End Try
Else
Return True
End If
End Function
And this is for call this function for create the interop.DLL for PDFCREATOR.
If VerifieInterOp("GestionFolio", Str, _
"PdfCreator.dll",
"C:\Program Files\PDFCreator\PDFCreator.exe", _
"C:\Program Files (x86)\PDFCreator\PDFCreator.exe") = True Then
Assembly.LoadFrom(Str)
'--> Ajouter un espace à la fin de la commande
Application.DocumentManager.MdiActiveDocument.SendStringToExecute(strCmd, True, False, True)
Else
MsgBox("Pour lancer le programme GestionFolio, il faut absolument" & vbCrLf & _
"installer PdfCreator dans le répertoire : " & vbCrLf & _
"C:\Program Files\PdfCreator\ (sous XP 32Bits / Seven 32Bits)" & vbCrLf & _
"C:\Program Files (x86)\PdfCreator\ (sous XP 64Bits / Seven 64Bits)", _
MsgBoxStyle.Information, "Erreur d'installation")
End If the var STR is the path + name of my application i have build with VS2010.
GestionAUTOCAD.EcrireSurLigneDeCommande(...
is a sub for write on the console (replace ed. ....)
you have to put this code in another application if you use the COM on the init of you app.
Me i use before declare the var = new clsPDFCreator.Pdfcreator.
You have to put the InterOpDLL with your Application in the same path.
I think it is a best way for build a InterOp valid on 62 / 64 b.
with this i dont have you error.
Only tested with PDFCREATOR.