multithreading in vb

Posted on 2002-07-03
Last Modified: 2010-05-02
is it possible to do multithreading in vb?
if yes then i want to develop mail server which is able to respond to more than one client at a time?
is that possible?
for example, smtp is listening on 25 and pop3 on 110, if one client is sending a big mail which may take one minute then is smtp / pop3 able to respond to other e-mail clients in that particular one minute

please reply soon
thank you very much
hemali sutaria
Question by:hemalisutaria
LVL 142

Expert Comment

by:Guy Hengel [angelIII / a3]
ID: 7126605

Expert Comment

ID: 7127113
LVL 18

Accepted Solution

mdougan earned 200 total points
ID: 7132084
Under VB5 it was possible to multi-thread by calling the CreateThread windows API.  However, under VB 6, they changed the threading model of VB so that calls to CreateThread causes your program to crash.

The only way to do this under VB 6 is to call a component that is written in some other multi-threading language, such as C or C++, which will generate/manage the threads.

I've seen some references to OCX controls for doing just this, so, try searching the web for multi-threading OCX.

I believe that Desiware has one, for a start, but theirs might be somewhat expensive.
Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

LVL 49

Expert Comment

ID: 7971412
Hi hemalisutaria,
It appears that you have forgotten this question. I will ask Community Support to close it unless you finalize it within 7 days. I will ask a Community Support Moderator to:

    Accept mdougan's comment(s) as an answer.

hemalisutaria, if you think your question was not answered at all or if you need help, just post a new comment here; Community Support will help you.  DO NOT accept this comment as an answer.

EXPERTS: If you disagree with that recommendation, please post an explanatory comment.
DanRollins -- EE database cleanup volunteer

Expert Comment

ID: 8019144
I disagree with the recommendation so I will leave this open.  It appears on the surface that the application provided by rpai's link provides multi-threading and it indicates it works in VB6.  This leads me to believe it may be possible and perhaps even angelIIIs code may also work.  Will somebody please give these a shot and let me know one way or the other.  Thanks, it will be very much appreciated.  I'll give this the standard 3 day waiting period.  After which, upon not hearing from anyone, I intend to PAQ without a refund.

Community Support Moderator @Experts Exchange
LVL 49

Expert Comment

ID: 8020998
My $0.02:

From the thread posted by AngelIII:
>> VB6 is much less thread-safe than VB5. The Msgbox function, for example, is notoriously unsafe for threading.

From the thread posted by rpai:
>> Unfortunately there is a reason why this code isn't already posted here on PSC, this is because this code tends to make VB *very* unstable...
In my eyes, that make mdougan's recommendation the best and most complete answer (the others did not mention this apparently well-documented instability at all).  But I'm not an expert, just a day laborer with aspirations.

-- Dan

Expert Comment

ID: 8095769
per initial recommendation

Community Support Moderator @Experts Exchange

Featured Post

Gigs: Get Your Project Delivered by an Expert

Select from freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely and get projects done right.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction In a recent article ( for the Excel community, I showed an improved version of the Excel Concatenate() function.  While writing that article I realized that no o…
When trying to find the cause of a problem in VBA or VB6 it's often valuable to know what procedures were executed prior to the error. You can use the Call Stack for that but it is often inadequate because it may show procedures you aren't intereste…
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…

816 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

10 Experts available now in Live!

Get 1:1 Help Now