473,804 Members | 3,958 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Diffence between CreateThread and AfxBeginThread

raj
Hi,
I just want to know the difference between thread created by
CreateThread and AfxBeginThread function. I got one problem when using
the CreateThread. The appliction malfunction while using the
CreateThread. So is that a problem with this function?

Thanks in advance
Rajat

Dec 8 '05 #1
3 15792
Geo

raj wrote:
Hi,
I just want to know the difference between thread created by
CreateThread and AfxBeginThread function. I got one problem when using
the CreateThread. The appliction malfunction while using the
CreateThread. So is that a problem with this function?

Thanks in advance
Rajat


Standard C++ has no notion of, nor support for threads in any way, you
would be better of in an OS specific newsgroup.

Dec 8 '05 #2
raj wrote:
Hi,
I just want to know the difference between thread created by
CreateThread and AfxBeginThread function. I got one problem when using
the CreateThread. The appliction malfunction while using the
CreateThread. So is that a problem with this function?

Thanks in advance
Rajat


The former is a system call API and the latter is an equivalent that
works together with the MFC framework.

Ben
Dec 8 '05 #3
"raj" <ra*****@gmail. com> wrote in news:1134049498 .646468.220340
@g44g2000cwa.go oglegroups.com:
Hi,
I just want to know the difference between thread created by
CreateThread and AfxBeginThread function. I got one problem when using
the CreateThread. The appliction malfunction while using the
CreateThread. So is that a problem with this function?

Thanks in advance
Rajat


In microsoft.publi c.vc.mfc they could have told you that

AfxBeginThread sets up MFC stuff, then calls
_beginthreadex which sets up CRT stuff, then calls
::CreateThread, which is a Win32 API and really creates the thread.

MFC has all kinds of data structures which need to be switched on a per-
thread basis. AfxBeginThread takes care of setting this up. If you call
::CreateThread "behind the back" of MFC, things will not work.

Now, what was your C++ question ?

--
Life is complex, with real and imaginary parts.
Dec 14 '05 #4

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

Similar topics

3
6713
by: Liu Ju | last post by:
Dear members: I want to use the multithread in my program which is developed in Visual C++ platform (version 6). I created a controlling function: UINT CCOMM1Dlg::WritingThreadFunc(LPVOID pParam) for a thread The reason that I want it to belong to the class CCOMM1Dlg is that in this function I need to process some member variables of the class.
2
1824
by: Praveen | last post by:
Hi, Hi I am a newbie in DB2 and Mainframe.I would like to know if there is any diffence between the Quantified Predicates: IN , ANY, and SOME. Thank you very much for your valuable time. Regards, Praveen.
1
6548
by: phark52 | last post by:
My main app calls LoadLibrary() to load a DLL, which calls CreateThread(). This does NOT return NULL and I get a thread ID. However, ThreadProc never gets executed when this code is in the DLL. It works fine in the standalone EXE source. I put example code below. #define MB(msg) MessageBox(0, msg, "", MB_OK|MB_ICONINFORMATION); DWORD APIENTRY tproc() {
5
4192
by: Vinayak Raghuvamshi | last post by:
Threads created using the CreateThread API used to leak memory if you accesed any crt methods within the thread proc. we used to use _beginthread to work around this issue. Does anyone know if this has been fixed ? -Vinayak
2
2349
by: phenrol | last post by:
Hello, I am having issues getting my worker thread to function properly. I am working with visual c++ 6 and I am unsure that this is the correct forum to post in but I could not find another that seemed to better suit my question. I am trying to initiate a thread to populate a list box when I click on a button. Once I figure out I will be populating the list box with more complex code, but if I can't even get this to work, I can't move...
3
8514
by: mccanaveras | last post by:
Hello, I need to implement a Thread in a Visual C++ 6.0 application. I've never done this, then I've been investigating, but I don't have any properly solution. One of them is use CWinThread to comunicate to a Dialog but it has been already created. And the other possibility is create a thread with the function CreateThread(), but it gives me an error in the third parameter: error C2664: 'CreateThread' : cannot convert parameter 3...
0
1311
by: liamacheung | last post by:
Hi, I am designing a GUI application using a VC++ 2005 Form template. I have created a thread function external to the class containing the form. I can successfully create the thread and run operations in the thread function, but I want to be able to call member functions in the Form from the thread process. In order to do this, I plan on passing a pointer to the object (i.e. the form) as one of the CreateThread parameters. My...
5
8081
by: eagerlearner | last post by:
Hallo, when I use class and I put one of the member function as the CreateThread argument, I keep getting the compile error in Visual Studio 2005. #include <windows.h> class X { public: void f(); void s(){}; };
3
7198
by: sevak316 | last post by:
This must be an easy question. I am trying to create a thread in windows. I am using C as my language. I am trying to pass a function to the CreateThread function to create a thread. My function has a return type void and paratmeter is void as well. How do I approach this? Is it something like this? static void run() { myThread = CreateThread(
0
9707
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9585
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10586
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, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10338
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10082
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9161
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7622
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
2
3823
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2997
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.