|
Well - calculating the edge of the region from the RECTs is proving not quite so trivial (imagine a region in the shape of a rainbow or a four leaf clover ). The RECTs are ordered top to bottom, left to right. The algorithm to figure that out is more than I can manage tonight. I'll be back, as the Austrians say.
Jonnie
|
|
|
|
|
Neither is getting precise all edge points from a mixed rounded or elliptical region Maybe Egyptian 22/7 might help there, if a circle is small enough
|
|
|
|
|
If CRgn is actually a number of rectangles, perhaps the nearest you will get is to use FrameRgn to draw a border round the region (or a off-screen copy of the region) in some colour. Then look for something to give you the all pixels/points of that colour starting from a point on the region.
|
|
|
|
|
Thanks Jonathan. If I can't figure out a way using the GetRegionData() method, I may well follow up on your suggestion.
Greetings,
Jonnie
|
|
|
|
|
CRgn has the GetRgnBox method, which gives you the bounding box of the region. Iterate over all the points in the bounding box, calling the PtInRegion for each. The points which return true are in the region, so add them to a list of the points in the region. Job done!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hi All,
Does anyone know how to convert a CString to a hex and convert the hex values to integer.
For example I have
CString str="0x03";
"0x03" is hex value but this is stored in CString. I want to convert this hex value in to int.
Please help. Thanks
|
|
|
|
|
AnithaSubramani wrote: Does anyone know how to convert a CString to a hex and convert the hex values to integer.
This doesn't make a lot of sense. From what I understood from your example, you have a string representing an hexadecimal number and you want to convert that string into an integer, is that right ?
For that you can use the _tcstol funcion (see here[^]) with 16 as the base.
PS: you should use the _tcstol version in order to support both UNICODE and non-UNICODE builds.
|
|
|
|
|
She might be expecting,
csValue.Format( _T( "%d" ), nValue );
- ns ami -
|
|
|
|
|
That's the other way around: converting an integer into a string.
|
|
|
|
|
No. Akt_4_U has given the right answer.
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
use strtol with 16 as base.
akt
|
|
|
|
|
Hex is just a convenient (context-depending) base for representing numbers.
You may do
CString str=_T("0x03");
long l = _tcstol(str, NULL, 16);
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
AnithaSubramani wrote:
Does anyone know how to convert a CString to a hex and convert the hex values to integer.
See 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
|
|
|
|
|
would anyone know what code starts excuting when the Cwinthread::Create creates a thread ???
|
|
|
|
|
There isn't a CWinThread::Create method.
As about CWinThread::CreateThread method, it is defined in thrdcore.cpp (MFC sources) you may have a look at it.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
sorry still there isn't a thread start function
|
|
|
|
|
The below link will help you.
http://www.codeproject.com/KB/threads/extended_thread.aspx
akt
|
|
|
|
|
Thankx this seems to be what I have been looking for a way to
point to Cwinthread to my own threadproc
|
|
|
|
|
in the example the derived thread CthreaEx sets m_pThreadParms which is a private member of the Base Class Cwinthread ??
|
|
|
|
|
I would like to suggest that you should do a sample application and start debug. Then you can "step into" the code and see yourself what code is being executed.
- ns ami -
|
|
|
|
|
|
I think you've been searching to pass a thread function to CWinThread ?
By any chance you aren't aware an AfxBeginThread(YourThreadFunc) call returns you a CWinThread ?
He never answers anyone who replies to him. I've taken to calling him a retard, which is not fair to retards everywhere.-Christian Graus
|
|
|
|
|
Yes I know but its a plain CwinThread
I would like it to return My own Object Derived from CwinThread e.g.
e.g. as in the MSDN example
so that thread can have acess to my data members function as well as that of CWinThread
// ...
class CSockThread : public CWinThread
{
// ... Other function and member declarations
protected:
CSocket m_sConnected;
};
SOCKET hConnected;
BOOL CSockThread::InitInstance()
{
// Attach the socket object to the socket handle
// in the context of this thread.
m_sConnected.Attach(hConnected);
return TRUE;
}
// This listening socket has been constructed
// in the primary thread.
void CListeningSocket::OnAccept(int nErrorCode)
{
// This CSocket object is used just temporarily
// to accept the incoming connection.
CSocket sConnected;
Accept(sConnected);
// Detach the newly accepted socket and save
// the SOCKET handle.
hConnected = sConnected.Detach();
// After detaching it, it should no longer be
// used in the context of this thread.
// Start the other thread.
AfxBeginThread(RUNTIME_CLASS(CSockThread));
}
|
|
|
|
|
I am not major in Computer science or software!But I am interested in Programming.And I am study it by myself!I have already read a lot of book!But i am still feel that it not enough.In this term,I will try to make some 2D Games To test my level.
But any body can help me.What courses should i learn to become a good Programmer!for example "C++" or "C"!
Thanks in advance!
|
|
|
|
|
learn C++ man.That is most important.
|
|
|
|