473,398 Members | 2,343 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,398 software developers and data experts.

start new thread help

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
Jul 9 '06 #1
5 1529
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.)

Jul 10 '06 #2
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

"Luke Zhang [MSFT]" <lu******@online.microsoft.comwrote in message
news:Nk**************@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.)

Jul 10 '06 #3
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/lib....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.)

Jul 11 '06 #4
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

"Luke Zhang [MSFT]" <lu******@online.microsoft.comwrote in message
news:Kh**************@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/lib....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.)

Jul 11 '06 #5
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.)

Jul 12 '06 #6

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

Similar topics

7
by: VMI | last post by:
In the following code, how can I display the MessageBox once MyThread has finished executing? updateFiles method copies 5 humongous files to the HDD but for some reason, the MessageBox is displayed...
3
by: Dale Lundgren | last post by:
I have a c# class library that launches a Win Form in a secondary thread. From the Form (now running in the secondary thread) I need to be able to start a method that is defined in the class and...
16
by: Serdar Kalaycý | last post by:
Hi everybody, My problem seems a bit clichè but I could not work around. Well I read lots of MSDN papers and discussions, but my problem is a bit different from them. When I tried to run the...
9
by: Tim D | last post by:
Hi, I originally posted this as a reply to a rather old thread in dotnet.framework.general and didn't get any response. I thought it might be more relevant here; anyone got any ideas? My...
5
by: tonyreynolds | last post by:
I have an asp.net application that needs to spawn a new thread but return the response back to the user before the thread finishes. My application works fine on my machine (XP pro) and on a win...
7
by: Mark B | last post by:
Hi I was wondering if someone could help me with the syntax for some VB.Net ASPX code to: - Start 20 threads - End all threads after the sooner of 10 seconds or if all of the threads...
5
by: taylorjonl | last post by:
I am completely baffled. I am writting a daemon application for my work to save me some time. The application works fine at my home but won't work right here at work. Basically I have a...
10
by: Doug Robertson | last post by:
First off, I'm a hardware/OS guy. I just write code on the side and I'm completely self taught - so bear in mind my total lack of expertise. I have a program originally written in VB2003 using...
1
by: Mike | last post by:
Hi All, I'm using vb.net as my codebehind lang. and the following code is being executed in my aspx.vb page to stamp a DB row. Dim oStatsInfo As New StatsInfo(CartID, Batch, Set, Num, 0, 0, 0,...
7
by: Brent | last post by:
Page1.aspx calls Page2.aspx like this: ---------------- Server.Execute("Page2.aspx"); --------------- Page2.aspx's Page_Load event calls a function, getMsgs().This function runs normally...
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: 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
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.