[2 days left] What’s wrong with your cloud strategy? Learn why multicloud solutions matter with Nimble Storage.Register Now

x
?
Solved

How to convert Visual C++ to VB

Posted on 2009-07-06
3
Medium Priority
?
367 Views
Last Modified: 2013-11-26
Can anyone convert this over to vb this is converted in Visual C++
unsigned char ucByte;
	int nCount;
	BOOL bHave_start_char = FALSE;
	
	DWORD dwStart_time = GetTickCount ();
	
	while (GetTickCount () - dwStart_time < 500) {
		while (m_pRS232->RXCount () > 0) {
			m_pRS232->Read_Buffer ((char*) &ucByte, 1);
	
//			#ifdef _DEBUG
//				Debug__Send_Byte_to_Output_Wnd (ucByte);
//			#endif
	
			if (bHave_start_char == FALSE) {
				if (ucByte == '~') {													//  TRUE = Have the start character
					bHave_start_char = TRUE;
					nCount = 1;
				}
	
				continue;
			}
	
			switch (nCount) {
				case 1: if (ucByte != (unsigned char) '\x00') break; nCount++; continue;			//  Number of bytes, MSB
				case 2: if (ucByte != (unsigned char) '\x03') break; nCount++; continue;			//  Number of bytes, LSB
				case 3: if (ucByte != (unsigned char) '\x89') break; nCount++; continue;			//  API Identifier TxD status
				case 4: if (ucByte != (unsigned char)    'm') break; nCount++; continue;			//  Frame ID
				case 5: if (ucByte != (unsigned char) '\x00') break; nCount++; return TRUE;		//  Status byte, '\x00' = Successful
			}
	
			bHave_start_char = FALSE;
		}
	}
	
	return FALSE;

Open in new window

0
Comment
Question by:cmdolcet
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 53

Accepted Solution

by:
Dhaest earned 1500 total points
ID: 24791797
I think that it will be easier to see what the function should do and rewrite it...
0
 

Author Comment

by:cmdolcet
ID: 24794955
Ok i can do that, however I can't copy the visual C++ code and run it in vb can I?
0
 
LVL 2

Expert Comment

by:TheBrainArts
ID: 24795643
Nno you cannot do that and i am doing the translation for you.   But the best is to do as Dhaest say, identify the function input and ouptut.  Because in the bribe of code you submitted there is a rs232 port mentionned there which is not declare in this code portion.
0

Featured Post

What’s Wrong with Your Cloud Strategy ?

Even as many CIOs are embracing a cloud-first strategy, the reality is that moving to the cloud is a lengthy process and the end-state is likely to be a blend of multiple clouds—public and private. Learn why multicloud solutions matter in this webinar by Nimble Storage.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
Wouldn’t it be nice if you could test whether an element is contained in an array by using a Contains method just like the one available on List objects? Wouldn’t it be good if you could write code like this? (CODE) In .NET 3.5, this is possible…
This course is ideal for IT System Administrators working with VMware vSphere and its associated products in their company infrastructure. This course teaches you how to install and maintain this virtualization technology to store data, prevent vuln…
In this video, Percona Solution Engineer Dimitri Vanoverbeke discusses why you want to use at least three nodes in a database cluster. To discuss how Percona Consulting can help with your design and architecture needs for your database and infras…

649 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question