|
i have a question to ask!
I,m having some trouble with Ftp error code, After i catch error from 'SetCurrentDirectory()' (error code 12031- connection to the server was reset)
I try to display it (using my 'DisplayErrorString' function with below code in):
'FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM,NULL,dwError,<br />
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), <br />
achBuffer, 120, NULL) ;'
but I get nothing, empty string!
Enyone know what to do?
Thanx!
|
|
|
|
|
josip cagalj wrote: 'FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM,NULL,dwError,
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),
achBuffer, 120, NULL) ;'
I hope you have got the dwError from the API GetLastError .
You should call the GetLastError function immediately when a function's return value indicates that such a call will return useful data.
Regards,
Paresh.
|
|
|
|
|
Jes I do. I Call GetLastError immediately
if (!theApp.m_pConn->SetCurrentDirectory(voxftpdir))<br />
{<br />
CString str;<br />
err=GetLastError();<br />
...<br />
|
|
|
|
|
josip cagalj wrote: CString str;
err=GetLastError();
Please change the order. Hope this will serve your purpose.
Regards,
Paresh.
|
|
|
|
|
I think we misunderstand, so I'll recreate my question.
I switched off lan-cable on purposely to see how will my app react!
When I tried to get something from web server I used SetCurentDirectory() which trow error code 12031, but when i tried to get text explaining using:
'FormatMessage (FORMAT_MESSAGE_FROM_SYSTEM,NULL,dwError,MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT),achBuffer, 120, NULL) ;'
which puts it in 'achBuffer' i've got nothing!!!!
Afterward i've searched the web and find out that 1203 error code stands for 'connection to the server was reset'.
My problem is how can I get it from a above solution (FormatMessage) and post it with AfxMessageBox???
Thanks!
|
|
|
|
|
There's probably no message available in the system. If FormatMessage fails (returns 0) then
call GetLastError()...you'll probably get error code 317 ("The system cannot find message text
for message number ...").
You'll need to supply your own error strings.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Whats the return value of FormatMessage?
|
|
|
|
|
I've solved the problem, I just needed to load "WININET.DLL"
HMODULE m_hWininet = LoadLibrary(_T("WININET.DLL"));<br />
and than
FormatMessage (<br />
FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_FROM_HMODULE,<br />
m_hWininet,dwError,<br />
MAKELANGID(LANG_NEUTRAL, SUBLANG_DEFAULT), achBuffer, 120,<br />
NULL) ;<br />
And that it's!
Thanks to all!
P.S.
Don't forget to free library after!
|
|
|
|
|
Hi i am working on a project where it is reading files (names are stored on a CArray[CS ,CS] FArray ). CS = CString and [ = < ] = >
While it Reading a file :
In each Buffer line it search if there is any word (stored in a CArray[CS,CS] WArray) int ntimes is the number that each WArray element found in Buffer Line
and the end each ntimes is stored in RArray.
Code is working perfect till ifstream TextFile
when i am adding the next code lines the .exe i build is freezing and
become (Not Responding)
if someone could see the reading code for some faults i would greatful
CArray<cstring ,="" cstring=""> RArray;
CString FilePathName;
CString LineRead ;
int ntimes=0;
const int sz =100;
char buf[sz];
m_FolderName = "C:\\test123\\";
for ( int p = 0 ; p < FArray.GetSize() ; p++)
{
FilePathName = m_FolderName + FArray.GetAt(p);
m_List.AddString(FilePathName);
ifstream FileText(FilePathName);
while(FileText.get(buf,sz))
{
FileText.get();
LineRead = (LPCSTR) buf;
for ( int m = 0 ; m < WArray.GetSize() ; m++)
{
int nStart=1;
while ( LineRead.Find(WArray.GetAt(m),nStart)!=0)
{
ntimes = ntimes +1;
nStart= LineRead.Find(WArray.GetAt(m) , nStart);
}
RArray.Add(""+ntimes);
}
}
FileText.close();
return;
}
|
|
|
|
|
|
|
hi.
I have created scrollbar in the application but the scrollbar move very slow when I clicked the two ends of the scrollbar. what should I do?
|
|
|
|
|
ReturnRain wrote: what should I do?
That depends on what you are doing in response to the WM_HSCROLL/WM_VSCROLL messages.
If you are doing a lengthy/slow operation then it's going to be slow.
Or maybe you need to scroll by a greater amount for each scrollbar unit scrolled.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Hi,
it can depends on your UpdateWindow () too. If you are redrawing a lot of things it can difficult other things. Just take a look if other things go slow, and try to make your code faster.
I had the same problem because I was bringing CObject derived classes and erasing them after the use. I solve my speed problem using pointers. I should not copy objects but accessing them directly.
Take a look on your code
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
How to add an image to a list ctrl. i want to add different icons for the column 1 for all the rows.
Anil Jillella
|
|
|
|
|
You have to use an Image List see here [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
|
http://www.boost.org/
In case you are not aware!
|
|
|
|
|
Post it in the lounge
-Sarath.
"Great hopes make everything great possible" - Benjamin Franklin
|
|
|
|
|
this has been announced by nemanja trifunovic 3 days ago[^] on his CP blog
|
|
|
|
|
Hi. I need to create the setup.exe file for the aplication I have developed.
It works perfectly on my computer, but I want to try it on another computer to see exactly how would it work on the customer´s PC.
To know exactly which dll it needs, I have taken only the exe to the new computer and executed it. That way, the exe asks for the dll it needs. After doing with 4 dlls, when I execute the program it makes nothing. The program starts and finishes in about a half second.
I have tried to write a log to know in wich line it breaks the execution, but it nowhere after the OnInitDialog event.
I have tried to use the installshield and the Inno Setup, and it doesn´t work. A blank messagebox appears when executing the app.
I don´t know what to do, could someone help me please...?
I use Visual C++ MFC.
|
|
|
|
|
Can you more explain about your program?
|
|
|
|
|
What do you need to know?
|
|
|
|
|
Application type? does these system that you try to run your program has same OS ?
|
|
|
|
|
The app is made with MFC Wizard and the OS where I have developed it is XP. The costumer computer has 2000 OS.
|
|
|
|