Home All Groups Group Topic Archive Search About

start new thread help

Author
9 Jul 2006 8:52 PM
Galen Somerville
Tooo many examples. I'm confused.

VB6 ActiveX.dll with no windows or controls. Interfaces with a device that
returns an x size byte array every x milliseconds for x counts. Sends a
message to VB2005 main thread on each count.

VB2005 has to start the thread and set several variables in the thread
before loop starts.

VB2005 then has to respond to messages and draw on screen until last count
is recieved.

VB2005 then stops thread. Thread will be started and stopped numerous times.

It's the starting and stopping the dll thread that has me befuddled.

Code anyone? A link to proper help?

Galen

Author
10 Jul 2006 9:37 AM
Luke Zhang [MSFT]
Hello Galen,

I think we may first make the question clear, so that we can just be on the
right track :)

As I understand, you have a VB .NET 2005 winform project and it calls a VB
6.0 ActiveX DLL component. The DLL component will communicate with a device
to gather data, then send messages to the winform application. In the
Winform application, you need to start a thread to handle these
message/data and display on the form.

But I still have some unclear:

1. How did you send message from  ActiveX DLL to winform application?
2. What is the actual issue, start a .NET thread or communicate with the
ActiveX DLL?

Regards,

Luke Zhang
Microsoft Online Community Lead

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Author
10 Jul 2006 2:34 PM
Galen Somerville
> 1. How did you send message from  ActiveX DLL to winform application?

In dll compiled with "Unattended execution" and "Retained in Memory"
Const WM_COPYDATA = &H4A
Private Type COPYDATASTRUCT
    dwData As Long
    cbData As Long
    lpData As Long
End Type
Private Declare Function SendMessage Lib "user32" Alias "SendMessageA" _
    (ByVal hWnd As Long, ByVal wMsg As Long, ByVal wParam As Long, lParam As
Any) As Long

Public Property Let WinHandle(ByVal value As Long)
    gHwnd = value
End Property

Public Sub SendData(ByVal hWnd As Long, ByRef data() As Byte)
Dim cds As COPYDATASTRUCT
    cds.cbData = UBound(data) - LBound(data) + 1
    cds.lpData = VarPtr(data(0))
    SendMessage ByVal hWnd, WM_COPYDATA, ByVal hWnd, cds
End Sub

And finally in Loop
            SendData gHwnd, DatAry

> 2. What is the actual issue, start a .NET thread or communicate with the
> ActiveX DLL?
Yes. How do I start the separate thread and send it some data before the
data gathering loop starts.

Galen

Show quoteHide quote
"Luke Zhang [MSFT]" <lukez***@online.microsoft.com> wrote in message
news:Nk4bGSApGHA.4612@TK2MSFTNGXA01.phx.gbl...
> Hello Galen,
>
> I think we may first make the question clear, so that we can just be on
> the
> right track :)
>
> As I understand, you have a VB .NET 2005 winform project and it calls a VB
> 6.0 ActiveX DLL component. The DLL component will communicate with a
> device
> to gather data, then send messages to the winform application. In the
> Winform application, you need to start a thread to handle these
> message/data and display on the form.
>
> But I still have some unclear:
>
> 1. How did you send message from  ActiveX DLL to winform application?
> 2. What is the actual issue, start a .NET thread or communicate with the
> ActiveX DLL?
>
> Regards,
>
> Luke Zhang
> Microsoft Online Community Lead
>
> ==================================================
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================
>
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
Author
11 Jul 2006 5:42 AM
Luke Zhang [MSFT]
Hello Galen,

Did you want to start the thread from winform application, or the ActiveX
DLL? If it is winform application, you may consider the Thread class in
.NET or BackgroundWorker Class ( new in .NET framework 2.0):

http://msdn2.microsoft.com/en-us/library/system.componentmodel.backgroundwor
ker.aspx

If you want pass some data into a thread, you may use some public variant
which can be accessed in a thread.

Regards,

Luke Zhang
Microsoft Online Community Lead

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)
Author
11 Jul 2006 2:29 PM
Galen Somerville
The thread will start from the winform application. I will look at the
BachgroundWorker class.

Your coworker Walter Wang is looking at other aspects of my problem.

Galen

Show quoteHide quote
"Luke Zhang [MSFT]" <lukez***@online.microsoft.com> wrote in message
news:KhBzSzKpGHA.4612@TK2MSFTNGXA01.phx.gbl...
> Hello Galen,
>
> Did you want to start the thread from winform application, or the ActiveX
> DLL? If it is winform application, you may consider the Thread class in
> NET or BackgroundWorker Class ( new in .NET framework 2.0):
>
> http://msdn2.microsoft.com/en-us/library/system.componentmodel.backgroundwor
> ker.aspx
>
> If you want pass some data into a thread, you may use some public variant
> which can be accessed in a thread.
>
> Regards,
>
> Luke Zhang
> Microsoft Online Community Lead
>
> ==================================================
> When responding to posts, please "Reply to Group" via your newsreader so
> that others may learn and benefit from your issue.
> ==================================================
>
> (This posting is provided "AS IS", with no warranties, and confers no
> rights.)
>
Author
12 Jul 2006 6:08 AM
Luke Zhang [MSFT]
Hi Galen,

Thank you for the information. I will talk to Walter on the backgroud
informaiton of this issue. If you have any questions, please feel free to
post here , or another with Walter.

Regards,

Luke Zhang
Microsoft Online Community Lead

==================================================
When responding to posts, please "Reply to Group" via your newsreader so
that others may learn and benefit from your issue.
==================================================

(This posting is provided "AS IS", with no warranties, and confers no
rights.)