ListBox OnDblclkSout() Event
-
Hi, I get the list of file name with full path as the output in the list box. when the user double clicks on the list box item i want the file to be opened i have used the below code but it has no effect, its not opening the file. can u please tell me what will be the error.
void CSearchDlg::OnDblclkSout() { int d; d=m_SOUT.GetCurSel(); CString FName; m_SOUT.GetText(d,FName); ShellExecute(m_hWnd, "open", FName, NULL, NULL, SW_SHOWNORMAL); }
Regards, Vinay Charan. -
Hi, I get the list of file name with full path as the output in the list box. when the user double clicks on the list box item i want the file to be opened i have used the below code but it has no effect, its not opening the file. can u please tell me what will be the error.
void CSearchDlg::OnDblclkSout() { int d; d=m_SOUT.GetCurSel(); CString FName; m_SOUT.GetText(d,FName); ShellExecute(m_hWnd, "open", FName, NULL, NULL, SW_SHOWNORMAL); }
Regards, Vinay Charan.vinaycool wrote:
m_SOUT.GetText(d,FName); ShellExecute(m_hWnd, "open", FName, NULL, NULL, SW_SHOWNORMAL);
Is
FName
the full path to the file?
Nibu thomas A Developer Programming tips[^] My site[^]
-
vinaycool wrote:
m_SOUT.GetText(d,FName); ShellExecute(m_hWnd, "open", FName, NULL, NULL, SW_SHOWNORMAL);
Is
FName
the full path to the file?
Nibu thomas A Developer Programming tips[^] My site[^]
-
Hi Nibu thomas, List box contains a data like C:\dir\filename.ext i used the F5 and checked the value of FName i am getting Error symbol "FName" not found. Is the code correct to get the value of the selected item from the list box ??
Vinay wrote:
List box contains a data like C:\dir\filename.ext
The Fname should be in the format of '\\' instead of '\' for e.g C:\\path\\filename.extension instead of C:\path\filename.extension Knock out 't' from can't, You can if you think you can :cool:
-
Vinay wrote:
List box contains a data like C:\dir\filename.ext
The Fname should be in the format of '\\' instead of '\' for e.g C:\\path\\filename.extension instead of C:\path\filename.extension Knock out 't' from can't, You can if you think you can :cool:
-
Hi Laxman, I cant change the file path,because the items in the list box contains a data like D:\folder\folder\00000301\0123.txt Can u please tell me how to open the file ???
Vinay wrote:
Hi Laxman, I cant change the file path,because the items in the list box contains a data like D:\Parichay\Box01\00000301\0123.txt Can u please tell me how to open the file ???
void CSearchDlg::OnDblclkSout() { int d; d=m_SOUT.GetCurSel(); CString FName; m_SOUT.GetText(d,FName); modify the FName path here as above post ShellExecute(m_hWnd, "open", FName, NULL, NULL, SW_SHOWNORMAL); } Knock out 't' from can't, You can if you think you can :cool:
-
Vinay wrote:
List box contains a data like C:\dir\filename.ext
The Fname should be in the format of '\\' instead of '\' for e.g C:\\path\\filename.extension instead of C:\path\filename.extension Knock out 't' from can't, You can if you think you can :cool:
This answer is not correct. The double backslash is only neccessary if you use a literal string in your programming code. Here you just read the name entered in a listbox. I recoomend to use the source level debuger and place some breakpoints. You should always check following things: is the function actually called? Does the Listbox provide the correct handle? (I also recommend to handle LB_ERR so you see it if something is wrong)Do you get the correct string back from the listbox? Is your call to ShellExecute handled correctly? Does it give back an error message? I really do not understand why you need to ask such a question in the forum. You reaaly should invest some time to learn how to use the source level debugger and how to read the documentation.
-
Vinay wrote:
Hi Laxman, I cant change the file path,because the items in the list box contains a data like D:\Parichay\Box01\00000301\0123.txt Can u please tell me how to open the file ???
void CSearchDlg::OnDblclkSout() { int d; d=m_SOUT.GetCurSel(); CString FName; m_SOUT.GetText(d,FName); modify the FName path here as above post ShellExecute(m_hWnd, "open", FName, NULL, NULL, SW_SHOWNORMAL); } Knock out 't' from can't, You can if you think you can :cool:
-
Hi Laxman, I dont know how to do that can u please tell me how to alter the file name in the runtime...
vinaycool wrote:
I dont know how to do that can u please tell me how to alter the file name in the runtime...
Sorry , this is too much :| Knock out 't' from can't, You can if you think you can :cool:
-
Hi Laxman, I dont know how to do that can u please tell me how to alter the file name in the runtime...
vinaycool wrote:
how to alter the file name
#include <cstdio> int rename(const char* oldname, const char* newname);
Maxwell Chen