|
Hello,
I have a problem, I have lost my database (ODBC with Access database) connection in my MFC program. Using which option, I can regain it? My recordset pointer is showing 0, please help.
Software Developer
Sanjay Khapre
-- modified at 8:26 Monday 13th February, 2006
|
|
|
|
|
How to add lib file in ur program other than project->setting->link,like what one does for header file(#include <stdio.h>)
Pls help me.Thanx in advance
never say die
|
|
|
|
|
|
thanx a lot
never say die
|
|
|
|
|
# pragma directive is one of best way to include the lib file.. but you can also add to you rpoject by just adding libaray file same way you add .cpp and .h file
"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
|
|
|
|
|
I want to execute an internal command in my program.
e.g. ren a.txt b.txt
winexec and ShellExecute do not execute internal commands.
system() executes it;
system("ren a.txt b.txt");
it wors fine; but shows consol window which i donot want to show.
Is there a way to execute the internal command without showing the consol window?
Thanks in advance
|
|
|
|
|
|
|
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
|
|
|
|