头文件到Visual Basic代码转换 [英] Header file to Visual Basic code translation

查看:87
本文介绍了头文件到Visual Basic代码转换的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,转换后我有一个C ++和VB.NET的代码。但是stringname.GetBuffer在蓝色字符串上出错。什么是相当于VB.Net的代码?下面是C ++和VB的代码.NEt:





C ++代码:

Hi all, I have a code of C++ and VB.NET after converting. But the stringname.GetBuffer is got error on blue string. What are the code equivalent to VB.Net? Below are the code from C++ and VB.NEt:


C++ code:

void ImageSetup::SetBitmap()
{ 
	CString	tmpFile,DumpFile,ImageFileName;	
	int	strLen;
	char	*srcFile;
	char	rsp[200];
	CString szFileBmp1,szFileBmp2,szFileBmp3;
	int	FileNameCount;
	ImageFileName = "Check_.bmp";

	HBITMAP bmp;
	bmp = NULL;

	char *file_name= LPSTR(LPCTSTR(ImageFileName));
	SetBmp(file_name);

	tmpFile = ImageFileName;
	strLen = tmpFile.GetLength();
	strLen -= 4;
	tmpFile.Insert(strLen,"F");			// front
	srcFile = tmpFile.GetBuffer(tmpFile.GetLength());
	szFileBmp1 = srcFile;

	tmpFile = ImageFileName;
	strLen = tmpFile.GetLength();
	strLen -= 4;
	tmpFile.Insert(strLen,"R");			// Rear
	srcFile = tmpFile.GetBuffer(tmpFile.GetLength());
	szFileBmp2 = srcFile;

	tmpFile = ImageFileName;
	strLen = tmpFile.GetLength();
	tmpFile.Replace(".bmp",".TIF");
	strLen -= 4;
	tmpFile.Insert(strLen,"RB");			// Rear
	srcFile = tmpFile.GetBuffer(tmpFile.GetLength());
	szFileBmp3 = srcFile;

	if(	m_bCheck12 == TRUE)
	{
		tmpFile = DumpFile;	
		FileNameCount++;
		strLen = tmpFile.GetLength();

		tmpFile.Replace(".bmp","");
		wsprintf(rsp,"%04d.bmp",FileNameCount);

		tmpFile += rsp;//".bmp";
		app_tbl.ImageFileName = tmpFile;
	}
}





VB.NET代码:



VB.NET code:

Public Sub SetBitmap()
    Dim tmpFile As String
    Dim DumpFile As String
    Dim ImageFileName As String
    Dim strLen As Integer
    Dim srcFile As String
    Dim rsp As New String(New Char(199){})
    Dim szFileBmp1 As String
    Dim szFileBmp2 As String
    Dim szFileBmp3 As String
    Dim FileNameCount As Integer
    ImageFileName = "Check_.bmp"
    Dim bmp As System.IntPtr
    bmp = Nothing

    Dim file_name As SByte = CStr(CStr(ImageFileName))
    SetBmp(file_name)

    tmpFile = ImageFileName
    strLen = tmpFile.Length
    strLen -= 4
    tmpFile = tmpFile.Insert(strLen,"F") ' front
    srcFile = tmpFile.GetBuffer(tmpFile.Length)
    szFileBmp1 = ChrW(srcFile)

    tmpFile = ImageFileName
    strLen = tmpFile.Length
    strLen -= 4
    tmpFile = tmpFile.Insert(strLen,"R") ' Rear
    srcFile = tmpFile.GetBuffer(tmpFile.Length)
    szFileBmp2 = ChrW(srcFile)

    tmpFile = ImageFileName
    strLen = tmpFile.Length
    tmpFile = tmpFile.Replace(".bmp",".TIF")
    strLen -= 4
    tmpFile = tmpFile.Insert(strLen,"RB") ' Rear
    srcFile = tmpFile.GetBuffer(tmpFile.Length)
    szFileBmp3 = ChrW(srcFile)

    If m_bCheck12 = [TRUE] Then
        tmpFile = DumpFile
        FileNameCount += 1
        strLen = tmpFile.Length

        tmpFile = tmpFile.Replace(".bmp","")
        rsp = String.Format("{0:D4}.bmp", FileNameCount)

        tmpFile &= ChrW(rsp) '".bmp";
        ImageFileName = tmpFile
    End If
End Sub





唯一令我惊讶的是来自字符串的GetBuffer函数。它存在吗?或者有些人可以看到这些东西并帮助我。一点帮助非常感谢。谢谢



The only thing that make me wonder is the GetBuffer function from a string. Is it exist? Or can some see this things and help me out. A little help is highly appreciate. Thank you

推荐答案

GetBuffer C ++中无用 VB.NET 程序。


这篇关于头文件到Visual Basic代码转换的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆