|
is it because the mechanism is supposed to provide protection between thread boundaries only ?
Engineering is the effort !
|
|
|
|
|
yep.
a critical section can be owned by one thread at a time - all other threads are blocked until the owning thread releases it, but the owner thread can skip over the block as much as it wants. it can even re-lock as often as it wants, though it must un-lock once for each lock.
more here
|
|
|
|
|
Hello,
I'm working on a application, Win32 Console C++ with MFC support, and when its started it starts like a normal CMD window, but i want it to start in full screen mode... (as can be done manualy by changing properties for the window. (or like old dos games
Any ideas are welcome!
/Johannes
|
|
|
|
|
You can use Win32 call SetConsoleWindowInfo() to set full screen console. This tutorial can help you.
Best,
Jun
|
|
|
|
|
Help! I've looked everywhere but can't find the answer.
I create a CPropertySheet containing a bunch of CPropertyPages.
If I launch it using DoModal it looks like it has the right width, i.e. the width of my property pages (which are all the same size).
But when I use SetWizardMode(), the resulting dialog is much wider than it needs to be. The buttons at the bottom are shoved to the right with empty space on the left. But my propertypages (according to Spy++) have been inflated in width. Their controls appear at the left, and there's a large empty space on the right, above the Cancel/Help buttons.
Does anyone have an idea what's going on here, and what I can do about it? I've tried all sorts of things (checking all contents, moving the buttons to the left, etc.) but I must be missing the obvious because nothing works.
You can see this behaviour in a simple app with just a default property page in a property sheet, too. Oh yeah, this is Visual C++ 6.0, and I'm using MFC.
Thanks.
- Owen -
|
|
|
|
|
I have a propertysheet with 2-property pages. If I am in one
propertypage, how can I get a pointer to another to access a
variable in that other page.
In PropertyPageA.h, I tried having:
#include "MyPropertySheet.h"
but then I get compile errors. If I can somehow get a pointer
to the propertysheet, then I can get a pointer to that other
page.
I cant seem to get a pointer to the propertysheet though.
Please, any response any one can give me will be greatly
appreciated.
Sincerely,
Danielle Brina
|
|
|
|
|
DanYELL wrote: I cant seem to get a pointer to the propertysheet though
void CMyPage::Foo()
{
CMyPropSheet* p = (CMyPropSheet*)GetParent();
}
|
|
|
|
|
Hi all,
I am using CAsyncSocket derived class for a client server application.
I am quite confused about the OnSend() function.
When i send any data using Send(), then why exactly do i need OnSend(). What i mean is, if i have already sent the data using Send() do i need to send it again in OnSend().
For OnReceive() i understand that whenever there is some data available in the buffer, it will be called and we can receive the message. There is no special requirement to call Receive() explicitly outside, so that OnReceive() will be called.
Can anyone please answer that.
To put it more clearly, do i need to implement OnSend() to send out data ?
Thanks in advance.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
CoolASL wrote: do i need to implement OnSend() to send out data ?
They hide those explanations in the Documentation[^]
led mike
|
|
|
|
|
OnSend() is a notification to your socket that it is
ok to send data. When you call Send() to send your
data, you should wait for a call to your OnSend()
before sending more data.
Brian
|
|
|
|
|
So, does that mean that whenever i need to send a message, i need to raise a flag and then in OnSend() send the message only when that flag is set ?
Is it the way it is done in standard programs.
Please help.
thanks in advance.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
Yes, you are right on both accounts.
There are numerous code examples here to help.
Brian
|
|
|
|
|
Hi
i want to validate the matching comments.(/* */).Every file should start with the /* and should end with */.
if he gives multiple comments it sholud not be validate.
Here iam showing some possible example which user may enter.
1./*text*//*
2./*text*/*/
3./*text/**/
but that should be only /*text*/.other than this situation i need to throw an error.he is entering the file in edit box.
please any one can give me the solution for this problem.
|
|
|
|
|
Load the file into memory and use the boost::RegEx class to validate it. For more information, check out boost.org.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
hint : use a stack when scanning the file.
|
|
|
|
|
Search for '/*' in the file. It should be found only once and the offset should be 0.
Then search for '*/' in the file. Again this should be found only once and offset should be at end of file.
reddy harish wrote: he is entering the file in edit box
I assumed you have access to the file contents in a string so you can use string::find
----------------------
Mayank Thakore
Learning C++ - since 1998
They didn't print my card right; so I resigned.
|
|
|
|
|
I dont think that it would require any special programming.
Whenever you get a /*, you will have to search for a */.
If you get any /* nested inside a /*, then you will have to ignore it.
Set a flag to indicate that you have already got a /*, then ignore subsequent /* while the flag is on. When you get a */, just put off the flag and consider the whole part as a commented area.
Hope it helps.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
I don't think it will be quite that simple. For example what happens if a "//", "/*" or "*/" is inside quotes?
Steve
|
|
|
|
|
well, steve, what i suggested was the simplest way and the basic algorithm.
If the need of checking inside strings is required, then it could very well be checked too.
There could be several other requirements too. All of them could be simply built over that basic algo.
*** Who said nothing is impossible? I have been doing it for a long time ***
|
|
|
|
|
Is there an explaination to how to hook socket?
thanks in advance!
|
|
|
|
|
See here[^] maybe it is some helpful to you
|
|
|
|
|
Is it possible to add and remove strings from the stringtable at runtime? Or even better create a new stringtable and add it to the list of stringtables at runtime.
Thanks
|
|
|
|
|
ABuenger wrote: Is it possible to add and remove strings from the stringtable at runtime?
No. The string table is a static resource. What you can do is write your own LoadString method to look in the string table and then in whatever other locations you want to check.
If you decide to become a software engineer, you are signing up to have a 1/2" piece of silicon tell you exactly how stupid you really are for 8 hours a day, 5 days a week
Zac
|
|
|
|
|
e.g. how to write a string "sample string" to a txt file whose full name is "C:\a.txt"?
this must be a very simple question. so could anybody be so kind as to provide a little sample code?
by the way, if writing to a MS Excel file is as simple, I would rather learn how to write to a Excel file.
Thank you very much!!!
-------------------
I am learning C++ and English
|
|
|
|
|
char string[100]="hello";
FILE *p;
p=fopen("C:\a.txt","w");
fprintf(p,"sample string is : %s",string);
------------------------------------------
also you can see fprintf and it's examples in help .
|
|
|
|