AKB Forums

Go Back   AKB Forums > Technical sections > Languages, Compilers and Interpreters
Home Register Blogs FAQ Members List Calendar Downloads Arcade Mark Forums Read

Languages, Compilers and Interpreters C,C++,C#,.NET,Java,PHP,Perl,SQL and more

Troubles when posting message? Click here! :: Проблемы с отправлением сообщения? Нажмите сюда!

Reply
 
LinkBack Thread Tools Display Modes
Old Jan 29, 2002, 23:35   #1
Студент
 
Join Date: Jan 2002
Location: Yerevan, Armenia
Posts: 282
Rep Power: 7
Reputation: 10
Send a message via ICQ to Camelot
Red face 2 Questins too.

1st one: who worked with double buffering and how achieve this simultaneous thing:<BR>reading data from file into the buffer, and at the same time playing data from another buffer. As i understand i've to use threads.<BR>Please tell me about double buffering, and how acheive it.

2nd one: i'm using MFC, then my dialog has to handle some king of messages which is not included in the ClassWizard's Message List.<BR>How i could handle them in MFC, like i'm doing in WinMain() of API Win32.

thx
__________________
Сколько времени и сил должен потратить мужчина,
Чтобы воспользоваться минутной слабостью женщины
Camelot is offline   Reply With Quote Quote selected
Old Jan 30, 2002, 01:44   #2
Administrator
 
acid's Avatar
 
Join Date: Sep 2001
Location: South Korea, Gumi
Posts: 7,164
Blog Entries: 15
Rep Power: 10
Reputation: 298
Post

1. Yes you've got to use threads. Either you can use CWinThread or just Win32 api. I'll explain very briefly the simple way to make what you want.

Make some "Events" using CreateEvent and set the state of this event to non-signaled.

Make two functions which will be the "working thread functions" and assign some buffering routines to that functions. Arrange some loop in those functions and put your "event signaled" state as break condition of that loop. You can use WaitForSingleObject.

Use _beginthread from you main place to create all the threads you need by putting those created function addresses as last parameter.

Now you must have all your threads working and doing their job.

Whenever you want to stop them change the state of your event to signaled and those functions will respond to it by closing up all the job.

Again, that was very briefly and I didn't went too much deep into details.

2. Well, it's up which kind of messages you desire to handle. First if you don't see your messages in class wizard, open your workspace, right click on the class name, you will see "Add windows message handler" and you will see other way to add message handlers. Don't forget to change filter in that dialog box to see more messages. Next way is adding them manually - you have to follow instruction for each message personally because there is no common way to do that. Search for keywords beginning with ON_..., put declaration in header file, put message name in BEGIN_MESSAGE_MAP(...) and finally put function body into code, all according to documentation for that message.

Hope it helps.
__________________
Chat with acid


acid is offline   Reply With Quote Quote selected
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



All times are GMT. The time now is 12:48.


Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
This board was founded on September 29, 2001
Powered by Viper Internet

Affordable Web Hosting | ParevNet

Buy text link