|
Thanks for the reply Nuri,
I have tried to implement that in my OnInitDialog, along with setting PARAFORMAT2 etc.
The hwndEdit you mention is, I assume, m_hWnd of the edit control, e.g. MyRichEditCtrl.m_hWnd?
I have added richedit.h to my project, in fact I have tried pretty much all that I read on various sites, but with no joy.
Do you have any further suggestions?
My code now looks like
<pre>
//open the fiel that contains the commissioning information
CStdioFile cFile(TEXT("RES\\Message.rtf"), CFile::modeRead);
//ensure a blank canvas
m_rtfCtrl.Clear();
//enable advanced typography
::SendMessage(m_rtfCtrl.m_hWnd, EM_SETTYPOGRAPHYOPTIONS, TO_ADVANCEDTYPOGRAPHY, TO_ADVANCEDTYPOGRAPHY);
PARAFORMAT2 pf;
// Modify the paragraph format so that the text is centered.
pf.cbSize = sizeof(PARAFORMAT);
pf.dwMask = PFM_ALIGNMENT;
pf.wAlignment = PFA_JUSTIFY;
BOOL bOK = m_rtfCtrl.SetParaFormat(pf);
EDITSTREAM es;
//read the data by setting up the callback
es.dwCookie = (DWORD) &cFile;
es.pfnCallback = MyStreamInCallback;
m_rtfCtrl.StreamIn(SF_RTF, es);
</pre>
Tony
|
|
|
|
|
Hi,
maycockt wrote: The hwndEdit you mention is, I assume, m_hWnd of the edit control, e.g. MyRichEditCtrl.m_hWnd?
Yes, it is the m_hWnd of your edit control.
This is from your code:
PARAFORMAT2 pf;
pf.cbSize = sizeof(PARAFORMAT);
pf.dwMask = PFM_ALIGNMENT;
pf.wAlignment = PFA_JUSTIFY;
BOOL bOK = m_rtfCtrl.SetParaFormat(pf);
Try with this change. If this don't solve your problem, then you have to paste your MyStreamInCallback function because there are some tricks about this callback for UNICODE builds.
Regards,
Nuri Ismail
|
|
|
|
|
Hi Nuri,
Your initial help was spot on, it was a different issue causing the problem.
The Auto HScroll was set, and as soon as I unset that (FALSE), everything sparked in to life.
I dont have any need for the SetParaFormat now, so my other mistake can now be deleted anyway.
Many thanks for your help
Tony
|
|
|
|
|
You're welcome!
|
|
|
|
|
now, i have a window which sends mouse-key-message to desktop-window(names "FolderView"), how can i make the desktop-window handle MouseLButtonDown and not get focus. in other words, my window owns focus other than desktop-window.
|
|
|
|
|
i feel you need "HOOK"
|
|
|
|
|
Hans Conried, Cyril Ritchard, Jason Issacs, Dustin Hoffman, ...?
You measure democracy by the freedom it gives its dissidents, not the freedom it gives its assimilated conformists.
|
|
|
|
|
thank you, i don't use hooking, but i send the proper message to the window,which message is viewed by spy++, thank you all the same
|
|
|
|
|
my program uses SetItem() to change the image of an item in a list control dynamiclly,it works in debug version,but doesn't work in release version.Why is that?I'm so confused!
|
|
|
|
|
It could be related to the initialization of your variables/pointers. Debug version does some "non visible" things that you don't programm but release version doesn't, so what in debug works doesn't have to work in release. Check your code.
Regards.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
Help me to understand what I'm saying, and I'll explain it better to you
“The First Rule of Program Optimization: Don't do it. The Second Rule of Program Optimization (for experts only!): Don't do it yet.” - Michael A. Jackson
Rating helpfull answers is nice, but saying thanks can be even nicer.
|
|
|
|
|
|
I suggest you add OutputDebugString() calls and use dbgview from sysinternals.com (free utility) to view the debug messages. This works equally well in both debug and release mode build.
|
|
|
|
|
Hi Please let me know how to remove readonly permissions for a folder and its subdirectories and files inside it...
|
|
|
|
|
|
I tried but it"s not working....it"s not removing...
i tried as below..
::SetFileAttributes("E:\\ntbackup\\",FILE_ATTRIBUTE_NORMAL);
|
|
|
|
|
Are you calling GetLastError() ? Or could it be that you are not removing the read-only attribute from everything under that directory first?
In any case, SetFileAttributes() is not recursive so you'll have to implement that yourself. See here for more.
"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
|
|
|
|
|
kumar sanghvi wrote: I tried but it"s not working....it"s not removing...
What do you mean by that? Is it not changing the attribute of the root folder or for the files and folders contained?
kumar sanghvi wrote: ::SetFileAttributes("E:\\ntbackup\\",FILE_ATTRIBUTE_NORMAL);
With this, you're just changing the attribute of the folder named 'ntbackup' if you need to change the attributes of the folders and files contained within, you need to do it recursively.
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
As David already mentioned, check what GetLastError() tells you if the call fails. Also, the trailing backslash in your example above may prevent the call from succeeding (not sure about this).
|
|
|
|
|
Hi, I have code that includes a function which makes sense only if CString is available, and I'm using the same code in 1 project where MFC is enabled and in 1 where it isn't. I need to make sure that the code is enabled only if the project is with MFC, i.e.
#ifdef CSTRING_IS_AVAILABLE
...
#endif
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Can you see if _MFC_VER has been defined?
"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
|
|
|
|
|
It worked, thanks for the help.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Well, CString can be available for use where _MFC_VER is not defined as well!
For instance, you could use CString in a console project with no MFC support by just including atlstr.h You could better do this:
#ifdef __ATLSTR_H__
#endif
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Well, CString is available even where __ATLSTR_H__ !
Just write:
#include <cpallini_free_stringz.h>
#define CString stringz
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]
|
|
|
|
|
Hi All,
The task which is given to me is that i have to show a cylinder in 3D.Then when i click on any part of the cylinder and drag the mouse i should be able to deform the cylinder and when i leave the mouse the object should be in the last deformed state.I am planning to use directx for this.
Any inputs from you will be very helpful for me.
Thanking you in Advance,
Regards,
Ashwath.
|
|
|
|
|
I'm guessing, based on your post that you have not done much Direct3D programming (otherwise, you'd know the answer). Can you display a just a cylinder (without any modification)? That would be the obvious starting point. Wireframe? Solid? Lighting? What version DirectX? You leave out alot of important details. You should initially query the capabilities of your graphics device. But, essentially, I think you will want to coordinate the output of a number of standard DirectX APIs: Direct Input (to respond to the mouse action), and, the display of the cylinder data. The way I'd do it would be to implement a cylinder Mesh (which is a standard DirectX object), and which gives you access to the Vertex Buffer and Index Buffer (and all the other data you'll need). The easiet method would be to implement a series of drawing calls using a progressive algorithm that deforms the Mesh by some simple metric. You would be writing data to the Vertex Buffer and then displaying the Mesh.
Also, there is a Graphics Forum here at CodeProject, where you'd probably get a better answer.
|
|
|
|