|
|
Why don't you register a callback in the module where data is rcvd. and call that callback as soon as (dataHasCome)
|
|
|
|
|
Reading on a COM-Port is fine be reading 1 (in words: "one") byte while waiting for completion (or time out)
Press F1 for help or google it.
Greetings from Germany
|
|
|
|
|
Where does the data come from? For most input devices, there is some way of blocking until the input device has some data, rather than having to sleep.
But we can't help you if you don't give us that detail!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Assuming your data is coming via the serial port, read here.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
|
Is that a IWebBrowser2 wrapper class ? Check this site[^] for more information.
Also, please look at the Navigate[^] method.
|
|
|
|
|
Hi,
I am trying to size my Rich edit Dialog box to fit a certain amount of characters on a line of Multiedit Rich Edit control
It would be helpfull to know logfont Height and long font width
I have tried in My Initdialog rtn to get this info
by dointg CFOnt * CRichEdit::GetFont however it seems the the Font has'nt been set as yet
GetDegaultCharFormat doesn't return any size info I know the CharFormat structure doesn't have a Width members
but the hieght is zero
Maybe becuase I haven't sized My Edit Control via MoveWindow
would anyone know when (maybe somne message e.g. WM_SETFONT) that rich edit populates the Height/Width of the font
thankx
|
|
|
|
|
The documentation[^] says:
The return value is a handle to the font used by the control, or NULL if the control is using the system font
I suspect the system font is being used, in which case GetStockObject(SYSTEM_FONT) should return the required font handle?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I just wonder Height and width fields have something else besides zeros
As I would like to use the width to size up number characters I can have on a line
I'll try it out
thankx
|
|
|
|
|
This code in my OnInitDialog:
CFont* f = richEd.GetFont();
if (!f) f = CFont::FromHandle((HFONT)GetStockObject(SYSTEM_FONT));
LOGFONT lf;
f->GetLogFont(&lf);
yields
lf.lfHeight = 16
lf.lfWidth = 7
when the rich-edit is (presumably) using the stock font.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
thznkx so so so so so much ............
The Rich Edit control in my resource file is sizes are all zeros (0,0,0,0) as I plan to size
it myself Hope it wont effect hiegt and width
I'll give it a shot
thankx again
|
|
|
|
|
|
ForNow wrote: I am trying to size my Rich edit Dialog box to fit a certain amount of characters on a line of Multiedit Rich Edit control
So do you need GetOutputTextExtent() or GetTextExtent() for this?
While it makes sense to limit an edit control to only allow a certain number of characters, is there any real benefit in sizing an edit control so that it is just wide enough to hold N characters?
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
|
|
|
|
|
Hi,
My rich edit control sizes defined in my resource file is all 0,0,0,0 zeros
In Accordance with Rich Edit Bottomless edit control concept
the width from either GetDefaultCharFormat or From GetLogfont is zeros
I look up the Api's you have been kind enough to show me and use the width as a starting point
in sizing my edit control
thankx
|
|
|
|
|
Thankx for everybody help
GetTextExtent seems to be my best bet
though I beleive the size will change with a MoveWindow
guess I'll try it and see
|
|
|
|
|
I have a necessity to Remotely upload the PDF documents to the SharePoint Server. Can I do this task with VC++ 6.0 IDE. As per my knowldge I can do this consuming the SharePoint Webservices and using VC++ 2008 IDE with DotNet Framework support.
|
|
|
|
|
Sharepoint web-services use SOAP, right? In that case, gSOAP[^] would probably be the best thing to generate C++ bindings compatible with VC6, I suspect.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I'm trying to figure out where exactly I would use the Max-Count value of a Semaphore. What's it's purpose? I have been thinking that when the number of processes trying to access the S-object reaches Initial-Count, Max-Count comes into picture. For example, If I had specified 3 as the initial count, 5 as the Max-Count and I'm invoking 3 processes to fill the initial-Count quota. These 3 successfully wait-through(pass-through) the wait-function. Now I execute the 4th process.. since I had mentioned 5 as Max-Count, I guessed it will allow only two more process to get into the block-wait.So It works, I'm able to put 4th and 5th processes into wait. (Though they don't pass the wait function, they just wait). I thought if I execute the 6th process, it would fail and I would get WAIT_FAILED result. But on the contrary, it keeps to wait along the 4th and 5th process. So I conclude my guess is wrong. Can anybody explain a bit on this max-count? Thanks.
----------------------------
286? WOWW!
|
|
|
|
|
In Windows, a semaphore blocks when its count is zero.
It starts at lInitialCount (as per the documentation[^]).
A successful Wait for the semaphore decreases the count by 1. A ReleaseSemaphore from any thread increases the count by 1. So, if you set the initial count to something less than the max count, if you release the semaphore one or more times before anything waits , it can reach the maximum count.
I suppose that lets you have a notional initial occupancy of the semaphore - but you need to be aware of and keep track of that.
So - in your case, initial count=3, max count=5, so the semaphore believes two of its 'slots' are filled when it is created. The first three waits on the semaphore succeed. Any waits after that will wait until ReleaseSemaphore is called and the thread can acquire the semaphore.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Stuart Dootson wrote: So - in your case, initial count=3, max count=5, so the semaphore believes two of its 'slots' are filled when it is created. The first three waits on the semaphore succeed. Any waits after that will wait until ReleaseSemaphore is called and the thread can acquire the semaphore.
Is it like at first the limit cap would be 3(As it assumes the other 2 to be filled already) but once we start to release semaphores, the cap would be extended to 5?
For example:
initially available slots: 3 ; Filled slots :2 ; SemVar=3
S1 Created. Successful wait-through. SemVar-- = 2
S2 Created. Successful wait-through. SemVar-- = 1
S3 Created. Successful wait-through. SemVar-- = 0, becomes 0 and becomes non-signled.
S4 Cannot be created. Limit Reached. Keeps Waiting.
S1 Released. SemVar++ = 1 (Now will it add 2 more counts here?) so that SemVar becomes 3 . Hence the final limit becomes 5. (2 already in use S2,S3 after we release S1). So as I just said, the currently available slots would be 3.
Now S4 gets through.
S5 gets through.
S6 Gets through.
So we have S2,S3,S4,S5,S6 in the ultimate list?
Now the semaphore starts to operate on 0 to 5 limits. Rather than the 0 to 3 limit. Did I get you right?
----------------------------
286? WOWW!
|
|
|
|
|
_8086 wrote: Is it like at first the limit cap would be 3
The limit is always 5 - it's just that you start with lInitialCount slots available - the difference between the initial count and the maximum count is the number of used slots when the semaphore is created.
_8086 wrote: S1 Released. SemVar++ = 1 (Now will it add 2 more counts here?)
No - the difference between the initial count and the maximum count is erased when you release the semaphore in threads that never acquired the semaphore. Let's say we have threads T0 and T1 and some worker threads Tw0-Tw5.
Let's say we want to create the semaphore with 5 slots, 2 of which are already reserved for T0 and T1. In that case, we use a maximum count of 5 and an initial count of 3 (5-3=2 slots, for T0 and T1).
Now, the effective count for threads Tw0-Tw5 to use is 3 until a thread that hasn't acquired the semaphore releases it.
So, if thread T0 calls ReleaseSemaphore (remember, it has never waited on the semaphore), the semaphore's effective count goes up to 4. If thread T1 then calls ReleaseSemaphore, its effective count goes up to 5.
Does that make sense?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Stuart Dootson wrote: Does that make sense?
Truly.
Let me test this one now. Thanks dude.
----------------------------
286? WOWW!
|
|
|
|
|
Hi Stuart, Let me continue my discussion now. Okay, now as you said, We'd require two threads to release the Semaphore without even acquiring it. Assume we are not doing it. Now the Semaphore variable counter would be 0. What should happen if a new process/thread tries to call CreateSemaphore now?
Should I check for GetLastError()? So that I might get "Limit_reached" or something? Before putting the new handle into Wait function? Or I should pass the handle to the wait function straight and try to get check the value returned by it?
Your answers have been awesome. Thanks a lot.
----------------------------
286? WOWW!
|
|
|
|
|
_8086 wrote: CreateSemaphore
Ummm - it'd create a new semaphore? Or are you creating a named semaphore and using the same name as previously (and if that's the case, the initial and maximum counts are ignored)?
Anyway - CreateSemaphore doesn't matter - it's the wait function[^] that acquires the semaphore. When the semaphore's count is zero, waiting on the semaphore will cause the wait function to block - that's what the documentation[^] says, anyway.
If you use WaitForSingleObject, it will return WAIT_OBJECT_0 if it acquires the semaphore or WAIT_TIMEOUT if the semaphore isn't available (unless you specify a timeout of INFINITE, in which case WaitForSingleObject will never return).
The 'Using Semaphore Objects[^]' page may clarify things.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|