|
|
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() <br />
{<br />
<br />
int d;<br />
d=m_SOUT.GetCurSel();<br />
CString FName;<br />
m_SOUT.GetText(d,FName); <br />
ShellExecute(m_hWnd, "open", FName, NULL, NULL, SW_SHOWNORMAL); <br />
<br />
<br />
}
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[^]
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
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
|
|
|
|
|
vinaycool wrote: how to alter the file name
#include <cstdio><br />
int rename(const char* oldname, const char* newname);
Maxwell Chen
|
|
|
|
|
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.
|
|
|
|
|
Can you tell me how to use graphics in a console application(Ex : Draw a line or something)!I can do that in turbo C but in VC++ I dont know any function or any thing to do that!Please help me!
Thank!
|
|
|
|
|
Take a look here[^], I think you'll find what you are looking for. Especially the beginners section.
Cédric Moonen
Software developer
Charting control
|
|
|
|
|
kflrei wrote: Can you tell me how to use graphics in a console application(Ex : Draw a line or something)!
Well you have to grab the device context of the Console Application. Then use normal SDK paint functions to paint to this device context.
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
kflrei wrote: !I can do that in turbo C but in VC++ I dont know any function or any thing to do that!Please help me!
you have to learn Windows Programming to DRAW in Windows World!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Thank for your advice!I'll think about that!
(I only want to create some program that can run before windows start!Graphics only to make it easy to use!)
|
|
|
|
|
Hi,
I have 2 edit box in my dialog m_INDEX_FILE & m_WORD & a Search button.
on the OnSearch()i want to check if the user has entered data or not if the user has not entered data then i want to disply a message box for that i have used below code. but the problem is below code has no effect ...can u please tell what changes has to be made....
void CSearchDlg::OnSearch()
{
UpdateData(TRUE);
if (m_INDEX_FILE.GetLength() < 0 )
{
MessageBox("Select the Index File before searching !","Asis Search Engine",MB_OK | MB_ICONINFORMATION);
return;
}
if (m_WORD.GetLength() < 0 )
{
MessageBox("Enter the word to be searched","Asis Search Engine",MB_OK | MB_ICONINFORMATION);
return;
}
}
Regards,
Vinay Charan.
|
|
|
|
|
what is m_INDEX_FILE ?CString and m_WORD
whitesky
|
|
|
|
|
check equality too... zero length strings
m_INDEX_FILE.GetLength() <= 0
|
|
|
|
|
<br />
void CAnswerDlg::OnBnClickedMybutton()<br />
{<br />
CString str;<br />
m_Edit1.GetWindowText(str);<br />
if(str.IsEmpty())<br />
MessageBox("Empty");<br />
else<br />
MessageBox("not");<br />
}<br />
<br />
whitesky
|
|
|
|
|
Hi ,
Instead of UpdateData() try using GetWindowText():
void CSearchDlg::OnSearch()
{
CString szCaption;
m_INDEX_FILE.GetWindowText(szCaption);
if (!szCaption.IsEmpty())
MessageBox("Select the Index File before searching !","Asis Search Engine",MB_OK | MB_ICONINFORMATION);
return;
}
Regards,
Eli
|
|
|
|
|
Vinay wrote: I have 2 edit box in my dialog m_INDEX_FILE & m_WORD & a Search button.
on the OnSearch()i want to check if the user has entered data or not if the user has not entered data then i want to disply a message box for that i have used below code. but the problem is below code has no effect ...can u please tell what changes has to be made....
Try the following Code.
void CSearchDlg::OnSearch()
{
UpdateData(TRUE);
if (m_INDEX_FILE.IsEmpty())
{
MessageBox("Select the Index File before searching !","Asis Search Engine",MB_OK | MB_ICONINFORMATION);
return;
}
if (m_WORD.IsEmpty())
{
MessageBox("Enter the word to be searched","Asis Search Engine",MB_OK | MB_ICONINFORMATION);
return;
}
UpdateData(FALSE);
}
Knock out 't' from can't,
You can if you think you can
|
|
|
|
|
Hello All,
I got the solution I used below code,its working fine.
void CSearchDlg::OnSearch()
{
UpdateData(TRUE);
if (m_INDEX_FILE.GetLength() <= 0 )
Thank you very much ......
|
|
|
|
|
vinaycool wrote: on the OnSearch()i want to check if the user has entered data or not if the user has not entered data then i want to disply a message box for that i have used below code. but the problem is below code has no effect ...can u please tell what changes has to be made..
what about handlling NM_CHNAGE MESSAGE, and setting flag accordingly
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Hi,
Im Delevoping a GUI in MFC.
I am facing the following problem in Output Window of my GUI.
I used stringray SECTabWnd class as my base class .My problem is ,When i click on the arrow head button on the scroll bar the text in the output window is getting scrolled but When I use the rectangle box(Thumb buttom) inside the scroll bar the thumb button ramins inactive(not getting scrolled as with the text).Can any body give me appropriate solution for this..Thanx.
Regards,
Hari
|
|
|
|