vb.net 中如何将Byte数组地址作为参数传给C++ dll

ccbaor 2014-05-22 05:32:44
我的是vb.net x64,c++ dll中,函数参数为 byte*。vb.net函数声明中的参数是这样写的 byref buffer as byte。调用代码如下:
Dim buffer(64) As Byte
Dim str1 As String = "how do you turn this on"
For i = 0 To str1.Length - 1
'buffer(i) = Convert.ToByte(str1.Chars(i))
Next
函数调用时的参数是这样写的 buffer(0)
以上如果在32位的环境中是正常的,但是64环境下,dll中就只得到了buffer(0)的值,后面的值没有得到。
参考帖子http://bbs.csdn.net/topics/390067304中的6楼,字符数组赋值改用
Dim code As System.Text.Encoding = System.Text.Encoding.ASCII
buffer = code.GetBytes(str1)
'buffer(str1.Length) = 0
仍然没有起到效果,
这个问题网上似乎有很多,但是没有找到一个很好的解决办法,哪位大神来指点一下出现这个问题的具体原因和解决方法,不胜感谢!!
...全文
400 6 打赏 收藏 转发到动态 举报
写回复
用AI写文章
6 条回复
切换为时间正序
请发表友善的回复…
发表回复
ccbaor 2014-05-26
  • 打赏
  • 举报
回复
好吧,先结贴,4楼的示例时可行的。
ccbaor 2014-05-23
  • 打赏
  • 举报
回复
引用 4 楼 iyomumx 的回复:
给你一个简单的示范:
Imports System
Imports System.Runtime.InteropServices
Imports System.Text

Module Module1
	<DllImport("msvcrt.dll", CharSet:=CharSet.Unicode, CallingConvention:=CallingConvention.Cdecl, ExactSpelling:=True)>
	Public Function swprintf(ByVal TargetString As System.Text.StringBuilder, ByVal FormatSpecifier As String, ByVal i As Integer, ByVal j As Integer) As Integer
	End Function
    Sub Main()
		Dim Buffer = New StringBuilder(255)
		Dim x = 2014
		swprintf(Buffer, "0x%x 的平方是 0x%x", x, x * x)
		Console.WriteLine(Buffer.ToString())
    End Sub
End Module
十分感谢,按照你提供的示例成功解决了问题,但是还想麻烦您一下,这种直接传递字符串的方式,和引用传递数组首个元素的方式主要区别在哪里?我网上查到的资料是引用传递数组首个元素实际上是传递了他压栈后的地址,是这个原因吗?那引用传递数组首个元素的方法为什么有时候又能成功呢?这问题是不是.net引起的,因为我在c#中也遇到过,麻烦您指点一下,感谢!
iyomumx 2014-05-23
  • 打赏
  • 举报
回复
给你一个简单的示范:
Imports System
Imports System.Runtime.InteropServices
Imports System.Text

Module Module1
	<DllImport("msvcrt.dll", CharSet:=CharSet.Unicode, CallingConvention:=CallingConvention.Cdecl, ExactSpelling:=True)>
	Public Function swprintf(ByVal TargetString As System.Text.StringBuilder, ByVal FormatSpecifier As String, ByVal i As Integer, ByVal j As Integer) As Integer
	End Function
    Sub Main()
		Dim Buffer = New StringBuilder(255)
		Dim x = 2014
		swprintf(Buffer, "0x%x 的平方是 0x%x", x, x * x)
		Console.WriteLine(Buffer.ToString())
    End Sub
End Module
ccbaor 2014-05-23
  • 打赏
  • 举报
回复
引用 2 楼 ccbaor 的回复:
[quote=引用 1 楼 iyomumx 的回复:] 搞出这种引用传递数组第一个元素就能指望P/Invoke帮你把整个数组传过去的,就该砸烂他的狗头,打翻在地,再踏上一只脚,让他永世不得翻身 回到正题,你想传字符串,就在函数定义里写接受字符串参数就好。如果需要确保缓冲区大小,可以换成StringBuilder,并在传递之前用buffer = New StringBuilder(255)这样的构造函数预先分配空间。
你的意思是函数声明里这样写:byref buffer as string 调用的时候是:dim buffer as string=“123” 函数调用的参数是 buffer 是这个样子吗? [/quote] 不对,似乎声明时应该是byval的形式
ccbaor 2014-05-23
  • 打赏
  • 举报
回复
引用 1 楼 iyomumx 的回复:
搞出这种引用传递数组第一个元素就能指望P/Invoke帮你把整个数组传过去的,就该砸烂他的狗头,打翻在地,再踏上一只脚,让他永世不得翻身 回到正题,你想传字符串,就在函数定义里写接受字符串参数就好。如果需要确保缓冲区大小,可以换成StringBuilder,并在传递之前用buffer = New StringBuilder(255)这样的构造函数预先分配空间。
你的意思是函数声明里这样写:byref buffer as string 调用的时候是:dim buffer as string=“123” 函数调用的参数是 buffer 是这个样子吗?
iyomumx 2014-05-22
  • 打赏
  • 举报
回复
搞出这种引用传递数组第一个元素就能指望P/Invoke帮你把整个数组传过去的,就该砸烂他的狗头,打翻在地,再踏上一只脚,让他永世不得翻身 回到正题,你想传字符串,就在函数定义里写接受字符串参数就好。如果需要确保缓冲区大小,可以换成StringBuilder,并在传递之前用buffer = New StringBuilder(255)这样的构造函数预先分配空间。
1 , vb5dialog.zipThis demonstrates how to subclass the Common Dialog Dialogs and manipulate a specific Dialog.2 , cpnl.zipForm_Taskbar is a control for Visual Basic which, once placed onto a form, makes the form act like the Taskbar (minus the Start Menu).3 , vbo_progbar.zipImplement a common control progress bar with added features that are not accessable using COMCTL32.OCX! 4 , vbo_infolabel.zipThis control adds a great user-friendly interface with and icon and "Hover" ability. Based on a control seen in ICQ. 5 , vbo_checkcombo.zipAdd a checkbox to a combo box and use it to enabled/disable the combo! or whatever you would like to do with it! 6 , vbo_controlframe.zipCreate your own system button such as a Maximize, Minimize, Close, and many others with ease! 7 , vbo_ctextbox.zipThis class makes using the Textbox or Edit class API simple. Easily set properties and access many features not available directly from VB. 8 , taskbar.zipForm_Taskbar is a control for Visual Basic which, once placed onto a form, makes the form act like the Taskbar (minus the Start Menu).9 , NT_Service.zipThis is an OCX that allows you to create an NT service application...add the control to your project and register it as a service!!10 , Scroller.zipThis is a Control Container, it's like a frame control but it lets you scroll the content up and down...11 , TrayArea.zipThis control lets you add your icon to the System Tray Area and handle some events such as MouseMove, MouseDown, MouseUp and DblClick.12 , Resizer.zipThis is a very useful control: It's a container control, you can insert two controls inside and then you'll have a vertical (or horizontal) resizer bar (like the Windows File Explorer). A resizer can contain another resizer... an so on. (you can divide you form in as many sizable sections as you want...).13 , Label3D.zipTh
主要介绍如何开发一个ActiveX控件,提供接口,与相应事件挂钩。文涉及到VARIANT,SAFEARRAY,BSTR的详细使用方法。 另外还提供了WinSock的详细开发步骤,以及如何响应网络超时,网络断开的事件方法以及在VC,VB调用该控件的方法。 一、MFC ActiveX控件开发步骤(VC 6.0): New->Projects->MFC ActiveX ControlWizard,然后输入MFCWinSock工程名。如下图: 图一 创建工程 一路狂按Next,直至Finsh出现,再按下OK,如下图:     图二 创建完成 二、架设Socket环境: 首先在StdAfx.h文件加入下面这句代码: #include // MFC socket extensions 打开MFCWinSock.cpp文件,添加代码,看起来如下: //////////////////////////////////////////////////////////////////////////// // CMFCWinSockApp::InitInstance - DLL initialization BOOL CMFCWinSockApp::InitInstance() { BOOL bInit = COleControlModule::InitInstance(); if (bInit) { // TODO: Add your own module initialization code here. if (!AfxSocketInit()) { AfxMessageBox("无法初始化Socket,请检查!"); return FALSE; } WSADATA wsaData; WORD wVersion = MAKEWORD(1, 1);//设定为Winsock 1.1版 int errCode; errCode = WSAStartup(wVersion, &wsaData);//启动Socket服务 if (errCode) { AfxMessageBox("无法找到可以使用的 WSOCK32.DLL"); return FALSE; } } return bInit; } //////////////////////////////////////////////////////////////////////////// // CMFCWinSockApp::ExitInstance - DLL termination int CMFCWinSockApp::ExitInstance() { // TODO: Add your own module termination code here. WSACleanup();//结束网络服务 return COleControlModule::ExitInstance(); } 三,提供控件接口和事件 在MFCWinSockCtl.cpp加入如下代码: #ifndef WM_MYWINSOCK #define WM_MYWINSOCK WM_USER+1888 #endif View->ClassWizard->Automation->Add Method…如下图: 图三 创建接口 这个时候,我们为这个控件添加了一个Connect()的接口,出于通用性,安全性和扩展性的考虑,我们采用了VARIANT类型的参数, 很多人可能都不太了解该类型,又或者有接触过,但被吓怕了,那么我们来看清它的本来面目: struct tagVARIANT { union { struct __tagVARIANT { VARTYPE vt; WORD wReserved1; WORD wReserved2; WORD wReserved3; union { LONG lVal; BYTE bVal; SHORT iVal; FLOAT fltVal; DOUBLE dblVal; VARIANT_BOOL boolVal; _VARIANT_BOOL bool; SCODE scode; CY cyVal; DATE date; BSTR bstrVal; IUnknown __RPC_FAR *punkVal; IDispatch __RPC_FAR *pdispVal; SAFEARRAY __RPC_FAR *parray; BYTE __RPC_FAR *pbVal; SHORT __RPC_FAR *piVal; LONG __RPC_FAR *plVal; FLOAT __RPC_FAR *pfltVal; DOUBLE __RPC_FAR *pdblVal; VARIANT_BOOL __RPC_FAR *pboolVal; _VARIANT_BOOL __RPC_FAR *pbool; SCODE __RPC_FAR *pscode; CY __RPC_FAR *pcyVal; DATE __RPC_FAR *pdate; BSTR __RPC_FAR *pbstrVal; IUnknown __RPC_FAR *__RPC_FAR *ppunkVal; IDispatch __RPC_FAR *__RPC_FAR *ppdispVal; SAFEARRAY __RPC_FAR *__RPC_FAR *pparray; VARIANT __RPC_FAR *pvarVal; PVOID byref; CHAR cVal; USHORT uiVal; ULONG ulVal; INT intVal; UINT uintVal; DECIMAL __RPC_FAR *pdecVal; CHAR __RPC_FAR *pcVal; USHORT __RPC_FAR *puiVal; ULONG __RPC_FAR *pulVal; INT __RPC_FAR *pintVal; UINT __RPC_FAR *puintVal; struct __tagBRECORD { PVOID pvRecord; IRecordInfo __RPC_FAR *pRecInfo; } __VARIANT_NAME_4; } __VARIANT_NAME_3; } __VARIANT_NAME_2; DECIMAL decVal; } __VARIANT_NAME_1; }; 它先是一个结构体,里面有一个重要成员VARTYPE vt;vt即是指明当前的数据类型,比如整型或者字符型,当指明vt后, 后面看到各种变量类型包括在一个联合体当,也就是说指明vt后,你只能使用对应的其之一变量类型。看着这众多的各种不同 类型变量集在一起,确实让人吓了一跳,但细细看来,大多数变量跟我们平时的用法相似。值得一提的是SAFEARRAY __RPC_FAR *parray; 也许有很多人还没有接触过SAFEARRAY类型的变量,SAFEARRAY实际上也是一个结构,大家可以参考MSDN,我也将在后面介绍它的具体使用方法。 用同样的方法创建DisConnect()接口 创建两个事件,FireCloseWinsock()响应网络断开事件,FireRecvSockEvent()响应网络有数据到达的事件。创建方法如下图: 图四 创建事件 重载控件消息处理函数WindowProc(),在View->ClassWizard打开类向导,在消息映射找到WindowProc,如下图: 图五 重载WindowProc() 四、编写代码 编写VariantToLong()转换函数,该函数代码如下: //类型转换,将VARIANT类型转换成Long类型 long CMFCWinSockCtrl::VariantToLong(const VARIANT &var) { long r; switch(var.vt) { case VT_UI2://USHORT r = var.uiVal; break; case VT_UI4://ULONG r = var.ulVal; break; case VT_INT://INT r = var.intVal; break; case VT_UINT://UINT r = var.uintVal; break; case VT_I4://LONG r = var.lVal; break; case VT_UI1://BYTE r = var.bVal; break; case VT_I2://SHORT r = var.iVal; break; case VT_R4://FLOAT r = (long)var.fltVal; break; case VT_R8://DOUBLE r = (long)var.dblVal; break; default: r = -1;//无法转换该值 break; } return r; } 大家可以看到,该函数将最基本的若干数据类型转换成了long类型,但VARIANT决不是个简单的谱,我将在后面继续揭开它的神秘面纱. 编写我们刚才的接口Connect(),代码代码如下: 在MFCWinSockCtrl.h加入 SOCKET OnlySock;//建立的唯一Socket,不允许重复建立多个 bool isOnlyConnect;//是否建立了连接 然后再编写Connect(),看起来如下: BOOL CMFCWinSockCtrl::Connect(const VARIANT FAR& RemoteHost, const VARIANT FAR& RemotePort) { // TODO: Add your dispatch handler code here if(isOnlyConnect)//该连接已建立,还没有断开 return FALSE; CString IPAddress; int Port;//转换成整型的端口 switch(RemoteHost.vt) { case VT_BSTR://字符串型 IPAddress = CString(RemoteHost.bstrVal); break; case VT_BYREF|VT_I1://CHAR * IPAddress.Format("%s",RemoteHost.pcVal);//RemoteHost.pbstrVal); break; default: IPAddress = ""; return FALSE; } Port = VariantToLong(RemotePort);//我们编写的一个VARIANT转换成long类型的函数 if(Port<=0) return FALSE; _TCHAR *ip = 0; struct hostent *host = 0; struct sockaddr_in addr; ULONG dotIP = inet_addr(IPAddress); OnlySock = socket(AF_INET, SOCK_STREAM, 0); // 判断是否为点IP地址格式 if (OnlySock == INVALID_SOCKET) { shutdown(OnlySock, 0x02); closesocket(OnlySock);//释放占有的SOCK资源 return FALSE; } memset(&addr, 0, sizeof(struct sockaddr_in)); // 设定 SOCKADDR_IN 结构的内容 // 如果通讯协议是选择IP Protocol,那此值固定为AF_INET // AF_INET 与 PF_INET 这两个常量值相同 addr.sin_family = AF_INET; addr.sin_port = htons(Port); addr.sin_addr.S_un.S_addr = dotIP; if (dotIP == INADDR_NONE) { host = gethostbyname(IPAddress); if (!host) { shutdown(OnlySock, 0x02); closesocket(OnlySock);//释放占有的SOCK资源 return FALSE; }; ip = inet_ntoa(*(struct in_addr*)(*host->h_addr_list)); addr.sin_addr.S_un.S_addr = inet_addr(ip); } //开始连线 if (connect(OnlySock, (LPSOCKADDR)&addr, sizeof(SOCKADDR))) { shutdown(OnlySock, 0x02); closesocket(OnlySock);//释放占有的SOCK资源 return FALSE; } int iError = WSAAsyncSelect(OnlySock, m_hWnd,WM_MYWINSOCK, FD_READ|FD_CLOSE); //只对网络断开和数据到达通知感兴趣 if(iError == SOCKET_ERROR)//无法绑定Winsock的事件通知 { shutdown(OnlySock, 0x02); closesocket(OnlySock);//释放占有的SOCK资源 return FALSE; } isOnlyConnect = true; return TRUE; } 有必要提一下WSAAsyncSelect(),这里接收网络数据到达和断开的两个消息,我们收到WM_MYWINSOCK消息时将处理该消息并作为事件传送给调用者. 第二个参数,窗口句柄,我们传送了m_hWnd,这是因为MFC ActiveX也属于一个窗口,并且是可见的,因此可以成功。 编写WindowProc(),代码看起来如下: LRESULT CMFCWinSockCtrl::WindowProc(UINT message, WPARAM wParam, LPARAM lParam) { // TODO: Add your specialized code here and/or call the base class switch(message) { case WM_MYWINSOCK://响应自定义的消息 switch(WSAGETSELECTEVENT(lParam)) { case FD_READ://有新数据到达 FireRecvSockEvent(); break; case FD_CLOSE://对方已断掉当前连接 FireCloseWinsock(); break; } break; default: break; } return COleControl::WindowProc(message, wParam, lParam); } 本部分结束语: 好了,现在一个可以运行的控件已经完成,里面提供有Connect()和DisConnect()接口,和RecvSockEvent()及CloseWinsock()事件。以及WinSock的使用方法。 在下一部分(高级篇)将讲解两个重要接口SendData()和GetData(),下期内容如下: long SendData(const VARIANT FAR& Data, const VARIANT FAR& DataType,const VARIANT FAR& DataLength, const VARIANT FAR& TimeOut) long GetData(VARIANT FAR* Data, const VARIANT FAR& DataType, const VARIANT FAR& DataMaxLength, const VARIANT FAR& TimeOut) VARIANT和SAFEARRAY的复杂用法。 控件开发出来后在VC和VB环境下的使用方法。 声明: 部分资料来源于网络,本文所用的所有源代码仅供非商业用途,并请保留原版权,否则后果自负! 欢迎大家拍砖,或指正不足的地方,一起探导更好的方法。 欢迎访问www.59186618.com,感谢您的支持!
简介:SourceFormatX 源代码美化工具是一款专业的 多语言 源码美化工具, 源代码格式化工具, 源代码缩进排版工具 和企业级源代码风格统一化解决方案。其可以按照预设或自定义的源码风格全自动、大批量、精细地美化 C, C++, Java, C#, D Language, Pascal (Delphi), Visual Basic, VB.NET, VBScript, JavaScript (JScript), PHP, ASP, JSP, HTML, XML, HTML Components, CORBA IDL, 80x86 ASM, 8051 ASM 汇编等编程语言源代码。 拥有 SourceFormatX, 您可以在数秒种之内将任何源代码美化和转换成您最喜爱的代码风格或您开发团队的标准编码规范! 说明:终于找到 SourceFormatX 2.56 的注册破解版了。源代码美化工具SourceformatX破解版,一个传说不可能被破解的东东,现在完美破解了!!不管你是程序开发者,还是网页设计者,SF都能把你的凌乱代码规矩排列,值得收藏!! 附加: 【软件名称】: SourceFormatX 2.56 【使用工具】: Fi,Ollydbg,ImportREC 【破解平台】: Win2K Server 【软件简介】: SourceFormatX 是一个强大的源代码自动格式化,缩进,排版,美化工具。 它可以格式化 C, C++、Java、C#、Object Pascal、PHP、ASP、JSP、VB、 VB.NET、VBScript、JavaScript 和 HTML Components源代码。 它还可以将源代码输出为语法高亮显示的 HTML 或 RTF 文件。 【软件大小】: 731 KB 【编写语言】: Borland Delphi 5 【加壳方式】: PECompact 1.68 - 1.84 【保护方式】: 文件验证(License.dat)。 破解行为会激活恶意代码, 主要是删注册表的HKEY_CLASSES_ROOT整个分支。 删注册表是用RegDeleteValueA 。 作者把关键代码做成一个DLL, 将DLL文件的16进制码加密后生成一个注册文件, 密匙产生函数的参数是主程序加壳后的HASH码和机器信息。 已注册用户验证注册码时,先验证有没有文件, 没有文件则自然受限制的功能无法使用。 如果有注册文件,解密后即生成一个小临时文件。 如果主程序被脱壳或者被修改(爆破),自然Hash值密码不符, 解密出来的肯定都是垃圾码,没有一点用处。 只有没有被修改的主程序才能正确地解码, 而且当然只有解密正确的文件才是一个真正的DLL文件, 才能被GetProcAddress函数找到欲调用的关键函数地址。 这样只有注册用户能正常使用了。 【破解建议】: 安装 VMware ,否则, 作者很生气, 后果很严重 :) 【软件下载】: http://wh.onlinedown.net:88/down/sourceformatx256cn.exe /***********************************脱壳**************************************/ ; 跟踪到00625556处 00625556 C2 0400 retn 4 ; 此处就是OEP,记得脱壳后重建输入表,我用的是ImportREC 00573258 55 push ebp /********************************去掉OD检查***********************************/ ; 调用检查OD的函数 0057330F E8 002EFEFF call SourceFo.00556114 ... ... ; 将这里的 机器码 74(jz) 修改为 EB(jmp) 0055614C 74 23 jz short upSource.00556171 ; 调用检查OD的函数 005774EA E8 CDB4FFFF call SourceFo.005729BC ; 将这里的 机器码 74(jz) 修改为 EB(jmp) 005729F2 74 42 je short SourceFo.00572A36 ; 将这里的 机器码 74(jz) 修改为 EB(jmp) 0055F076 74 42 je short SourceFo.0055F0BA /*****************************去掉文件修改检查********************************/ ; 检查执行程序是否被修改 005774F4 E8 97B1FFFF call SourceFo.00572690 ; 将这里的 机器码 74(jz) 修改为 EB(jmp) 005723AC 74 55 je short SourceFo.00572403 ; 0044EA65 E8 A69BFFFF call SourceFo.00448610 0044861D 74 17 je short SourceFo.00448636 /*******************************去掉DeDe检查**********************************/ ; 将这里的 机器码 74(jz) 修改为 EB(jmp) 005727F4 74 28 je short SourceFo.0057281E 0055641C 74 28 je short SourceFo.00556446 /*****************************去掉Filemon检查*********************************/ ; 将这里的 机器码 74(jz) 修改为 EB(jmp) 005560C4 74 20 je short SourceFo.005560E6 /*****************************去掉Snacker检查*********************************/ ; 将这里的 机器码 74(jz) 修改为 EB(jmp) 005560ED 74 20 je short SourceFo.0055610F /*************************其他各类调试软件的驱动句柄检测**********************/ 00573314 E8 632CFEFF call SourceFo.00555F7C ; 关键CALL, 以 eax 传递参数, 005774EF B8 54885700 mov eax,SourceFo.00578854 ; ASCII "License.dat" 005774F4 E8 97B1FFFF call SourceFo.00572690 /****************************执行文件尺寸检查*********************************/ 0055F105 |. 6A 00 push 0 ; /pFileSizeHigh = NULL 0055F107 |. 8B45 FC mov eax,dword ptr ss:[ebp-4] ; | 0055F10A |. 50 push eax ; |hFile 0055F10B |. E8 D477EAFF call ; \GetFileSize ; 将这里的 机器码 3D A8421200 修改为 3D 00E02200(00902200) 0055F110 |. 3D A8421200 cmp eax,1242A8 0055F115 |. 7E 1F jle short SourceFo.0055F136 // ??? 0055EF71 75 1C jnz short SourceFo.0055EF8F /******************************修理非法用户***********************************/ 0055F117 |> /6A 03 /push 3 0055F119 |. |B8 B8F45500 |mov eax,SourceFo.0055F4B8 ; ASCII "048229125055114025094102049210040021027068051099091168132234034161018208011" 0055F11E |. |8D55 E8 |lea edx,dword ptr ss:[ebp-18] 0055F121 |. |E8 9625EFFF |call SourceFo.004516BC 0055F126 |. |8B45 E8 |mov eax,dword ptr ss:[ebp-18] 0055F129 |. |E8 124FEAFF |call SourceFo.00404040 0055F12E |. |50 |push eax ; |CmdLine 0055F12F |. |E8 4079EAFF |call ; \WinExec 0055F134 |.^\EB E1 \jmp short SourceFo.0055F117 ; 循环打开多个窗口 /****************************可疑*******************************/ 00412F4D |. 807D FF 00 cmp byte ptr ss:[ebp-1],0 00412F51 |. 74 0F je short SourceFo.00412F62 00412F53 |. E8 5803FFFF call SourceFo.004032B0 0041A524 |. 8D45 D4 lea eax,dword ptr ss:[ebp-2C] 0041A527 |. 50 push eax ; /pSystemInfo 0041A528 |. E8 0FC4FEFF call ; \GetSystemInfo 0041A52D |. 8B55 FC mov edx,dword ptr ss:[ebp-4] 0041A530 |. 8B4D F8 mov ecx,dword ptr ss:[ebp-8] 0041A533 |. 49 dec ecx 0041A534 |. 78 33 js short SourceFo.0041A569 0041A536 |. 8D45 D4 lea eax,dword ptr ss:[ebp-2C] 0041A539 |. 66:8378 20 03 cmp word ptr ds:[eax+20],3 0041A53E |. 74 10 je short SourceFo.0041A550 ; ??? 00412F21 |. 837B 04 00 cmp dword ptr ds:[ebx+4],0 00412F25 |. 7D 24 jge short SourceFo.00412F4B ; ??? 00412F4D |. 807D FF 00 cmp byte ptr ss:[ebp-1],0 00412F51 |. 74 0F je short SOURCEFO.00412F62 00412F53 |. E8 5803FFFF call SOURCEFO.004032B0 ; eax = "0123456789abcdeffedcba9876543210" 005096B0 |. 8D45 A4 lea eax,dword ptr ss:[ebp-5C] 005096B3 |. E8 3CFFFFFF call SourceFo.005095F4 ; 将这里的 机器码 3D 508D0F00 修改为 3D 00902200 00564168 . 3D 508D0F00 cmp eax,0F8D50 0056416D . 0F8E F7000000 jle SourceFo.0056426A 00564173 . 33D2 xor edx,edx ; 将这里的 机器码 3D 5F890F00 修改为 3D 00902200 00567DFC . 3D 5F890F00 cmp eax,0F895F 00567E01 . 7E 13 jle short SOURCEFO.00567E16 00567E03 . E8 50DDFEFF call SOURCEFO.00555B58 ; ??? 在打开文件License.dat之后多次调用 00412F53 |. E8 5803FFFF call SOURCEFO.004032B0
=========================================== TeeChart Pro Activex Control v2018 MS .NET COMPATIBILITY Copyright (c) 1997-2018 by Steema Software SL All Rights Reserved. http://www.steema.com email: info@steema.com supportx@steema.com =========================================== Document updated: June 2004 TeeChart Pro Activex Control MS Visual Studio .NET compatibility notes =========================================== Please see the release.txt release notes for bugfix and feature information about this release. =========================================== Changes for NET compatibility - The Chart.Series(xx) read-only property has been replaced by a Function method (affects only code written in VC++ and similar languages that make direct reference to Get_ and Set_ of properties). The new Series method (called Series) changes visibly by removal of the property 'Get_' element of the Function. The change is required due to a current MS.NET import restriction causing non-import of ActiveX properties that have an index parameter (only affects the root level of controls !). For a VB application no code change is necessary. Please see the following notes for other environments. The original property has been hidden in the interface and renamed to aSeries keeping its existing Dispid to support backward compatibility with applications compiled with previous releases of TeeChart 5. - The TChart OnSeriesBeforeAdd method uses a boolean variable called 'Continue'. "continue" is a keyword in C# (the language used to interim compile TeeChart namespace information in .NET). This had caused an import problem with the earlier releases of Visual Studio .NET. As a precaution we have chosen to rename the parameter to 'MoreValues' for the TeeChart Pro ActiveX Control. Notes on use: ------------- - Constant names in NET require full reference by default: eg. AxTChart1.AddSeries(TeeChart.ESeriesClass.scLine) Upgrading existing projects: ---------------------------- Upgrading existing Visual Studio projects works without manual intervention in code for most simple projects. Notable points relating to import: VISUAL BASIC project: ===================== - Designtime saved content of a Chart does not always successfully import to a NET project. We recommend you open the project first in its current environment (eg. Visual Basic v6) and provoke a change in the Chart and resave the project. That will update the saved frx Chart information data to v5.0.3. Then save the Chart content as a tee file by right-clicking the Chart and selecting 'Export'. Some projects 'may' then import the saved Chart correctly without further steps required. If the Chart content doesn't import successfully then right-click on the Chart and import the saved tee file. If the project fails to import, clear the Chart content after saving it to tee (remove and replace the Chart with an empty one) and re-import following the above step to later import the saved tee file. - Calls to interfaces not supported. In Visual Studio v6 and prior versions, it was possible to connect components by interface. eg. TeeCommander.Chart=TChart1 This is no longer possible. You should use the integer link: eg. TeeCommander.ChartLink=TChart1.ChartLink - Colour definition requires update TeeChart colours map as UInt32 when imported to NET. The colour definition when applied takes the following form: .Labels.Font.Color = System.Convert.ToUInt32(System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Cyan)) - Some event syntax is incorrect on import. Notably the Mouse events which are 'duplicated' by default NET appointed events. If you find event syntax to be incorrect, modify the syntax as follows: eg. Private Sub TChart1_OnMouseUpEvent(ByVal eventSender As System.Object, _ ByVal eventArgs As AxTeeChart.ITChartEvents_OnMouseUpEvent) _ Handles TChart1.OnMouseUp 'do something End Sub - Some form object (eg. Checkbox) events may fire before the Chart is loaded. That didn't occur in VB6 and will require a workaround in VB.NET if Chart properties are referenced in this way at Form load. eg. taken from VB Drag Points example: 'Check1.CheckStateChanged may fire when form is intialized Private Sub Check1_CheckStateChanged(ByVal eventSender As System.Object, _ ByVal eventArgs As System.EventArgs) _ Handles Check1.CheckStateChan ' switch 2D / 3D view... TChart1.Aspect.View3D = Check1.CheckState ' enable scroll-bar only in 3D... HScroll1.Enabled = Check1.CheckState End Sub In the above event the View3D line will fail as the Chart isn't yet loaded when the event is called. An option to workaround it may be to set a boolean 'OK_To_Run' variable to set after the first Chart Repaint. eg. OK_To_Run false on load and set to true in Form_Load event after Chart is populated, etc. Private Sub Check1_CheckStateChanged(ByVal eventSender As System.Object, _ ByVal eventArgs As System.EventArgs) _ Handles Check1.CheckStateChan ' switch 2D / 3D view... If OK_To_Run = True Then TChart1.Aspect.View3D = Check1.CheckState End if ' enable scroll-bar only in 3D... HScroll1.Enabled = Check1.CheckState End Sub Microsoft recommend a similar step (add a IsInitializing property to the Form). We'll be taking a closer look at these issues to see if we can recommend less demanding steps to resolve them. VISUAL C++ project: ===================== The Series declaration has changed. The easiest way to upgrade the project is to import TeeChart classes before upgrading the project to .NET. 1. All references to 'GetSeries(xx)' should be changed to 'Series(xx)' That will call the new Series method that returns the Series Interface (just as the predecesor property did). The Series property has been name changed to aSeries, retaining its DispId to support existing compiled applications. 2. The following is handled automatically if you import the TeeChart classes. For reference, the following changes occur to the Series declaration. *Note you should not need to do anything if you import TeeChart to your project. a) In the TChart.h Class header file the GetSeries declaration changes to: CSeries Series(long SeriesIndex); b) In the TChart.cpp Class impl. file the GetSeries declaration changes to: CSeries CTChart::Series(long SeriesIndex) { LPDISPATCH pDispatch; static BYTE parms[] = VTS_I4; InvokeHelper(0x14, DISPATCH_METHOD, VT_DISPATCH, (void*)&pDispatch;, parms, SeriesIndex); return CSeries(pDispatch); } Projects should then compile without issue. =========================================== Use of Strong Named Assemblies =========================================== If you compile Strong Named Assemblies then imported ActiveX Controls must also be Strong Named. The Utilities folder contains a Strong Name compiled version of: \Utilities\VS.NET\Strong Named DLLs - AxInterop.TeeChart.dll - TeeChart.dll They may be used to replace the automatically generated AxInterop.TeeChart.dll and Interop.TeeChart.dll created when TeeChart AX is added to a Windows Form. You should remove auto-generated dlls from the references list in the project Solution Explorer and from the Obj folder of the project and Debug or Release Bin folder. Then copy in the new Dlls to Obj and Bin folders and reference the new Dlls from their Obj folder location. =========================================== Please send us details about any other issues found to: http://www.teechart.net/support/modules.php?name=Forums Many thanks ! =========================================== http://www.steema.com support: http://www.teechart.net/support/modules.php?name=Forums -------------------------------------------
=========================================== TeeChart Pro Activex Control v2018 MS .NET COMPATIBILITY Copyright (c) 1997-2018 by Steema Software SL All Rights Reserved. http://www.steema.com email: info@steema.com supportx@steema.com =========================================== Document updated: June 2004 TeeChart Pro Activex Control MS Visual Studio .NET compatibility notes =========================================== Please see the release.txt release notes for bugfix and feature information about this release. =========================================== Changes for NET compatibility - The Chart.Series(xx) read-only property has been replaced by a Function method (affects only code written in VC++ and similar languages that make direct reference to Get_ and Set_ of properties). The new Series method (called Series) changes visibly by removal of the property 'Get_' element of the Function. The change is required due to a current MS.NET import restriction causing non-import of ActiveX properties that have an index parameter (only affects the root level of controls !). For a VB application no code change is necessary. Please see the following notes for other environments. The original property has been hidden in the interface and renamed to aSeries keeping its existing Dispid to support backward compatibility with applications compiled with previous releases of TeeChart 5. - The TChart OnSeriesBeforeAdd method uses a boolean variable called 'Continue'. "continue" is a keyword in C# (the language used to interim compile TeeChart namespace information in .NET). This had caused an import problem with the earlier releases of Visual Studio .NET. As a precaution we have chosen to rename the parameter to 'MoreValues' for the TeeChart Pro ActiveX Control. Notes on use: ------------- - Constant names in NET require full reference by default: eg. AxTChart1.AddSeries(TeeChart.ESeriesClass.scLine) Upgrading existing projects: ---------------------------- Upgrading existing Visual Studio projects works without manual intervention in code for most simple projects. Notable points relating to import: VISUAL BASIC project: ===================== - Designtime saved content of a Chart does not always successfully import to a NET project. We recommend you open the project first in its current environment (eg. Visual Basic v6) and provoke a change in the Chart and resave the project. That will update the saved frx Chart information data to v5.0.3. Then save the Chart content as a tee file by right-clicking the Chart and selecting 'Export'. Some projects 'may' then import the saved Chart correctly without further steps required. If the Chart content doesn't import successfully then right-click on the Chart and import the saved tee file. If the project fails to import, clear the Chart content after saving it to tee (remove and replace the Chart with an empty one) and re-import following the above step to later import the saved tee file. - Calls to interfaces not supported. In Visual Studio v6 and prior versions, it was possible to connect components by interface. eg. TeeCommander.Chart=TChart1 This is no longer possible. You should use the integer link: eg. TeeCommander.ChartLink=TChart1.ChartLink - Colour definition requires update TeeChart colours map as UInt32 when imported to NET. The colour definition when applied takes the following form: .Labels.Font.Color = System.Convert.ToUInt32(System.Drawing.ColorTranslator.ToOle(System.Drawing.Color.Cyan)) - Some event syntax is incorrect on import. Notably the Mouse events which are 'duplicated' by default NET appointed events. If you find event syntax to be incorrect, modify the syntax as follows: eg. Private Sub TChart1_OnMouseUpEvent(ByVal eventSender As System.Object, _ ByVal eventArgs As AxTeeChart.ITChartEvents_OnMouseUpEvent) _ Handles TChart1.OnMouseUp 'do something End Sub - Some form object (eg. Checkbox) events may fire before the Chart is loaded. That didn't occur in VB6 and will require a workaround in VB.NET if Chart properties are referenced in this way at Form load. eg. taken from VB Drag Points example: 'Check1.CheckStateChanged may fire when form is intialized Private Sub Check1_CheckStateChanged(ByVal eventSender As System.Object, _ ByVal eventArgs As System.EventArgs) _ Handles Check1.CheckStateChan ' switch 2D / 3D view... TChart1.Aspect.View3D = Check1.CheckState ' enable scroll-bar only in 3D... HScroll1.Enabled = Check1.CheckState End Sub In the above event the View3D line will fail as the Chart isn't yet loaded when the event is called. An option to workaround it may be to set a boolean 'OK_To_Run' variable to set after the first Chart Repaint. eg. OK_To_Run false on load and set to true in Form_Load event after Chart is populated, etc. Private Sub Check1_CheckStateChanged(ByVal eventSender As System.Object, _ ByVal eventArgs As System.EventArgs) _ Handles Check1.CheckStateChan ' switch 2D / 3D view... If OK_To_Run = True Then TChart1.Aspect.View3D = Check1.CheckState End if ' enable scroll-bar only in 3D... HScroll1.Enabled = Check1.CheckState End Sub Microsoft recommend a similar step (add a IsInitializing property to the Form). We'll be taking a closer look at these issues to see if we can recommend less demanding steps to resolve them. VISUAL C++ project: ===================== The Series declaration has changed. The easiest way to upgrade the project is to import TeeChart classes before upgrading the project to .NET. 1. All references to 'GetSeries(xx)' should be changed to 'Series(xx)' That will call the new Series method that returns the Series Interface (just as the predecesor property did). The Series property has been name changed to aSeries, retaining its DispId to support existing compiled applications. 2. The following is handled automatically if you import the TeeChart classes. For reference, the following changes occur to the Series declaration. *Note you should not need to do anything if you import TeeChart to your project. a) In the TChart.h Class header file the GetSeries declaration changes to: CSeries Series(long SeriesIndex); b) In the TChart.cpp Class impl. file the GetSeries declaration changes to: CSeries CTChart::Series(long SeriesIndex) { LPDISPATCH pDispatch; static BYTE parms[] = VTS_I4; InvokeHelper(0x14, DISPATCH_METHOD, VT_DISPATCH, (void*)&pDispatch;, parms, SeriesIndex); return CSeries(pDispatch); } Projects should then compile without issue. =========================================== Use of Strong Named Assemblies =========================================== If you compile Strong Named Assemblies then imported ActiveX Controls must also be Strong Named. The Utilities folder contains a Strong Name compiled version of: \Utilities\VS.NET\Strong Named DLLs - AxInterop.TeeChart.dll - TeeChart.dll They may be used to replace the automatically generated AxInterop.TeeChart.dll and Interop.TeeChart.dll created when TeeChart AX is added to a Windows Form. You should remove auto-generated dlls from the references list in the project Solution Explorer and from the Obj folder of the project and Debug or Release Bin folder. Then copy in the new Dlls to Obj and Bin folders and reference the new Dlls from their Obj folder location. =========================================== Please send us details about any other issues found to: http://www.teechart.net/support/modules.php?name=Forums Many thanks ! =========================================== http://www.steema.com support: http://www.teechart.net/support/modules.php?name=Forums -------------------------------------------

16,556

社区成员

发帖
与我相关
我的任务
社区描述
VB技术相关讨论,主要为经典vb,即VB6.0
社区管理员
  • VB.NET
  • 水哥阿乐
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧