|
|
In addition to the above responses, you could also try: (I know WinExec is old but since it works still)
WinExec("cmd /c ren c:\\a.txt b.txt", SW_HIDE);
It is the /C switch which causes cmd.exe to terminate after executing the command. And the second parameter to WinExec : SW_HIDE causes the window not to be shown.
If the program should run on Win9X also, then make it command.com instead of cmd.exe .
this is this.
|
|
|
|
|
pc_dev wrote: system("ren a.txt b.txt");
why not you use direct api for that.. as there is atleast one api for each internal command.. e.g. for ren - rename
"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 everyone,
Does anybody know what caused the 'bad file number' error? How to resolve that problem? And, is there a way to set the file number manually?
Thanks!
|
|
|
|
|
What 'file number error'? I don't know what you are talking about (maybe somebody does but not me ). When does this error occur ? Be more explicit.
|
|
|
|
|
Hi, thanks for responding.
There was a problem with my program that it always return file pointer = NULL on the second (and further) attemps of openning file. So I tried to print out what error occured by using this command:
String error = strerror(errno) ;
The 'bad file number' was the message that I got in the string error.
Any idea?
-- modified at 6:01 Monday 13th February, 2006
|
|
|
|
|
Are you trying to open it when it hasn't been closed ? Maybe the problem is there.
|
|
|
|
|
I think I have closed it. Below is the function, probably you can find some errors there:
void afunct(AnsiString filename)
{
const char *file = filename.c_str();
FILE *fileptr = fopen(file, "rt");
if(fileptr == NULL)
{
perror("Unable to open file for reading");
String error = strerror(errno) ;
MessageBox(NULL,"Error",NULL,0);
exit(0);
}
else
{
//do something
}
fclose(fileptr);
}
|
|
|
|
|
Hi All,
I have customized File Open Dialog for my application (added a checkbox to it) and also overrode some of the default functionality.
I find that File Name Combo is not getting updated when the user selects a file from the list view.
Can anyone indicate where the problem could be?
Thanks and Regards,
Anil
|
|
|
|
|
Anil_vvs wrote: Can anyone indicate where the problem could be?
Your code is the problem.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" - mYkel - 21 Jun '04
"There's not enough blatant self-congratulatory backslapping in the world today..." - HumblePie - 21 Jun '05
Within you lies the power for good - Use it!
|
|
|
|
|
in my project, i splite Window into view Ctreeview and CView:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if (!m_wndSplitter.CreateStatic(this, 1, 2))
return FALSE;
CRect rect;
GetClientRect(&rect);
int mWidth=rect.Width();
if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CTreeView), CSize(mWidth/4, 0), NULL))
{
m_wndSplitter.DestroyWindow();
return FALSE;
}
if (!m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CView), CSize(0, 0), NULL))
{
m_wndSplitter.DestroyWindow();
return FALSE;
}
return TRUE;
}
but i can't use functions of the tree Example:
void CMainFrame::OnTreeSelChange(NMHDR *pNMHDR, LRESULT* pResult)
{
LPNMTREEVIEW pTV = (LPNMTREEVIEW)pNMHDR;
AfxMessageBox(L"OnSelchangedTree ");
*pResult=0;
}
please! help me.
|
|
|
|
|
in my project, i splite Window into view Ctreeview and CView:
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
{
if (!m_wndSplitter.CreateStatic(this, 1, 2))
return FALSE;
CRect rect;
GetClientRect(&rect);
int mWidth=rect.Width();
if (!m_wndSplitter.CreateView(0, 0, RUNTIME_CLASS(CTreeView), CSize(mWidth/4, 0), NULL))
{
m_wndSplitter.DestroyWindow();
return FALSE;
}
if (!m_wndSplitter.CreateView(0, 1, RUNTIME_CLASS(CPropertyView), CSize(0, 0), NULL))
{
m_wndSplitter.DestroyWindow();
return FALSE;
}
return TRUE;
}
but i can't use functions of the tree Example:
void CMainFrame::OnTreeSelChange(NMHDR *pNMHDR, LRESULT* pResult)
{
LPNMTREEVIEW pTV = (LPNMTREEVIEW)pNMHDR;
AfxMessageBox(L"OnSelchangedTree ");
*pResult=0;
}
please! help me.
|
|
|
|
|
Hoping that you have add the message manually
plz check if you have added the statement
ON_NOTIFY_REFLECT(TVN_SELCHANGED, OnTreeSelChange) in the messagemap?
Regards
Anil
|
|
|
|
|
I am using API SHGetFolderPath and mentioned
#include<shlobj.h> header file in stdafx.h
but it is showing me error
error C2065: 'SHGetFolderPath' : undeclared identifier
Pls help me .Thanx in advance
never say die
-- modified at 2:51 Monday 13th February, 2006
|
|
|
|
|
#define _WIN32_IE 0x0500 in stdafx.h
Owner drawn
Jesus Loves
|
|
|
|
|
In the header file shlobj.h this mentioned
#ifndef _WIN32_IE<br />
#define _WIN32_IE 0x0501<br />
#else<br />
#if (_WIN32_IE < 0x0400) && defined(_WIN32_WINNT) && (_WIN32_WINNT >= 0x0500)<br />
#error _WIN32_IE setting conflicts with _WIN32_WINNT setting<br />
#endif<br />
#endif
still i mentioned in the stdafx.h
#ifndef _WIN32_IE<br />
#define _WIN32_IE 0x0500<br />
#endif
include <shlobj.h>
but it is still showing me same error.Pls help me
never say die
-- modified at 4:08 Monday 13th February, 2006
|
|
|
|
|
Why are you defining _WIN32_IE twice.
Owner drawn
Jesus Loves
|
|
|
|
|
Thats why i used
#ifndef _WIN32_IE
Ok I remove it but it is showing me same error
#ifndef _WIN32_IE
#define _WIN32_IE 0x0500
#endif
Pls help me.Thanx in advance
never say die
-- modified at 4:11 Monday 13th February, 2006
|
|
|
|
|
It's working here fine.
Owner drawn
Jesus Loves
|
|
|
|
|
I am using it in a Console Win32 Application in VC 6.Is this troubling me.
never say die
-- modified at 4:34 Monday 13th February, 2006
|
|
|
|
|
|
sunit5 wrote: I am using API SHGetFolderPath and mentioned #include<shlobj.h> header file in stdafx.hbut it is showing me errorerror C2065: 'SHGetFolderPath' : undeclared identifier
Are you using Visual Studio 6 or .Net 2003
"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
|
|
|
|
|
How we calculate the size of Jpeg image(not dimension),to recover the image if our system is formatted and the Original information about the size is Corrupted.
singhanshul
|
|
|
|
|
Whats the meaning of size?
|
|
|
|
|
Actually we want to find out the size of jpeg file in the compressed form.Because when we recover deleting JPEG file some time it is possible that the header cotaning information about size is cruptted then what we do in that case to calculate the size so we recover this jpeg file.
singhanshul
-- modified at 4:00 Tuesday 14th February, 2006
|
|
|
|