|
Hi,
I am trying to find a way of executing remote commands on an FTP server programmatically (i.e. some way of getting the same functionality as the ftp command 'quote'). CFtpConnection and the related classes don't have this functionality, so does anyone have any idea where I should look? are there some SDK commands I can use?
Thanks in advance,
Alex
|
|
|
|
|
MFC: CFtpConnection::Command
SDK: ::FtpCommand
|
|
|
|
|
Which version of MFC is this? I can't find a reference on MSDN either - I'm using VC 6.0...?
|
|
|
|
|
VC7. For VC6 use ::FtpCommand in wininet.dll(.lib)
|
|
|
|
|
AlexO wrote:
VC7. For VC6 use ::FtpCommand in wininet.dll(.lib)
Do you mean link with this? could you explain a bit more?
Thanks,
Alex
|
|
|
|
|
bool MyClass::ExecuteCommand(const CFtpConnection& rMyValidFtpconnection)
{
return TRUE == ::FtpCommand(rMyValidFtpconnection, FALSE, FTP_TRANSFER_TYPE_BINARY, _T("not_supported_by_mfc_ftp_command"), 12345, 0);
}
CInternetFile* MyClass::ExecuteCommandWithReturn(CFtpConnection& rMyValidFtpconnection)
{
HINTERNET hSteram = 0;
if(::FtpCommand(rMyValidFtpconnection, TRUE, FTP_TRANSFER_TYPE_BINARY,_T("not_supported_by_mfc_ftp_command_that_returns data"), 123456, &hSteram))
{
return new CInternetFile(hSteram , T("not_supported_by_mfc_ftp_command_that_returns data"), &rMyValidFtpconnection, TRUE);
}
return 0;
}
|
|
|
|
|
Cheers for the reply.
I understand how to use the function, but I simply can't use it. I get the message:
c:\ftpcmd\ftpcmd.cpp(32) : error C2065: 'FtpCommand' : undeclared identifier
or that 'FtpCommand is not a part of Global Namespace'.
I've tried linking with wininet.lib, and i'm on IE6.0.
How can I use this function?
-Alex
|
|
|
|
|
This brings me to the original point. When you look through MSDN for description of the function at the bottom of the page you see the following table:
Stock Implementation wininet.dll
Custom Implementation No
Header Wininet.h
Import library Wininet.lib
Minimum availability Internet Explorer 5
Minimum operating systems Windows NT 4.0, Windows 95, Windows CE 2.12
Which implies that you have to link to Wininet.lib(you got that), AND you have to include Wininet.h (you did not get that).
|
|
|
|
|
Just in case you forgot, in begining of stdafx.h you should have something like
#define _WIN32_IE 0x0500 //_WIN32_IE>=0x0500
|
|
|
|
|
Right, done all that.
I've linked with wininet.lib, #include'd wininet.h, and added the line you suggested to stdafx.h. no joy, however - I still get the same error messages.
I've looked through wininet.h and can't find the prototype for FtpCommand() which makes me think i might need an update...? Although MSDN (on the web - not my copy) mentions that this function should be available from Win95 up. I'm using Win98 SE.
Any ideas?
btw: really appreciate the help!
-Alex
|
|
|
|
|
I do not have VC6 at hand, but I suspect you need to download/install Platform SDK, where the Wininet.h is up to date. it is free but you have to search msdn.microsoft.com for it.
|
|
|
|
|
Cheers mate. That sorted it. It's amazing how hard it is to come across anything that makes you think that this could be the problem.
Thanks again,
Alex
|
|
|
|
|
I created a CButton with the BS_ICON and BS_TEXT flags. However I do not see the text. Is it possible to create a button with an icon and text with the default CButton? or must I use a derived class with ownerdraw ?
|
|
|
|
|
Hi,
I have a CPropertySheet window that has two pages. How can I do to make the width of each tab increase, if necessary, to each row of tabs fills the entire width of the tab control ?
thanks.
|
|
|
|
|
I want the user to type in a command in my edit box and then press enter to execute it.
I've subclassed my edit and intercept WM_COMMAND and VK_RETURN from LPARAM in the WndProc. But when I press enter, an annoying sound, like "pling" is playing. I don't want that sound! How to do?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
why dont you intercept OnOK()(or edit) and then execute it... or do i understand you wrong?
|
|
|
|
|
Again I forgot to tell that I'm doing pure Win32 programming!
Damn me!
NO MFC!
Do you know how to do it in Win32?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
nope, sorry,... my next solution would be to turn off the windows sounds...
|
|
|
|
|
Can you intercept the WM_KEYDOWN message with wParam == VK_RETURN when the focus is on the edit control?
Then just stop the edit control from processing it.
Roger Allen
Sonork 100.10016
WHats brown and sticky?
A stick or some smelly stuff!
|
|
|
|
|
Roger Allen wrote:
Can you intercept the WM_KEYDOWN message with wParam == VK_RETURN when the focus is on the edit control?
That's what I'm doing!
I wrote WM_COMMAND in the previous post but I meant WM_KEYDOWN.
Roger Allen wrote:
Then just stop the edit control from processing it.
Huh?
How!?
Hm... you mean in the message loop?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Rickard Andersson wrote:
message loop?
Yeehaaa!!
No "pling" anymore!
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
Yes, for example:
case VK_RETURN:
return 0;
That's what I do for all my keys that I want to disable...Win32 rocks!
|
|
|
|
|
georgiek50 wrote:
Win32 rocks!
Yeah!
It does!!!!
Are you doing much Win32 programming?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|
|
I am doing as much at time permits. I am a beginner, have been doing this for about 7-8 months. I started with Win32 with hopes to get an understanding of Windows then move to MFC but I decided to stick to Win32 for a lot longer because I don't like how MFC pre-writes code because at my level of programming I won't understand the written code I think and I hate not knowing what's going on. I picked up Petzold's book which was the best programming book I've read to date and I just work on a single program that I have on the internet putting in all different kinds of features to cover as many different aspects of programming as possible. I would like to do this professionaly eventualy. I assume you are? How is the work and how is the pay in Sweden for programmers?
|
|
|
|
|
georgiek50 wrote:
Petzold's book
Very good one!
georgiek50 wrote:
I assume you are?
Well, I have programming as a hobby, but in future I will be a professional programmer!
georgiek50 wrote:
How is the work and how is the pay in Sweden for programmers?
Actually I don't know.
Do you have a homepage?
ICQ?
Rickard Andersson@Suza Computing
C# and C++ programmer from SWEDEN!
UIN: 50302279
E-Mail: nikado@pc.nu
Speciality: I love C#, ASP.NET and C++!
|
|
|
|