|
THANK YOU VERY MUCH!!!!! YOU GAVE ME LOTS OF HINTS!!!!
Andres Manggini wrote:
I am not quite sure to understand the question, but i'll tell you this, if
CServer is running on a different thread it shouldn't block OnOK(), but, OnOK will be blocked cause of :
CSocket Client;
Client.Create();
Client.Connect("127.0.0.1",5001);
Client.Send(buff,strlen(buff));
So, OnOK will be blocked until Client.Send(..) returns.
Ok....how can i prevent Client.Send(..) returns..... is it suspend the thread of Run()...or......
Maybe I give you more detail....
I need to implement a DBMS program that simulate the Lock management. I use socket in CServer to implement the scheduler that handle the lock. It is one thread...... then there are hundreds of users to "access" the database object, so there are hundreds of threads. Each threads(uses) requires to get a lock permit from scheduler (CServer) in order to "access' the DB Object. This is what i'm going to do.
Why I need to block some process, because for example, thread A is trying to access the DB Object X, while thread B is reading something in Object X. Scheduler (CServer) requires to "block" thread A until thread B finished. At this time, thread A will be put in "waitqueue" (this is another issue).
|
|
|
|
|
ChiYung wrote:
THANK YOU VERY MUCH!!!!! YOU GAVE ME LOTS OF HINTS!!!!
Great .
ChiYung wrote:
Ok....how can i prevent Client.Send(..) returns..... is it suspend the thread of Run()...or......
Do you mean prevent Client.Send even after all the data has been sent ?
Cause, if you just want to prevent the return UNTIL all the data has been sent, that's already how it works, so don't have to do anything.
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
Andres Manggini wrote:
Do you mean prevent Client.Send even after all the data has been sent ?
Cause, if you just want to prevent the return UNTIL all the data has been sent, that's already how it works, so don't have to do anything
I think I want the CServer to....let say suspend awhile (e.g. 20s) before the OnOK() receives the return signal from Client.Send()...........(it can make the OnOK() to suspend 20s too....right?
Sorry...I know I'm stupid.....;P
|
|
|
|
|
I don't know of you can do that just with the CSocket methods, i guess you'll have to implement a form on synchronization between the server and the clients..
maybe using socket as well, set up a small protocol between server and client to communicate (protocol as defined messages sent to each other)
not sure this is the solution for you here..
And.. you're no stupid, far from it .
Regards,
Andres Manggini.
Buenos Aires - Argentina.
|
|
|
|
|
To avoid blocking sockets you might want to use CAsyncSocket in place of CSocket.
Nish
One Nish is trouble enough.
Imagine 16 of me, dancing wild...
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
|
|
|
|
|
Anyone know how I can take a dialog box with 3 buttons that have no function at all and change the background colours of 2 of them to red and one gray??
Thanks.
|
|
|
|
|
Try adding an OnCtlColor (if MFC) handler to the dialog and returning a brush of the desired color based on the control IDs...
|
|
|
|
|
I'm not that experienced in visual c++ programming.. could you please tell me the syntax of how to write all that?
Thanks
|
|
|
|
|
Or you could try using CButtonST v3.4
http://www.codeproject.com/buttonctrl/cbuttonst.asp
Nish
One Nish is trouble enough.
Imagine 16 of me, dancing wild...
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
|
|
|
|
|
Actually, I was asleep at the switch in that reply - but if you search the articles here for 'owner draw' you'll get lots of info on what can be done.
|
|
|
|
|
Tim Deveaux wrote:
Actually, I was asleep at the switch in that reply
Still feelin sheepish abt that eh, Tim?
Nish
One Nish is trouble enough.
Imagine 16 of me, dancing wild...
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
|
|
|
|
|
Ruined my whole day
Now, about this '16 Nish' concept...
|
|
|
|
|
This wont work for buttons anymore...
Nish
One Nish is trouble enough.
Imagine 16 of me, dancing wild...
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
|
|
|
|
|
Yes - I goofed - need to have an owner draw button...
|
|
|
|
|
You can use a CBitmapButton
Nish
One Nish is trouble enough.
Imagine 16 of me, dancing wild...
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
:jig::jig::jig::jig:
|
|
|
|
|
|
hi,
I want to execute different functions depending on the condition set.I know it can be done with function pointers but I want to do it with preprocessors.
How to get about with it.
Cheers.
|
|
|
|
|
The standard approach is like this:
#ifdef SCENARIO1
f1(...);
#elif SCENARIO2
f2(...);
...
#else /* SCENARION */
fn(...);
#endif Then in Project->Settings->C/C++->Preprocessor definitons set the appropriate macro depending on the scenario/configuration you wish to select.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
hi,
ok but how to eneble those?
Gerrard
|
|
|
|
|
hi
i would like to add a default value of '1' in one of my edit box's when the program is executed.
Help on the code and where to place the code in the main would be good thanks
|
|
|
|
|
If your edit box is in a dialog OnInitDialog()
editbox.SetWindowText("1");
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
i assume i change 'editbox' to then name of my edit box 'IDC_KEY'
if so it gives me an error of
.cpp(123):error C2228:left of '.SetWindowTextA' must have class/struct/union type
|
|
|
|
|
nabila hussain wrote:
assume i change 'editbox' to then name of my edit box 'IDC_KEY'
No,you have to define controller for it,tell me if you use VC6 or VC7 to tell you how to this task.
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
|
Go to class wizard(prees ctrl+w)
Go to "Member Variables" tab.
In the Class name box, choose your dialog class.
In the Control IDs box, click IDC_YOURTEXTBOX.
Click "Add Variable". The "Add Member Variable" dialog box appears.
Change the Category box from "Variable" to the other one.(I can't remember the exact name now)
In the Member variable name box, type the name you want,and its the name of your control,you should use this for SetWindowText()
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|