|
I think DrawText and Textout can't justify text.
You can use a RTFControl (Has to be Version 2.0 or higher)
* create an invisible RTF Control (be sure to use RTF2.0 or higher)
* Set Text with SetWindowText
* SelAll
* SetParaFormat with paraformat2.wAlignment to PFA_JUSTIFY
* set target device EM_SETTARGETDEVICE
* set wrapmode
* use EM_FORMATRANGE to draw content to a dc
have a lot of fun
Ralf
|
|
|
|
|
Thanx, but i wanna know can i generate these controls at runtime, bcoz i have to have an unknown number of rectangles at runtime !!!
Thanx
Nadir Maroof
|
|
|
|
|
yes you can !
Create one or more instances of CRichEditCtrl !
I would not use the standard create method of MFC because it uses RTF Version 1.0. It is important to create it without WS_VISIBLE Style
To create Version 2.0 or higher you have to use
LoadLibrary("riched20.dll")
see msdn LoadLibrary("riched20.dll")
Ralf
|
|
|
|
|
What about the SetTextJustification method !! can it solve the problem !!!
Nadir Maroof
|
|
|
|
|
Hi,
I am searching for a way to connecnt unlimited number of clients to a server.I
Know I can use these ways:
1-To create CAsyncSocket varaibles in array and dynamically.
2-To create CAsyncSocket pointers in a threads.
But I don't know none of them.
Please Help me!
Tell me if there is any good and simple article.
Thanks you.
|
|
|
|
|
Search for information on Windows Sockets. You should be able to find examples.
With sockets, on the server side try:
listen(socket, MAX_CONNECTIONS), after the call to bind().
Set MAX_CONNECTIONS with a define statement to some large value. I hope this helps you out.
Jerry
|
|
|
|
|
I must be missing something somewhere, but it isn't obvious to me with such an ambiguous error msg...
I've tried every connutation of line 79 "(WindowOne ->Create(NULL,NULL,WS_CHILD,);", but none seem to help, unless I actually comment it out.
Is there another section of code where I should go to make edit corrections?
I've tried deleting the offending line and recompiling before retyping it back in to no avail.
Any help/advice is greatly appreciated!
The offending code...........
void CSplashScreen::OnGo()
{
// TODO: Add your control notification handler code here
CWnd *WindowOne = new CWnd;
WindowOne ->Create(NULL,NULL,WS_CHILD,);//line 79
WindowOne ->ShowWindow(SW_SHOW);
}
Thomas
|
|
|
|
|
Try this
CWnd* pWnd = new CStatic;
pWnd->CreateEx
(WS_EX_CLIENTEDGE, // Make a client edge label.
_T("STATIC"),
"Dialog",
WS_CHILD |WS_TABSTOP | WS_VISIBLE |WS_CAPTION,
5, 5, 300, 300,
m_hWnd,
(HMENU)1234);
m0n0
|
|
|
|
|
Thanks very much! This works, and I'm sure I will be ale to put it to good use. A question regarding the use of CStatic...
I want to be able to access the window produced as if it were a List box. The item choosen from this list box will be applied to a second window which will bring up the properties of the item chosen from the first window.
Can I do this with the CStatic window just created?
Thanks in advance,
Thomas
|
|
|
|
|
i think u r missing a few parameters, just try this one;
void CSplashScreen::OnGo()
{
// TODO: Add your control notification handler code here
Rect rect(100,100,200,200);
CWnd *WindowOne = new CWnd;
WindowOne ->Create(NULL,"Window One",WS_CHILD,rect,NULL,NULL,NULL);//line 79
WindowOne ->ShowWindow(SW_SHOW);
}
You missed out the rectangle, and other few parameters, just try this one out.
Cheers
Nadir Maroof
|
|
|
|
|
Sorry i missed a thing, it is;
CRect instead of only Rect in the declaration, now ur code should look like this;
void CSplashScreen::OnGo()
{
// TODO: Add your control notification handler code here
CRect rect(100,100,200,200);
CWnd *WindowOne = new CWnd;
WindowOne ->Create(NULL,"Window One",WS_CHILD,rect,NULL,NULL,NULL);
WindowOne ->ShowWindow(SW_SHOW);
}
Hope this helps,
Cheers
Nadir Maroof
|
|
|
|
|
|
the MSDN tells us :
int CString::Delete( int nIndex, int nCount = 1 )
throw (CMemoryException );
...
Remarks
If nCount is longer than the string, the remainder of the string will be removed.
i thought the following line of code would work :
m_strDateDay.Delete(2, INT_MAX); but i'm afraid, it doesn't !!!
instead of this, it gives me an "Unhandled Exception in Prog.exe".
when i debug, i see that memcpy() is making the error within CString::Delete().
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote:
m_strDateDay.Delete(2, INT_MAX);
What does m_strDateDay.Delete(2, INT_MAX - 1) yield?
If that does not work, how about:
m_strDateDay = m_strDateDay.Left(2);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
actually, i've already tried with INT_MAX - 1 , and also with m_strDateDay.GetLength() (which i was certain at the moment that it was no longer than 5 chars).
i currently use CString.Left() , but i wanted to know if anybody had already encountered that problem, or could find a reason to that behavior...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
So these two statements do not work for you:
m_strDateDay = "12345";
m_strDateDay.Delete(2, INT_MAX - 1);
m_strDateDay.Delete(2, m_strDateDay.GetLength()); Is that correct?
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
|
|
|
|
|
|
It's a bug. It has nothing to do with INT_MAX.
Actually, the exception is thrown if nCount is greater than the (number of remaining characters after nIndex) + 2.
SkyWalker
|
|
|
|
|
so what...?
should I mail Mr MSDN to tell him that its doc is not accorded with the libraries ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Are we all doing all the things perfectly? I guess not.
SkyWalker
|
|
|
|
|
but that's a document used by hundreds of thousands of people...
it needs a particuliar care ! don't you think so ?
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
Cherie Carter-Scott used to say:
"Il n'y a pas d'erreurs, juste des lecons. Grandir implique un processus d'experience par essais et erreurs. Les experiences negatives font autant partie du processus d'apprentissage que les experiences positives."
SkyWalker
|
|
|
|
|
|
This issue has been fixed. I worked with David Lowndes to get word to the MS folks.
http://lab.msdn.microsoft.com/productfeedback/viewfeedback.aspx?feedbackid=f649d7de-cfd9-4c50-b278-17dcf2678920
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
thank you very much...
well, the problem wasn't coming from me so !
now, i have to acquire MS Visual Studio 2005 beta to get it work
thank you again for tracing this bug to me.
cheers,
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|