I am trying to convert a method from VB6 to VB.NET and having some issues with StrPtr and VarPtr not being supported in VB.NET anymore. Here is the method having a problem. From what I know, I am looking to get the memory location of the objects to pass to the SendMessageCDS( ) method. Any ideas what I can do to fix it? I am a C# developer trying to work in VB and can use all the help I can get! Thanks in advance!
The reason for me needing to do this is that I was given some OLD VB6 code to send/receive messages via DDE. I am trying to get my new C#.NET application to be able to talk with an application similar to this and am having problems. In trying to emulate this code in C#, I am finding a lot of gaps that I am trying to fill in. Any help is appreciated!
The reason for me needing to do this is that I was given some OLD VB6 code to send/receive messages via DDE. I am trying to get my new C#.NET application to be able to talk with an application similar to this and am having problems. In trying to emulate this code in C#, I am finding a lot of gaps that I am trying to fill in. Any help is appreciated!
Code:
Public Structure COPYDATASTRUCT Dim dwData As Integer Dim cbData As Integer Dim lpData As Integer End Structure Public Declare Function SendMessageCDS Lib "user32" Alias "SendMessageA"(ByVal hWnd As Integer, ByVal wMsg As Integer, ByVal wParam As Integer, ByVal lParam As Integer) As Integer Public Sub SendMsg(ByRef i_sMessage As String) On Error GoTo ErrorHandler Dim cds As COPYDATASTRUCT Dim sMessage As String cds.dwData = 0 cds.cbData = Len(i_sMessage) sMessage = StrConv(i_sMessage, VbStrConv.None) 'UPGRADE_ISSUE: StrPtr function is not supported. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1040"' cds.lpData = StrPtr(sMessage) 'UPGRADE_ISSUE: VarPtr function is not supported. Click for more: 'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1040"' Call SendMessageCDS(m_lhWndGlue, WM_COPYDATA, m_lhWndMe, VarPtr(cds)) Exit Sub
Comment