|
I want to initialize my tree control with system directory tree in OnInitdialog function so that i can select my folder.
Remember I am working in mfc.
please help me.
Dhiraj
Dhiraj Kumar Saini
|
|
|
|
|
|
I have used the code with the link but it is giving error.
Can u give ne another link or code
i know its simple but not able to do it.
Thanks In advance.
Dhiraj
|
|
|
|
|
Dhiraj kumar Saini wrote: it is giving error
It is strange...What kynd of error?
alseway, in CP there are a section for articles related to custom tree contrlols:
All the articles on CP[^].
I can suggest
this[^]
this[^]
or this[^]
Russell
|
|
|
|
|
|
ACtually when i was trying to use the code of OnInitdialog function in my onititdialog function with InsertItem function it was giving two errors .
thet were related to linking error.
Remeber I am only using cod eof OnInitDialog funcion.
Dont know why.
Dhiraj
|
|
|
|
|
I think you have to study better the code given with the article...surely you have to copy something more than the code inside the function OnInitdialog
Russell
|
|
|
|
|
Hi,
Sorry to bother you I have gone through the code and implemented it also. Now the problem i am facing in my tree control is that it is showing all the drives and network neighbourhood but when i am selecting any one of them it is not expanding. I dont know why although i have added the event handlers for expanding.
please help me.
Dhiraj
|
|
|
|
|
hello to all,
i want to use "Navigate" function of CWebBrowser2 class which i have added as a activex control in my programm but i dont know how to use it in different classes other than CMainFrame and CView class as i dont know what will be the pointer to the frame in which the web site will be dispalyed. Bcoz i want to navigate to a given web site URL after clicking a perticular button of a dialog box means i want to use "Navigate" function in a message handler of that dialog box class, how can i generate a frame in which the web site will be dispalyed.can anybody help me plz.
Thanks and regards,
Anay Kulkarni
|
|
|
|
|
Hello Friends,
I am trying to retrive the Text From rich Edit control. But When I check it it return with empty string only.
I am using the following code
<code>
TCHAR Text[100] = {};
TCHAR SelText[100] = {};
GETTEXTEX GetText;
GetText.cb = wcslen(Text);
GetText.flags =GT_DEFAULT;
GetText.codepage =CP_ACP ;
GetText.lpDefaultChar = NULL;
GetText.lpUsedDefChar = NULL;
SendMessage(hEdit,EM_GETTEXTEX,(WPARAM)&GetText,(LPARAM)Text);
SendMessage(hEdit,EM_GETSELTEXT,(WPARAM)0,(LPARAM)SelText);
</code>
If u find any problem plz tell me. Thnx in Advance
-- modified at 7:46 Tuesday 18th September, 2007
|
|
|
|
|
sizeof(Msg); should return 100.
Also in the second line you are trying to get the selected text, but passing the flag as GetText.flags =GT_DEFAULT. so it will not work.
The first line with EM_GETTEXTEX is working fine with the changes.
|
|
|
|
|
Actully I am using wcslen(Text) instead of sizeof(Msg) Now. But still its giving me empty string in both EM_GETTEXTEX and EM_GETSELTEXT.
TCHAR *Text = new TCHAR[100];<br />
TCHAR SelText[100] = {};<br />
<br />
GetText.cb = wcslen(Text);<br />
GetText.flags =GT_SELECTION;<br />
GetText.codepage =CP_ACP ;<br />
GetText.lpDefaultChar = NULL;<br />
GetText.lpUsedDefChar = FALSE;<br />
<br />
lr =SendMessage(hChild,EM_GETTEXTEX,(WPARAM)&GetText,(LPARAM)Text);<br />
<br />
SendMessage(hChild,EM_GETSELTEXT,(WPARAM)0,(LPARAM)SelText);<br />
According to u I have made the changes. But Getting Access violation Error as below
access Violation in module Riched20.dll write at process 007C8268
I m not getting what is happening.
|
|
|
|
|
Following is the code i m using, and it's working.
CHAR Text[100];
GETTEXTEX GetText;
GetText.cb = sizeof(100);
GetText.flags =GT_DEFAULT;
GetText.codepage =CP_ACP ;
GetText.lpDefaultChar = NULL;
GetText.lpUsedDefChar = NULL;
::SendMessage(GetDlgItem (IDC_RICHEDIT21)->m_hWnd,EM_GETTEXTEX,(WPARAM)&GetText,(LPARAM)Text);
|
|
|
|
|
I am using win32 Dialog based application.
And the RichEditBox is in the other application
I have retrived the Handle of it through FindWindow() Function.
and When I use your code it gives me the Access violation Error.
I am not getting any Error when I set the text in the Rich Edit Control using WM_SETTEXT .
Do you have any idea why this is happening
|
|
|
|
|
if you are using WM_GETTEXT message from different process, in xp you will get Access Denied message (Atleast in an edit box with password option on).
For more information search CodeProject for "SUPER PASSWORD SPY" and read the details.
|
|
|
|
|
I know about that. But It is simple Rich Edit Box. And its Property is not setted to Password Type.
I.e. What ever I write down in that Rich Edit Box. I am able to see that. And I can retrive the Text using WM_GETEXT. but I want only the Text selected By user. Is there any other way to do it. Rather than EM_GETSELTEXT. Becoz it is unable to retrive the Text.
|
|
|
|
|
GauranG033 wrote: GetText.cb = wcslen(Text);
Text has no length, so 0 is being assigned to GetText.cb .
GauranG033 wrote: GetText.codepage =CP_ACP ;
Have you also tried 1200 here?
GauranG033 wrote: SendMessage(hEdit,EM_GETTEXTEX,(WPARAM)&GetText,(LPARAM)Text);
What value is returned?
GauranG033 wrote: SendMessage(hEdit,EM_GETSELTEXT,(WPARAM)0,(LPARAM)SelText);
This will obviously return 0 if no text is selected.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You are right it return 0.
And I am using following .
TCHAR *Text = new TCHAR [100]
GetText.cb = wcslen(Text);
Bye the Way. When I use the EM_GETSELTEXT then also it return with 0 and Text is empty.
I dont think if I am using EM_GETSELTEXT i need to Initialize the GETTEXTEX structure. should I ??
I m using it like this.
<br />
lr = ::SendMessage(hChild,EM_GETSELTEXT,(WPARAM)0,(LPARAM)SelText);<br />
lr = 0 and Text = "" after it returns.
hChild is the Handle to Rich Edit Box which is in Different window.
I am retriving it through FindWindow()
|
|
|
|
|
GauranG033 wrote: TCHAR *Text = new TCHAR [100]
GetText.cb = wcslen(Text);
Text has no length, so 0 is being assigned to GetText.cb . I've heard that before, but can't recall where!
GauranG033 wrote: When I use the EM_GETSELTEXT then also it return with 0 and Text is empty.
As it should, when no text is selected in the control.
GauranG033 wrote: I dont think if I am using EM_GETSELTEXT i need to Initialize the GETTEXTEX structure. should I ??
Correct.
GauranG033 wrote: hChild is the Handle to Rich Edit Box which is in Different window.
I am retriving it through FindWindow()
So have you verified that the window handle is correct?
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Handle is correct.
Because When I am using this handle to set/get the text in/from Rich Edit Box through WM_SETTEXT and WM_GETTEXT it's working.
But I want Only the text selected By user. So I am using EM_GETSELTEXT, but as i told you its not working.
|
|
|
|
|
GauranG033 wrote: But I want Only the text selected By user. So I am using EM_GETSELTEXT, but as i told you its not working.
This is just a guess, but have you considered selecting some text in the edit control before calling SendMessage() ?
<notice>
Please fix your screen name. I'm really tired of having to modify my posts as a result of your broken tag.
</notice>
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Yes, I am selecting the text before making a call.
And By the way I check the sup tag in my name and it is closed properly.
|
|
|
|
|
GauranG033Yes, I am selecting the text before making a call.
Then something else is going on, like the value of the cb member.
<blockquote class="FQ"><div class="FQA">GauranG033</sup wrote:</div>And By the way I check the sup tag in my name and it is closed properly.</blockquote>
Notice that it is not (two examples above). I'm not sure what you are looking at, but a quick look at the HTML source will show you otherwise. You can also respond to your own message, select a few words and click the Quote Selected Text button.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Please fix your name. You have a </sup> tag that is not closed properly.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
sir,
In My sample project i used IActiveDesktop::SetWallpaper method,But it is giving an RunTime error like The Instruction at "0x0041432a" referenced memory at "0x00000000". The memory could not be "read"
here the code is...................
void CSlidercontrolDlg::OnButtonSetdesktop()
{
// TODO: Add your control notification handler code here
USES_CONVERSION;
lp=A2CW(stWallpaper);
pIActiveDesktop->SetWallpaper(lp,0);
}
In this regard please rectify the runtime error what i am getting or send me an complete example which is using IActiveDesktop::SetWallpaper() and some other methods in IActiveDesktop.
Please send a solution as soon as possible
|
|
|
|