|
I remember that you asked this question some time ago. And you have not resolved yet?
Maxwell Chen
|
|
|
|
|
Maxwell Chen wrote: I remember that you asked this question some time ago. And you have not resolved yet?
solved this time [^]
|
|
|
|
|
Hi Experts,
How to use _commit(int fd)?
what is mean by fd-file descriptor?
Is there any example?
|
|
|
|
|
pther wrote: what is mean by fd-file descriptor?
file descriptor returned by api's like _open();
pther wrote: How to use _commit(int fd)?
int fd = _open( "sample.txt", _O_RDWR);
... write something to file.
_commit(fd);
"The _commit function forces the operating system to write the file associated with fd to disk. This call ensures that the specified file is flushed immediately, not at the operating system's discretion." from msdn;
|
|
|
|
|
I am using a rich edit control and when i paste data on richedit control than whatever be the size of data is paste as it is.but i want to give the standard size to the data. is there any api or message handler so that i set the size.
thanks in advance.
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Shilpi Boosar wrote: when i paste data on richedit control than whatever be the size of data is paste as it is.but i want to give the standard size to the data. is there any api or message handler so that i set the size.
[add] are you looking for CRichEditCtrl::LimitText[^]? [/add]
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Hi Rajesh,
Thanks for reply ....
When i paste any data on rich edit control than it size should be 7 (its an example).but when i paste data of font size 26 than it paste on richedit control with font size 26. i think now it is clear ...
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Handle the WM_PASTE command and covert the font size to required size.
|
|
|
|
|
i am using SendMessage(WM_PASTE,(WPARAM)0,(LPARAM)0); command but my issue is how i set the font size.
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Shilpi Boosar wrote: i am using SendMessage(WM_PASTE,(WPARAM)...
It doesn't matter how the text is being pasted. You just need to add an appropriate handler to your control and write your code to format the text there.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
I am using the appropriate handler but i dont find any message handler to set the size .EM_SETFONTSIZE doesnt work "error C2065: 'EM_SETFONTSIZE' : undeclared identifier"
Do you have any clue.
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Shilpi Boosar wrote: i dont find any message handler to set the size .
You should find the handler of the rich edit control for the PASTE message, and then use the member function(s) of the rich edit control with which you could do formatting.
See Character formatting in Rich Edit Control[^]
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Have you tried handling WM_PASTE for your control? Have a look at the members[^] of CRichEditCtrl, which may help you to set the format of the text which is being pasted.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Shilpi Boosar wrote: I am using a rich edit control and when i paste data on richedit control than whatever be the size of data is paste as it is.but i want to give the standard size to the data. is there any api or message handler so that i set the size.
try handlling CRichEditCtrl::Paste , there you could manipulate data before actually putting on editcontrol
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
i m properly handle it but the issue is different.do you have any message handler or api so that its font size should be fixed??
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Hey Shilpi,
I'm fiddling between two different machines (on my development machine, the internet is temporarily not working). You could use SetDefaultCharFormat[^] to set the default character format of your rich edit control. Any text entered would be according to the format you've specified with this call.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Hello all,
HRSRC hResLoad = FindResource(AfxGetResourceHandle(),MAKEINTRESOURCE(IDR_IDR_EXE_EXEEXTRACTOR),"IDR_EXE");
when i write this line of code in vc 6 enviornmnet it works fine.
but when i write same line in vc 2005.
Its compiler gives error:-
error C2664: 'FindResourceW' : cannot convert parameter 3 from 'const char [8]' to 'LPCWSTR'
i am not getting how to remove this error......
can anybody help me in this....
Thanks in advance
|
|
|
|
|
neha.agarwal27 wrote: HRSRC hResLoad = FindResource(AfxGetResourceHandle(),MAKEINTRESOURCE(IDR_IDR_EXE_EXEEXTRACTOR),"IDR_EXE");
ADD L before string
HRSRC hResLoad = FindResource(AfxGetResourceHandle(),MAKEINTRESOURCE(IDR_IDR_EXE_EXEEXTRACTOR),L "IDR_EXE");
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
You can also try _T()
Thanks n Regards,
Sandip.
|
|
|
|
|
I have one more problem....
CString m_FName;
LPCSTR data = (LPCSTR)LockResource(hResData);
CString strFName = m_FName + data;
third line gives error
error C2679: binary '+' : no operator found which takes a right-hand operand of type 'LPCSTR' (or there is no acceptable conversion)
how to convert LPCSTR to CString
|
|
|
|
|
neha.agarwal27 wrote: CString strFName = m_FName + data;
CString strFName = m_FName + CString(data);
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
neha.agarwal27 wrote: LPCSTR data = (LPCSTR)LockResource(hResData);CString strFName = m_FName + data;
does the resource contains unicode string.
|
|
|
|
|
Rajkumar R wrote: does the resource contains unicode string.
CString constructor will take care of that!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|
|
my question is still valid, "does the resource contains unicode string. "
ThatsAlok wrote: CString constructor will take care of that!
it will take the ANSI string CString(LPCSTR) and converts to Wide char. what happens if the resource is already a wide char string.
as OP already said resource contains wide char [^],
then
LPCSTR data = (LPCSTR)LockResource(hResData); it is wrong cast.
the solution can be
LPCTSTR data = (LPCTSTR)LockResource(hResData);
CString strFName = m_FName + data;
or specifically,
LPCWSTR data = (LPCWSTR)LockResource(hResData);
CString strFName = m_FName + data;
I agree if the resource string not wide char, your solution is ok.
|
|
|
|
|
Rajkumar R wrote: CString strFName = m_FName + data;
if you see, end result is going into CString,so it will take care by itself, since in starting where i replied her, about usage of L, there i become aware that she is working with wide character. so i suggested that solution!
your concern is also stand good, if it ansi app, then it could present problem.
thanks for good discussion!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow Never mind - my own stupidity is the source of every "problem" - Mixture
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
Support CRY- Child Relief and You/codeProject$$>
|
|
|
|