How to start programming with threads in MFC C++? [closed] - c++

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
i need to create new thread (diffrent class) using cwinthread or afxbeginthreads. i have no idea how to start and which one of them i need to use. help please...
thanks

There are two types of thread in MFC:
worker threads simply perform a task in the background then exit
user-interface threads which have a message pump i.e. you can PostMessage to it
When I used it in MFC a long time ago I very much disliked not being able to create the class because they force you to do it with their factory, and thus you cannot initialise it with parameters it needs to use to execute, as InitInstance() on it also takes no parameters (I think). In other words you really cannot pass them any context data unless you create them suspended, which I found I always had to do.
Worker-threads are the kind of thing I also would prefer to do without MFC since I intensely disliked the intrusiveness of MFC into non-GUI code, i.e. I didn't mind it so much as a Widgets library but found once you put it your project you were "stuck" with it.
I have had to support MFC projects but any new code areas within the project I would stay away from MFC and even use Win32API if possible.

Hi you can read this article http://msdn.microsoft.com/en-us/library/69644x60(v=vs.80).aspx and this one in class

Related

Massively struggling with laying out DirectX and windows [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 9 years ago.
I have managed to get this example to work:
http://msdn.microsoft.com/en-us/library/windows/desktop/dd370994(v=vs.85).aspx
My problem is that I am trying to structure the code there into something more understandable...
My first step is to remove all the stuff that's not absolutely necessary to lanching a window with a direct x surface... but as soon as I start messing with the code, I get massively confused at which components are core, and which are not...
Do you know of a kind of boilerplate project with literally the utmost basics in it for a directx surface in a window.
D2D is fine unless you suggest I just code straight in D3D... even though i'm only going to be drawing 2d stuff.
I've read so many resources and tutorials for directX but every blooming one has different bits and bobs placed in and it's so difficult to just learn what the "must" bits are!...
Just to help you with the question.
I have started by trying to create a Gfx object that will start and create surfaces and resources for direct X, I also tried to separate my windows code but ofcourse got a bit lost there too... Finally I wrapped up my Game class so that the windows loop just ran begin draw, render and end draw. in the tutorial above you have 2 brushes which as i'm not familiar with directX, I'm unsure if I can just whip them out completely or what?
I guess a step in the right direction is really what i'm looking for.
I very strongly suggest that you get hold of a decent book that can guide you through the steps:
For example - try to get a copy of this

What would I have to do to program a GUI in C++ using Eclipse IDE? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I'd like to know what do I need to add a GUI to a C++ program. I mean having some buttons, sliders, windows, text boxes, etc but without having to use visual studio.
Is this possible? is there a plugin for eclipse that allows to program/include a GUI in my program?
Or do anybody know how can I program manually a window or a button or a slider or a text box?
I know that this would be very intensive and time consuming but I'd like to know how can I do manually this kind of GUI objects.
You have to do this :
http://mentalissue.blogspot.se/2011/08/installing-eclipse-ide-for-c-and-qt.html
Use Qt. http://qt-project.org/
Another option is WxWidgets. It uses native APIs to provide native look and feel.

Multithreaded Webserver in C++ [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I want to do a multithreaded Webserver with scheduling and synchronization in C++.This is an assignment problem and I am not asking the code.I have done till the socket connection in server but I dont know how to proceed.I just want some hints or flow for the program.
Here are the few questions I have
1) I have done till socket accept().So when new connection comes I have to fork() and then close the connections of the child process.Is that right?
2) How must I make sure the program is synchronized wth so many threads running?
3) I must have 2 thread pools.1 pool of workers and in the other 2,1 each for acepting connection and inserting the request to ready queue.How can this be done?
I am not asking the code.I just need some hints and guidance.Thanks a lot.
Very interesting course work , if you get you head around this one a lot of concepts will become clear namely concurrency and one of its major use cases I.e. networking!
I used the following article myself to get a quick summary of my options in network concurrency in Linux
http://m.linuxjournal.com/content/three-ways-web-server-concurrency?page=0,0
This article give very high level intros to concepts tha thou will need like copy on write for forked processes and as a result separate address spaces negating sync in certain cases, once you have read this you will have more specific question that you can as once you start getting your hands dirty starting with the code in this article.

when use DLL in c++? [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
For the last 3 weeks I've been trying to create a code generator and my boss told me to put into a plugin DLL so we can call it next time when we want to reuse it !
So I searched the web for a Dll meaning but it still kind of vague , so if you have a better simple definition or a clear idea about DLL in C++ for beginners please enlighten me.
Another thing : I noticed that some uses QT to create plugin , so what's in QT that give us the possibility to do that that we can't find in any other IDE ?
PS: I've never used QT!
DLL-Dynamic Link Library is classes, methods and procedures packaged up into a compiled file to be used in conjunction with other programs. Its similar to an executable .exe file except you don't need a main method.

Run "While loop" in background [closed]

It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I have a Credential Provider dll application in C++. Inside this dll i create a process that will write some data in a file. I need somehow to read that data from file till the value is > -1. I can not use a while loop because my dll will stop loading till the while loop will end. Can i use a separate thread to do this and to get a notification to run a function from my dll when the while loop end? How can i do this? Is there a simple way to do this?
Thank you.
The only really practical way to achieve concurrency is using threads. Take a look at boost threads.
If your compiler implements C++0x thread, then you can make use of it.
Read this extensive tutorial on C++0x multi-threading : Multithreading in C++0x part 1: Starting Threads