473,394 Members | 1,893 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

VB.NET and EM_STREAMOUT

I am trying to use the EM_STREAMOUT message to get RichEdit Control data from
another application. I have found several examples on the web for C++ and
C#. I have tried to convert them, but the call always crashes the window I
am trying to get the data from. Does anybody know where I can find a clear
cut example for VB.NET?

I've tried a several scenarios for the data types and ByRef for the pcb
parameter. Here's what I have right now.

Public Declare Auto Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hwnd As IntPtr, ByVal msg As Integer, ByVal wParam As Integer, ByRef
lParam As EDITSTREAM) As IntPtr

Delegate Function EditStreamCallback(ByVal dwCookie As Int32, ByVal pbBuff
As Int32, ByVal cb As Int32, ByVal pcb As Int32) As Int32

Structure EDITSTREAM
Public dwCookie As Int32
Public dwError As Int32
Public pfnCallback As EditStreamCallback
End Structure

Dim eData As EDITSTREAM
'eData.dwCookie = IntPtr.Zero
eData.dwCookie = frmMainUI.txtReturnBox.Handle.ToInt32
eData.dwError = 0
eData.pfnCallback = AddressOf handleRichEditCallback
SendMessage(hReturn, EM_STREAMOUT, 1, eData) ' this call crashes
window with handle hReturn
SendMessage(hReturn, EM_SETMODIFY, 1, 0)

' This callback function never gets triggered
Public Function handleRichEditCallback(ByVal dwCookie As Int32, ByVal pbBuff
As Int32, ByVal cb As Int32, ByVal pcb As Int32) As Int32
MsgBox("Cool")
End Function

Nov 21 '05 #1
2 2572
Hi

I know its not exactly what you are looking for, but its sort of there.
Navigate to:

http://www.msde.biz/vbnetfaq.htm

Scroll down the page & look for the example called 'Using the Char2Format
Structure in VB .NET for Highlighting Text'

It just highlights the text & chages it to red, but shouldn't be too much
trouble to convert it

"Shawn G." wrote:
I am trying to use the EM_STREAMOUT message to get RichEdit Control data from
another application. I have found several examples on the web for C++ and
C#. I have tried to convert them, but the call always crashes the window I
am trying to get the data from. Does anybody know where I can find a clear
cut example for VB.NET?

I've tried a several scenarios for the data types and ByRef for the pcb
parameter. Here's what I have right now.

Public Declare Auto Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hwnd As IntPtr, ByVal msg As Integer, ByVal wParam As Integer, ByRef
lParam As EDITSTREAM) As IntPtr

Delegate Function EditStreamCallback(ByVal dwCookie As Int32, ByVal pbBuff
As Int32, ByVal cb As Int32, ByVal pcb As Int32) As Int32

Structure EDITSTREAM
Public dwCookie As Int32
Public dwError As Int32
Public pfnCallback As EditStreamCallback
End Structure

Dim eData As EDITSTREAM
'eData.dwCookie = IntPtr.Zero
eData.dwCookie = frmMainUI.txtReturnBox.Handle.ToInt32
eData.dwError = 0
eData.pfnCallback = AddressOf handleRichEditCallback
SendMessage(hReturn, EM_STREAMOUT, 1, eData) ' this call crashes
window with handle hReturn
SendMessage(hReturn, EM_SETMODIFY, 1, 0)

' This callback function never gets triggered
Public Function handleRichEditCallback(ByVal dwCookie As Int32, ByVal pbBuff
As Int32, ByVal cb As Int32, ByVal pcb As Int32) As Int32
MsgBox("Cool")
End Function

Nov 21 '05 #2
Hi

I know its not exactly what you are looking for, but its sort of there.
Navigate to:

http://www.msde.biz/vbnetfaq.htm

Scroll down the page & look for the example called 'Using the Char2Format
Structure in VB .NET for Highlighting Text'

It just highlights the text & chages it to red, but shouldn't be too much
trouble to convert it

"Shawn G." wrote:
I am trying to use the EM_STREAMOUT message to get RichEdit Control data from
another application. I have found several examples on the web for C++ and
C#. I have tried to convert them, but the call always crashes the window I
am trying to get the data from. Does anybody know where I can find a clear
cut example for VB.NET?

I've tried a several scenarios for the data types and ByRef for the pcb
parameter. Here's what I have right now.

Public Declare Auto Function SendMessage Lib "user32" Alias "SendMessageA"
(ByVal hwnd As IntPtr, ByVal msg As Integer, ByVal wParam As Integer, ByRef
lParam As EDITSTREAM) As IntPtr

Delegate Function EditStreamCallback(ByVal dwCookie As Int32, ByVal pbBuff
As Int32, ByVal cb As Int32, ByVal pcb As Int32) As Int32

Structure EDITSTREAM
Public dwCookie As Int32
Public dwError As Int32
Public pfnCallback As EditStreamCallback
End Structure

Dim eData As EDITSTREAM
'eData.dwCookie = IntPtr.Zero
eData.dwCookie = frmMainUI.txtReturnBox.Handle.ToInt32
eData.dwError = 0
eData.pfnCallback = AddressOf handleRichEditCallback
SendMessage(hReturn, EM_STREAMOUT, 1, eData) ' this call crashes
window with handle hReturn
SendMessage(hReturn, EM_SETMODIFY, 1, 0)

' This callback function never gets triggered
Public Function handleRichEditCallback(ByVal dwCookie As Int32, ByVal pbBuff
As Int32, ByVal cb As Int32, ByVal pcb As Int32) As Int32
MsgBox("Cool")
End Function

Nov 21 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: mork | last post by:
I'm having a tought time wrapping ym head around implementing EM_STRAMOUT It requires a callback function which is repeadely called and passed a buffer which is a portion of the richedit's...
1
by: Patty O'Dors | last post by:
I've heard the phrase "streaming data into a rich text box" and I want to know whether it means what I hope it means. What I hope it means, is that if the user pastes a whole load of text into...
1
by: Patty O'Dors | last post by:
I've heard the phrase "streaming data into a rich text box" and I want to know whether it means what I hope it means. What I hope it means, is that if the user pastes a whole load of text into...
0
by: Shawn G. | last post by:
I am trying to use the EM_STREAMOUT message to get RichEdit Control data from another application. I have found several examples on the web for C++ and C#. I have tried to convert them, but the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.