Code Comments

Programming Forum and web based access to our favorite programming groups.
For Programmers: Free Programming Magazines | New: Database administration forum
Registration is free! Edit your profileCalendarFind other membersFrequently Asked QuestionsSearch -> 
Post New Thread











Thread
Author

C program in VB
Hi

I received the code of a interface written i C, but I can't program in C.
Can someone interpret me this in VB?

////////////////////////////////////////////////////////////////////////////
/
// CHotelTstAppDlg dialog

//Deklaration:

unsigned int CHotelTstAppDlg::m_UM_ELAPINotify = 0;





//Registrierung

BEGIN_MESSAGE_MAP(CHotelTstAppDlg, CDialog)
//{{AFX_MSG_MAP(CHotelTstAppDlg)
...
...
//}}AFX_MSG_MAP
 ON_REGISTERED_MESSAGE(CHotelTstAppDlg::m
_UM_ELAPINotify, OnELAPINotify)
//internal service message
END_MESSAGE_MAP()






//Aufruf von Connect mit Parameterübergabe:


void CHotelTstAppDlg::OnConnect()
{
// TODO: Add your control notification handler code here
BYTE bDeviceID;
HWND hOwnerWnd= m_hWnd;
UINT* puNotifyMsg= &m_UM_ELAPINotify;


UpdateData();
bDeviceID= GetDeviceId(m_iDevice);

DWORD dwRet;

if(m_bUseVB_API)
dwRet= m_pWELAPI->VB_Connect( (LONG) bDeviceID, (LONG) hOwnerWnd,
(LONG*) puNotifyMsg);
else
dwRet= m_pWELAPI->Connect( bDeviceID, hOwnerWnd, puNotifyMsg);

if(dwRet == ELAPI_OK)
SetConnectionFlag(TRUE);
else
SetConnectionFlag(FALSE);
}





//Callback-Funktion mit auswerten der Parameter:



LRESULT CHotelTstAppDlg::OnELAPINotify(WPARAM wParam, LPARAM lParam)
{
CString str;

// Message received from SManager
switch( LOWORD(wParam) )
{
case SVC_DISCONNECTED:
printLine("SVC_DISCONNECTED");
SetConnectionFlag(FALSE);
trace("CHotelTstDlg::OnELAPINotify: message: SVC_DISCONNECTED
received");
break;
// Data received
case SVC_DATARECEIVED:
printLine("SVC_DATARECEIVED");
trace("CHotelTstDlg::OnELAPINotify: message: SVC_DATARECEIVED
received");

WORD size;
size= HIWORD(wParam);
char * pacRecBuffer;
pacRecBuffer= new char[size];

ReceiveData( (unsigned char*)pacRecBuffer, size);

ProcessReceiveData(pacRecBuffer, size);
delete pacRecBuffer;
break;

default:
trace("CHotelTstDlg::OnELAPINotify: undefined message:!!!");
break;
}
return 1;
}


oid HotelTstAppDlg::ReceiveData(char* pacRecBuffer, WORD wSize)
{
CString str;
WORD wStrCount=3;

if(pacRecBuffer==NULL)
return;

switch(pacRecBuffer[0])
{

// Hotel_Start_Conf
case 0x45:

int RefID;
int len;
RefID= pacRecBuffer[1];
len= ((int)pacRecBuffer[2]) << 8;
len+= pacRecBuffer[3];

switch(pacRecBuffer[4])
{
case 0xD0: // parameter result
int ilenResult;
ilenResult= pacRecBuffer[5];
int iResultValue;
iResultValue= pacRecBuffer[6];
int iErrorValue;
iErrorValue= pacRecBuffer[7];
}
}
}

THANKS FOR EVERY HELP

Nijazi Halimaji



Report this thread to moderator Post Follow-up to this message
Old Post
Don Hali
10-30-04 01:55 PM


Re: C program in VB
"Don Hali" <spami@gmx.net> wrote in message
news:uxOmCJmvEHA.1976@TK2MSFTNGP09.phx.gbl...
> Hi
>
> I received the code of a interface written i C, but I can't program in C.
> Can someone interpret me this in VB?
>

First off. The code is not written in C, but in C++ (MFC).
Second, it appears to be a dialog which is using the services of something
referenced by "m_pWELAPI", which is what I assume you meant by an
'interface'.

You will likely need to create a VB form and reference that object. How will
depend on what it is - a control, an API (dll), or ... With out more
information anything else would be a pure guess.

The fact it has something called a "VB_Connect" is interesting. Attempt to
reference the item and see what services are available in the ObjectViewer.

hth
-ralph







Report this thread to moderator Post Follow-up to this message
Old Post
Ralph
10-30-04 01:55 PM


Sponsored Links




Last Thread Next Thread Next
Search this forum -> 
Post New Thread

Visual Basic archive

Show a Printable Version Send to friend Email This Page to Someone! subscribe to this thread Receive updates to this thread
Computer Consultants
Programming Jobs
Visual Basic Controls
SQL Server Programming
Webservices
Java Security
Visual Studio
C# Programming
Visual J++
Software engineering
Open source Software
Perl Programming
PHP Programming
ASP Programming
ASP .NET Programming
Visual Basic Programming
Windows Scripting Host
Java Programming
Java Help
Java Beans
VBScript
Cobol
MAC Applications
Unix Programming
Forum Jump:
All times are GMT. The time now is 05:12 AM.

 
Free MCSE Braindumps | Real Estate Topics

Programming forum archive

Copyrights CodeComments.com 2004 - 2006

Powered by vBulletin Copyright 2000-2006 Jelsoft Enterprises Limited.