Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C / C++ / MFC
  4. How to use threads?

How to use threads?

Scheduled Pinned Locked Moved C / C++ / MFC
tutorialquestionlearning
9 Posts 6 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • K Offline
    K Offline
    KongHL
    wrote on last edited by
    #1

    Hi, I'm a beginner in using threads. I have a dll which I have to pass in some parameters, which i will call at a pt of the application. But i would like to allow the user to be able to quit the application even in the midst of the dll operation. So i shld use a thread rite? but I am not sure how abt going it. how am i going to use the AfxBeginThread??

    S L H E 4 Replies Last reply
    0
    • K KongHL

      Hi, I'm a beginner in using threads. I have a dll which I have to pass in some parameters, which i will call at a pt of the application. But i would like to allow the user to be able to quit the application even in the midst of the dll operation. So i shld use a thread rite? but I am not sure how abt going it. how am i going to use the AfxBeginThread??

      S Offline
      S Offline
      Stephen Hewitt
      wrote on last edited by
      #2

      This is a broad and complex issue. Steve

      K 1 Reply Last reply
      0
      • S Stephen Hewitt

        This is a broad and complex issue. Steve

        K Offline
        K Offline
        KongHL
        wrote on last edited by
        #3

        I mean shld i use user-interface or worker thread? or do u have any reference to recommend me?

        T 1 Reply Last reply
        0
        • K KongHL

          Hi, I'm a beginner in using threads. I have a dll which I have to pass in some parameters, which i will call at a pt of the application. But i would like to allow the user to be able to quit the application even in the midst of the dll operation. So i shld use a thread rite? but I am not sure how abt going it. how am i going to use the AfxBeginThread??

          L Offline
          L Offline
          Laxman Auti
          wrote on last edited by
          #4

          Use the following definition format for the THread procedure UINT Threadproc(LPVOID pparam){return 0;} and call the thread as AfxBeginThread(Threadproc,this); Remember this is worker thread Knock out 't' from can't, You can if you think you can :cool:

          S 1 Reply Last reply
          0
          • L Laxman Auti

            Use the following definition format for the THread procedure UINT Threadproc(LPVOID pparam){return 0;} and call the thread as AfxBeginThread(Threadproc,this); Remember this is worker thread Knock out 't' from can't, You can if you think you can :cool:

            S Offline
            S Offline
            Stephen Hewitt
            wrote on last edited by
            #5

            Telling someone how to start a thread without mentioning threading issues such as synchronisation is like giving a child a gun to play with. I don’t mean any disrespect to the person who asked the question by saying this; but writing multithreaded programs is hard and full of potential pitfalls that simply don’t exist in a single threaded application. For example, even something as simple as incrementing a counter is potentially dangerous in a multithreaded program. Steve

            1 Reply Last reply
            0
            • K KongHL

              Hi, I'm a beginner in using threads. I have a dll which I have to pass in some parameters, which i will call at a pt of the application. But i would like to allow the user to be able to quit the application even in the midst of the dll operation. So i shld use a thread rite? but I am not sure how abt going it. how am i going to use the AfxBeginThread??

              H Offline
              H Offline
              Hamid Taebi
              wrote on last edited by
              #6

              See Here[^]maybe it is some helpful to you_**


              **_

              whitesky


              T 1 Reply Last reply
              0
              • K KongHL

                I mean shld i use user-interface or worker thread? or do u have any reference to recommend me?

                T Offline
                T Offline
                ThatsAlok
                wrote on last edited by
                #7

                Wo

                KongHL wrote:

                or do u have any reference to recommend me?

                How to Use Worker Thread:- http://www.flounder.com/workerthreads.htm[^] How to use UserInterface Thread:- http://www.flounder.com/uithreads.htm[^]

                "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                cheers, Alok Gupta VC Forum Q&A :- I/ IV

                1 Reply Last reply
                0
                • H Hamid Taebi

                  See Here[^]maybe it is some helpful to you_**


                  **_

                  whitesky


                  T Offline
                  T Offline
                  ThatsAlok
                  wrote on last edited by
                  #8

                  WhiteSky wrote:

                  See Here[^]maybe it is some helpful to you

                  I agree with Mr Stephen [HERE][^] for same!

                  "Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow

                  cheers, Alok Gupta VC Forum Q&A :- I/ IV

                  1 Reply Last reply
                  0
                  • K KongHL

                    Hi, I'm a beginner in using threads. I have a dll which I have to pass in some parameters, which i will call at a pt of the application. But i would like to allow the user to be able to quit the application even in the midst of the dll operation. So i shld use a thread rite? but I am not sure how abt going it. how am i going to use the AfxBeginThread??

                    E Offline
                    E Offline
                    Eytukan
                    wrote on last edited by
                    #9

                    KongHL wrote:

                    how am i going to use the AfxBeginThread??

                    Like this: AfxBeginThread(CRuntimeClass* pThreadClass, int nPriority, UINT nStackSize, DWORD dwCreateFlags, LPSECURITY_ATTRIBUTES lpSecurityAttrs) :rolleyes:


                    --[V]--

                    [My Current Status]

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups