Bonjour,

Je dois interfacer un appareil relié à un PC par USB.

Pour commencer je souhaite pouvoir lancer et connecter cet appareil à l'aide d'une DLL fourni par le fournisseur de l'appareil.

Le fournisseur à mis a disposition un petit programme de test qui permet de faire ce que j'ai décrit au dessus. Toutefois, ce programme ne fonctionne pas.

Ayant des connaissances très basics en c++ je ne sais pas d'où vient l'erreur.

Voici le code

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
/ TestPGAppCommFromC.cpp : Defines the entry point for the console application.
//
 
#include "stdafx.h"
#import "PGAppComm.tlb" named_guids raw_interfaces_only
 
 
int _tmain(int argc, _TCHAR* argv[])
{
    long retVal;
	bool launched = false;
	bool connected = false;
	BSTR hostName;
	long portNum;
 
	// initialize COM
	CoInitialize(NULL);
 
	// initialize instance of PGAppCom
	PGAppComm::IPGAppCommInterfacePtr pServer(__uuidof(PGAppComm::PGAppComm));
 
	// launch PGAppDotNet
	/* serverFn is the repository where we have to find PGApp.exe 
	if serverFn is "", PGAppComm will look for installed PGAppDotNet application and use it */
	BSTR serverFn = SysAllocString(L"");
 
	// GetServerHostInfo functionget the server host name and port number
	pServer->GetServerHostInfo(&hostName, &portNum, &retVal);
	VARIANT_BOOL hideGUI = FALSE;
 
	//LaunchServer function launch a new PGAppDotNet server application on  the local machine
	pServer->LaunchServer(serverFn, portNum, 1328, hideGUI, &retVal);
	launched = (retVal == PGAppComm::DotNetErr_OK); 
	if (!launched)
       printf("Error %d launching PGAppDotNet server", retVal); 
	SysFreeString(serverFn);
 
	// connect to PGAppDotNet
	if (launched) {
		BSTR hostName = SysAllocString(L"localhost:12345");
		// Connect function connect a client to a server
        pServer->Connect(hostName, &retVal);
   	    connected = (retVal == PGAppComm::DotNetErr_OK);
		if (!connected)
			printf("Error %d launching connecting to PGAppDotNet server", retVal); 
		SysFreeString(hostName);
	}
 
	// close PGAppDotNet and disonnect
	if (connected) 
		pServer->ShutDownServer(&retVal);
 
	// release COM object
	pServer->Release();
 
	// deinitialize COM
	CoUninitialize();
 
	return 0; 
}
lorsque je lance ce code cette erreur apparait

Exception non gérée à 0x7c812fd3 dans TestPGAppCommFromCPP.exe*: Exception Microsoft C++*: _com_error à l'emplacement mémoire 0x0012fce8..

sortie VBC++

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
'TestPGAppCommFromCPP.exe'*: Chargé '\\Cimi\j.baer\TestPGAppCommFromCPP\Debug\TestPGAppCommFromCPP.exe', Les symboles ont été chargés.
'TestPGAppCommFromCPP.exe'*: Chargé 'C:\WINDOWS\system32\ntdll.dll', Cannot find or open the PDB file
'TestPGAppCommFromCPP.exe'*: Chargé 'C:\WINDOWS\system32\kernel32.dll', Cannot find or open the PDB file
'TestPGAppCommFromCPP.exe'*: Chargé 'C:\WINDOWS\system32\ole32.dll', Cannot find or open the PDB file
'TestPGAppCommFromCPP.exe'*: Chargé 'C:\WINDOWS\system32\advapi32.dll', Cannot find or open the PDB file
'TestPGAppCommFromCPP.exe'*: Chargé 'C:\WINDOWS\system32\rpcrt4.dll', Cannot find or open the PDB file
'TestPGAppCommFromCPP.exe'*: Chargé 'C:\WINDOWS\system32\secur32.dll', Cannot find or open the PDB file
'TestPGAppCommFromCPP.exe'*: Chargé 'C:\WINDOWS\system32\gdi32.dll', Cannot find or open the PDB file
'TestPGAppCommFromCPP.exe'*: Chargé 'C:\WINDOWS\system32\user32.dll', Cannot find or open the PDB file
'TestPGAppCommFromCPP.exe'*: Chargé 'C:\WINDOWS\system32\msvcrt.dll', Cannot find or open the PDB file
'TestPGAppCommFromCPP.exe'*: Chargé 'C:\WINDOWS\system32\oleaut32.dll', Cannot find or open the PDB file
'TestPGAppCommFromCPP.exe'*: Chargé 'C:\WINDOWS\system32\msvcr100d.dll', Les symboles ont été chargés.
'TestPGAppCommFromCPP.exe'*: Chargé 'C:\WINDOWS\system32\imm32.dll', Cannot find or open the PDB file
'TestPGAppCommFromCPP.exe'*: Chargé 'C:\WINDOWS\system32\uxtheme.dll', Cannot find or open the PDB file
'TestPGAppCommFromCPP.exe'*: Chargé 'C:\Program Files\Dexpot\hooxpot.dll', Cannot find or open the PDB file
'TestPGAppCommFromCPP.exe'*: Chargé 'C:\WINDOWS\system32\MSCTF.dll', Cannot find or open the PDB file
'TestPGAppCommFromCPP.exe'*: Chargé 'C:\Program Files\UltraVNC\SCHook.dll', Le fichier binaire n'a pas été généré avec les informations de débogage.
'TestPGAppCommFromCPP.exe'*: Chargé 'C:\WINDOWS\system32\clbcatq.dll', Cannot find or open the PDB file
'TestPGAppCommFromCPP.exe'*: Chargé 'C:\WINDOWS\system32\comres.dll', Cannot find or open the PDB file
'TestPGAppCommFromCPP.exe'*: Chargé 'C:\WINDOWS\system32\version.dll', Cannot find or open the PDB file
'TestPGAppCommFromCPP.exe'*: Chargé 'C:\WINDOWS\system32\xpsp2res.dll', Le fichier binaire n'a pas été généré avec les informations de débogage.
Exception de première chance à 0x7c812fd3 dans TestPGAppCommFromCPP.exe*: Exception Microsoft C++*: _com_error à l'emplacement mémoire 0x0012fce8..
Exception non gérée à 0x7c812fd3 dans TestPGAppCommFromCPP.exe*: Exception Microsoft C++*: _com_error à l'emplacement mémoire 0x0012fce8..
Autant vous dire que tout cela est du chinois pour moi. Dans l'attente de vos réponse, je vous remercie.