|
Hi
I wanted to make CListCtrl editabe :
void CTestListCtrlDlg::OnDblclkList(NMHDR* pNMHDR, LRESULT* pResult)
{
POSITION pos = m_ctlList.GetFirstSelectedItemPosition();
m_ctlList.EditLabel(m_ctlList.GetNextSelectedItem(pos));
*pResult = 0;
}
void CTestListCtrlDlg::OnEndlabeleditList(NMHDR* pNMHDR, LRESULT* pResult)
{
LV_DISPINFO* pDispInfo = (LV_DISPINFO*)pNMHDR;
if(pDispInfo->item.mask == 1)
m_ctlList.SetItemText(pDispInfo->item.iItem, pDispInfo->item.iSubItem, pDispInfo->item.pszText);
*pResult = 0;
}
Everything is ok but after double click the edit box is placed at the first column in the selected row (but not selected column)! but I want it in user selected column.
Please help
|
|
|
|
|
I believe the listview control only provides built-in functionality for editing the label
(the column with the icon in report view).
|
|
|
|
|
Hi
I have to work with a MFC based application for File Transfer in VC++. I used CString and CSocket Datatypes. But they are not accessible. Compilation error is the result. I am using VC 6.0.
These are the errors...
'CString' : undeclared identifier
'CSocket' : undeclared identifier
No explicit classes were used by me. These Datatypes were used within a function. Whether this will cause any error?.
From some site I got information to include a header file afxsocket.h and call AfxSocketInit(NULL) on init() function. That also caused me with 2 more errors as; afxsocket.h cannot be opened and that AfxSocketInit(NULL) is an undeclared identifier. So I removed that.
pls tell me. what is the requirement?. Why does this happen?.
Regards and Thanks...
|
|
|
|
|
What type of project option you have selected while creating it ?It should be, "MFC AppWizard".
|
|
|
|
|
Yes. I selected MFC AppWizard(exe) option only.
|
|
|
|
|
For CSocket afxsock.h need to be included.
But there should not be any error for CString . As its declared in afx.h and included by afxwin.h .
|
|
|
|
|
If u are using MFC based appliction than i dont think so that error occur...but u may include Afx.h & AfxSock.h...may be it will work
Yes U Can ...If U Can ,Dream it , U can do it ...ICAN
|
|
|
|
|
Did you inlcude afxsock.h
|
|
|
|
|
Are you sure your program is MFC but see here[^] if helpfuls
|
|
|
|
|
Hi all,
Thank You all For Your Valuable Help. It worked.
Vichitra M
|
|
|
|
|
How it worked suddenly
|
|
|
|
|
Hi Anil,
I had to include afxsock.h header file. Actually, I was not aware of that file.
Vichitra M
|
|
|
|
|
Hi,
I want to derive a class in my project in which i am taking strings at runtime & want to format it in (BOLD,ITALIC,TAB,NEW LINE,COLOR)etc.
after first string ,the other string can be taken & required to be formated.
at the end all the strings are appended & whole text should be displayed
on richedit control with each string having its own format.
i.e if i am having RichText class & rs is object of it then
i should be able to do following ...
RichText rs;
rs << rs.Bold(rs.LoadString(IDS_SUMMARY_SRCTITLE))
<< rs.Newline
<< rs.Italic(rs.LoadString(IDS_SUMMARY_SRCTITLE))
<< rs.LoadString(IDS_SUMMARY_SOURCE) // string table
<< rs.Tab;
& then display it in rich edit by ..
m_richedit.SetWindowText(rs.str());
If anybody knows how to do it Please Help me for it.
Thanks,
swapnil.
|
|
|
|
|
I think you asked like this question and did you see my link;)
|
|
|
|
|
now i want to append the string in formatted text.
Thanks,
Swapnil.
|
|
|
|
|
|
Hello all,
I have a win 32 API interface & a dll fie and I have connected my Dll with my interface its working properly.
In the Dll file I have a one program which lists all the files in the specified drive , now I want to access those file names and I want to add those files names in the list box in the interface.
Can anyone please tell me how to do this ??? I want to add each and every file name listed by the function in the dll and add those file names in the interface list box.
Please give me some idea how can I can proceed with my work.
Thanking you,
Suresh HC.
|
|
|
|
|
Can you show some code, that you are trying ?
|
|
|
|
|
Hi Prasad,
Thank you very much for the response.
I have this ListFiles Function in my Dll File , and I checked in the Console interface its lists all the files , now I want to add each and every file names to win 32 Api interface in the list box.
<br />
Listfiles function in the Dll file.<br />
<br />
STDMETHODIMP_ (void)<br />
CMyA::XMyAObj::ListFiles (char *dir) <br />
{<br />
-----<br />
----------<br />
----------------<br />
<br />
_chdir(dir);<br />
if( (File_handle = _findfirst( "*", &file_s )) == -1L ) {<br />
printf( "No files in current directory!\n" );<br />
}<br />
else if (file_s.attrib & _A_NORMAL){<br />
sprintf (name, "%s",dir);<br />
fnum++;<br />
insert (fnum, dir);<br />
} <br />
else {<br />
do {<br />
if (strcmp (file_s.name, ".") == 0 || strcmp (file_s.name, "..") == 0)<br />
continue;<br />
if (strlen (dir) + strlen (file_s.name) + 2 > sizeof (name)) {<br />
fprintf (stderr, "Dir name too long\n");<br />
return;<br />
}<br />
<br />
if (file_s.attrib & _A_SUBDIR) {<br />
sprintf (name, "%s/%s",dir, file_s.name);<br />
ListFiles(name);<br />
}<br />
<br />
-----<br />
----------<br />
----------------<br />
<br />
In interface I am passing the directory name like this
pA->ListFiles(itemText);
now I want to know how to extract all the file names and add it to list box in the interface. ???
|
|
|
|
|
Use LB_ADDSTRING message for list box.
char *pFileName = "SomeThing";
SendMessage(hLBox,LB_ADDSTRING,0,pFileName);
|
|
|
|
|
Can I directly access the Interface List box from the Dll ??? is that so simple ???
|
|
|
|
|
What do you mean by interface ? Are you using a UI COM component, havinig list box in it, and you want to add file names to it ?
|
|
|
|
|
Prasad I have two files now one Win32 api interface (.exe) where I have the list box.
2nd one is I have dll file with List file function.
I am passing the parameter to dll from exe by below code
<br />
<br />
IClassFactory *pclsf;<br />
IUnknown *pUnk;<br />
IMyA *pA;<br />
<br />
CoInitialize(NULL);<br />
<br />
HRESULT hr = CoGetClassObject(<br />
MYA_CLSID,<br />
CLSCTX_INPROC,<br />
NULL,<br />
IID_IClassFactory,<br />
(void **) &pclsf);<br />
<br />
<br />
pA->ListFiles("Dir name");<br />
now I am actually passing the values to dll which does the process.
After that process its list some file names which I have to add in my interface. Since the List box is in Interface(exe), I want to know how to access List box from the dll ???
Can I directly give this code
<br />
char *pFileName = "SomeThing";<br />
SendMessage(hLBox,LB_ADDSTRING,0,pFileName);
in the DLL will this work ???? but how to get handle of the list box and all ??? can u please tell me.
|
|
|
|
|
Suresh H wrote: Since the List box is in Interface(exe), I want to know how to access List box from the dll ???
Your interface should have some method to do this. Because, it will have access to window handle.
Or, interface should expose listbox's handle as property, where as you can use it from your code.
|
|
|
|
|
Hi Prasad,
I am very much new to this .. can u please give an example how to do this.
How to pass and access list box from dll.
|
|
|
|