Click here to Skip to main content
16,005,128 members
Home / Discussions / Visual Basic
   

Visual Basic

 
QuestionTranslating C# to VB.NET [modified] Pin
Steven J Jowett24-Aug-06 3:45
Steven J Jowett24-Aug-06 3:45 
AnswerRe: Translating C# to VB.NET Pin
BalasahebK24-Aug-06 3:50
BalasahebK24-Aug-06 3:50 
GeneralRe: Translating C# to VB.NET Pin
Steven J Jowett24-Aug-06 4:19
Steven J Jowett24-Aug-06 4:19 
AnswerRe: Translating C# to VB.NET Pin
Dave Kreskowiak24-Aug-06 5:15
mveDave Kreskowiak24-Aug-06 5:15 
QuestionProcess Communication VB6 to VB.Net [modified] Pin
Michael Andersson24-Aug-06 3:26
Michael Andersson24-Aug-06 3:26 
AnswerRe: Process Communication VB6 to VB.Net Pin
Dave Kreskowiak24-Aug-06 5:13
mveDave Kreskowiak24-Aug-06 5:13 
GeneralRe: Process Communication VB6 to VB.Net Pin
Michael Andersson24-Aug-06 22:17
Michael Andersson24-Aug-06 22:17 
GeneralRe: Process Communication VB6 to VB.Net [modified] Pin
Michael Andersson25-Aug-06 2:12
Michael Andersson25-Aug-06 2:12 
Ok i can see i had made some mistakes in my code. the structure passed has to be a certain type. I've changed this to
'VB6
Private Type COPYDATASTRUCT
dwData As Long ' ID for this msg
cbData As Long ' number of bytes
lpData As Long ' address of data
End Type

'VB.Net
<System.Runtime.InteropServices.StructLayoutSystem.Runtime.InteropServices.LayoutKind.Sequential)> _
Private Structure COPYDATASTRUCT
Public dwData As IntPtr
Public cbData As Integer
Public lpData As Integer
End Structure


My code when sending the message from VB6 is now:
Dim s As String
s = "hello"
Dim cds As COPYDATASTRUCT
cds.dwData = 1
cds.cbData = LenB(s)
cds.lpData = StrPtr(s)
Call SendMessage(hwndTarget, WM_COPYDATA, 0, cds)

and my code when handling the message in .NET is still abit uncertain
i can get some of the string but i also get some garbage along with it.

Dim cds As COPYDATASTRUCT = New COPYDATASTRUCT()
cds = Marshal.PtrToStructure(m.LParam, cds.GetType())
Dim s As String = Marshal.PtrToStringUni(cds.lpData, cds.cbData)

when running this code s becomes:
"hello&#32846;&#37830;&#30676;&#37765;&#30676;"

anyone know why?




-- modified at 4:47 Monday 28th August, 2006
GeneralRe: Process Communication VB6 to VB.Net Pin
Michael Andersson25-Aug-06 3:54
Michael Andersson25-Aug-06 3:54 
GeneralRe: Process Communication VB6 to VB.Net Pin
Dave Kreskowiak25-Aug-06 5:45
mveDave Kreskowiak25-Aug-06 5:45 
Questionshow/Hide parts of page with a +...? [modified] Pin
ii_noname_ii24-Aug-06 3:08
ii_noname_ii24-Aug-06 3:08 
AnswerRe: show/Hide parts of page with a +...? Pin
ii_noname_ii27-Aug-06 21:00
ii_noname_ii27-Aug-06 21:00 
QuestionSetting image in RichTextBox Pin
manish2424-Aug-06 2:29
manish2424-Aug-06 2:29 
Questionthe.net aseembly "crystalDecisions.windows.form" Pin
saneng24-Aug-06 2:23
saneng24-Aug-06 2:23 
QuestionHow to Launch MSWORD in VB.NET? Pin
lordkaile24-Aug-06 1:47
lordkaile24-Aug-06 1:47 
AnswerRe: How to Launch MSWORD in VB.NET? Pin
Christian Graus24-Aug-06 1:56
protectorChristian Graus24-Aug-06 1:56 
Questionlaunching an External application Pin
chepps24-Aug-06 0:10
chepps24-Aug-06 0:10 
AnswerRe: launching an External application Pin
Christian Graus24-Aug-06 1:58
protectorChristian Graus24-Aug-06 1:58 
GeneralRe: launching an External application Pin
chepps24-Aug-06 2:42
chepps24-Aug-06 2:42 
QuestionHow to limit the usage of CPU? Pin
cylix200024-Aug-06 0:04
cylix200024-Aug-06 0:04 
AnswerRe: How to limit the usage of CPU? Pin
Dave Kreskowiak24-Aug-06 5:08
mveDave Kreskowiak24-Aug-06 5:08 
QuestionHow to ask user to install .NET framework? Pin
cylix200024-Aug-06 0:04
cylix200024-Aug-06 0:04 
AnswerRe: How to ask user to install .NET framework? Pin
Christian Graus24-Aug-06 1:59
protectorChristian Graus24-Aug-06 1:59 
QuestionHowto with a textbox? [modified] Pin
Phantisy23-Aug-06 23:32
Phantisy23-Aug-06 23:32 
AnswerRe: Howto with a textbox? Pin
mr_lasseter24-Aug-06 2:27
mr_lasseter24-Aug-06 2:27 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.