Vai al contenuto
PLC Forum


Vb E Vc+*


Messaggi consigliati

Inserito:

Salve a tutti.

dovrei integrare delle librerie di comunicazione PC (MS Win) e CN in un mio progetto fatto con Visual basic 6.

Normalmente, con i pacchetti di questo tipo, mi vengono dati sempre anche degli esempi in basic

e ne sono sempre venuto fuori,ma questa volta li ho solo in per VC++, e sono ben in difficolta'

Qualcuno mi potrebbe indicare il codice VB per l'integrazione in basic.

grazie per l'aiuto.

Segue l'esempio che ho in VC++

Install the CNC Library on the development PC. Open the command prompt and switch to

the directory where the Microsoft.Net Framework v2.0 has been installed (normally

C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727). Use the regasm utility to register the COM

classes as shown below.

regasm “C:\Program Files\CNCLibrary\CNC.dll” /tlb “C:\Program Files\CNC Library\CNCLibrary.tlb”

/codebase

Add an import command into the project as shown below (this sample is written in C++).

#import "C:\\CNCLibrary\\com.CNCinterop.tlb" named_guids

raw_interfaces_only

Create a new COM object as shown below.

CoInitialize(NULL);

CNCLibrary::M740InterfacePtr pDotNetCOMPtr;

HRESULT hRes =

pDotNetCOMPtr.CreateInstance(PippoLibrary::CLSID_M740);

Call the functions of the COM object to communicate with the machine as shown below.

int iRet = 0;

pDotNetCOMPtr->Connect("CNC",4500,&iRet);

pDotNetCOMPtr->Select_NC_Program(0,10,&iRet);

pDotNetCOMPtr->Disconnect(&iRet);


Inserita:

Mmm... non è che sono librerie che funzionano solo in dot net?

Che cosa sono? Di che produttore?

Inserita:

le librerie funzionano anche con VC6, tantoche l'esempio che ho trascritto , dicono che lo sia.

E' vero che hanno funzioni diverse da .NET e VC++6

Crea un account o accedi per commentare

Devi essere un utente per poter lasciare un commento

Crea un account

Registrati per un nuovo account nella nostra comunità. è facile!

Registra un nuovo account

Accedi

Hai già un account? Accedi qui.

Accedi ora
×
×
  • Crea nuovo/a...