|
Actually, that's not entirely true. Most FTP servers I've seen actually get command support from binaries in their bin directory. If someone were to add a copy command to the bin directory and allow certain users to access it, they should be able to move and / or copy files. The command set in FTP servers usually come from a combination of built-in functions (like GET and PUT usually) and applications. If the FTP server had such commands, you should be able to issue a custom command. Otherwise, downloading and re-uploading would, of course, work.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
Heath Stewart wrote:
If the FTP server had such commands, you should be able to issue a custom command.
That's the issue. "If"
I've seen a couple of servers that support this, but not many. It's not standard and may work differently on some servers to others.
I still think it's a PITA that ftp doesn't support copying/moving in the standard
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thanks for your insight Ryan and to all others who have commented. This has confirmed my suspicions.
R.Bischoff | C++
.NET, Kommst du mit?
|
|
|
|
|
Should not be too hard but I'm probably just very stupid
I have a dialog with a listbox.
I want to know when the mouse-button is released in the listbox's client-area.
I DON'T want to create a special class for the listbox.
So how can my dialog get an OnLButtonUp from the listbox..?
Any help would be greatly appreciated!
|
|
|
|
|
One solution is to add the appropriate mouse message handler and determine whether the mouse is over the client area via PtInRect().
Kuphryn
|
|
|
|
|
Well, that was my first try too.
But when the mouse is over the listbox's client-area the dialog doesn't receive the OnLButtonUp-message...
|
|
|
|
|
your dialog is receiving only
notification messages from it's childs
WM_NOTIFY message and notification code.
You could simulate this behaviour
by subclasing the listbox and send a message to it's parent (dialog)
use CHookWnd class By PJ Naughter
http://www.codeproject.com/cpp/chookwnd.asp
|
|
|
|
|
I am trying to build a property sheet with its pages instantiated in the header file of the sheet. The project builds fine, but gives an assertion error on ASSERT(afxCurrentResourceHandle != NULL) as soon as execution is attempted (in the construction of a page). This error does not occur if pages are instatiated "on-the-fly" in the body of the property sheet previous to the DoModal() call. But I need to have property page member functions visible to other classes, so they need to be predefined. Any ideas as to why it barfs on property page construction in this setting?
Thanks in advance,
Ben
|
|
|
|
|
Post the code in the sheet's constructor and the code that adds the pages.
Kuphryn
|
|
|
|
|
Constructor:
CMsgETIData::CMsgETIData() : CPropertyPage(CMsgETIData::IDD)
{
//{{AFX_DATA_INIT(CMsgETIData)
// NOTE: the ClassWizard will add member initialization here
//}}AFX_DATA_INIT
}
How I _was_ adding pages:
CMsgETIData m_page2;
m_DQRMsgCreateSheet.AddPage(&m_page2);
m_DQRMsgCreateSheet.DoModal();
m_DQRMsgCreateSheet.RemovePage(&m_page2);
How I _want_ to add pages:
in the sheet header:
public:
CMsgETIData m_page2;
in the body:
m_DQRMsgCreateSheet.AddPage(&m_page2);
m_DQRMsgCreateSheet.DoModal();
|
|
|
|
|
Sorry...actually I want to do
AddPage(&m_page2)
in the constructor of the sheet!
|
|
|
|
|
Correct. The call to AddPage() should work correct in the constructor.
Kuphryn
|
|
|
|
|
Correct. The call to AddPage() should work correct in the constructor.
Should is the key word...that is the problem!
|
|
|
|
|
Hello,
I want to search all drives for particular filetypes. I know how to search all the directorys on a drive, but I don't know how to get a list of all the drives availeble on the computer (I don't need a list of network drives)?
many thanks in advance
|
|
|
|
|
Check out GetLogicalDrives()[^].
"Blessed are the peacemakers, for they shall be called sons of God." - Jesus
"You must be the change you wish to see in the world." - Mahatma Gandhi
|
|
|
|
|
thanks
|
|
|
|
|
Hello!
I am writing a program which needs to read the data file (in plain text format) to the memory structure (array).
Currently, I am reading the text data file one line at a time using CStdioFile and CString. For each line in the CString, from left to right, decode each segment (separated by ,) into another CString and then atof it to a real number. This is very slow and read in a 600K file will needs 10 seconds or more.
How can I do it faster using C++? (I don't want to mix C in it.)
Thanks a lot.
The data file looks like:
134.235, 235.23, 2353.25, 252.23, 2356.247, .....
234.235, 635.23, 6233.25, 772.23, 8356.247, .....
534.235, 895.23, 3553.25, 243.23, 7856.247, .....
I am using a data structure similar to a 2D array to hold it.
|
|
|
|
|
Kevein wrote:
This is very slow and read in a 600K file will needs 10 seconds or more.
That is redicously slow. It should be < 1 sec on a reasonably machine. I'd look at using a Memory Mapped File and possibly STL. With CStdioFile and CString there is a lot of waisted overhead moving stuff around in memory, allocating memory etc.
Have a look at the pugXml article here on CP http://www.codeproject.com/soap/pugxml.asp[^] which shows an example of using MMF. I can open and parse a 10M XML file on my slow old 550Mhz PC in approx .5 sec using this code.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Why not mix with C, the CStdioFile::ReadString() calls _fgetts() (a C function!)...
Is the data on a single line or are there any cr/lf pairs?
I'll continue assuming that there are not!
Since _fgetts() reads the data character by character this solution works faster and it saves you the time of splitting the strings!
int nRead = 0; // number of bytes read
char cBuf = 0; // charBuffer
char szNumber[100]; // the string to use with atof
for(int nIndex = 0;;nIndex++)
{
::ReadFile((HANDLE)CStdioFile::m_hFile, &cBuf, 1, &nRead, NULL)
if(cBuf == EOF)
break;
if(cBuf == ',')
{
szNumber[nIndex] = '\0';
// add to your 2d array here with atof()
}
else
szNumber[nIndex] = cBuf;
}
this should work faster!
good luck.
|
|
|
|
|
Hello all
I created a MFC Dialog based project. At the time of creating the project I forgot to select "Context Sensitive help". Now I want to build a help file for my project. Is there any way to enable it for the existing project.
If any one knows how to do it, please help.
Thanks for your help
Hari.
|
|
|
|
|
I have this Help tutorial that explains how to solve your problem. I am just going to paste it here. I have never used these concepts because I never forgot to check "Context Sensitive help".
Manually Add the Context Hooks
If you already have a program and need to add help, you can manually edit the files to create the necessary
hooks.
To add context sensitive help manually:
1. Add the necessary message map entries in the message map of the Main Frame class. If you created the
program with the MFC App Wizard and specified that you wanted context help, these items should already
be in the file.
ON_COMMAND(ID_HELP_FINDER, CMDIFrameWnd::OnHelpFinder)
ON_COMMAND(ID_HELP, CMDIFrameWnd::OnHelp)
ON_COMMAND(ID_CONTEXT_HELP, CMDIFrameWnd::OnContextHelp)
ON_COMMAND(ID_DEFAULT_HELP, CMDIFrameWnd::OnHelpFinder)
2. Copy the What's This? Help icon into a button on your toolbar. This icon is available as a bitmap in
C:\Program Files\Microsoft Visual Studio\Common\Graphics\Bitmaps\OffCtlBr\Small\Color\help.bmp.
3. Assign ID_CONTEXT_HELP to the What's This? Help button.
Note:
• This creates the same basic hooks in the program as the App Wizard, but does not generate a framework
help file or the .hm file with the topic ID mapping. You will need to create a list of IDs for the help author
to use.
Override the Default Context Help Behavior
The default WinHelp call made from the hooks automatically created by the App Wizard opens each help topic
in the main WinHelp window. Unfortunately the current recommended behavior is:
• Control level help is opened in a popup.
• Window level help is opened in a secondary window.
To create these conditions, you must override the default functions.
To create currently recommended behavior:
1. In the Main Frame class, create an OnHelpInfo function using the Class Wizard:
BOOL CMainFrame::OnHelpInfo(HELPINFO* pHelpInfo)
{
return TRUE;
}
This effectively disables the function, and is necessary because, in combination with the next override, all
topics accessed through the F1 key will be called twice. Unfortunately you cannot use the OnHelpInfo
function in the Main Frame since (unlike in dialog boxes) it is triggered only by the F1 key and not by Shift-
F1 or the key.
2. In the Main Frame class, create a WinHelp function using the Class Wizard:
void CMainFrame::WinHelp(DWORD dwData, UINT nCmd)
{
CWinApp* theApp = AfxGetApp();
CString helpFilePath = theApp->m_pszHelpFilePath;
switch ( dwData ) {
case HIDR_MAINFRAME:
case HIDR_MFCWIZTYPE:
case HIDD_ABOUTBOX:
case HIDD_TESTDLG:
helpFilePath = helpFilePath + ">second";
::WinHelp(m_hWnd, helpFilePath, HELP_CONTEXT, dwData);
break;
case WHATEVER
...
break;
default:
::WinHelp(m_hWnd, helpFilePath, HELP_CONTEXTPOPUP, dwData);
break; }
}
Tips:
• It is often easier to create a separate function or class to process the help calls and open topics in the
correct window. This can be part of the main program or can be created as a separate DLL. The main
advantage of a DLL is that it can be called from other programs if necessary.
• If you want the help author to be able to control the help file and window called by this function, class, or
DLL, put the help file and window definitions in an INI file (you can use the topic number as the key) and
look them up before calling Help. If you include the help type as an INI file entry you can easily call
multiple types of user assistance from the same program.
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|
|
During a large edit on my project; adding lots of static text to a new dialog. I used a lot of cut/paste and
some of the paste went off the form.
The long story is that (well I think) that the resource data for the project has got a bit out of step and the current
situation is to go in directly (resource.h and the .rc files) to add additional static text fields.
This is because any attempt to place ANY control on the dialog is just ignored; i.e. nothing happens
Are they any tools to check/help check out this type of problem? I did double click on some of the
labels and created an event handle (unwanted) but now removed them.
Are they a problem with the IDE such that some setting has been set in error.
Are they any way to regain the IDE back online; i.e able to use the GUI to add aditional controls.
I think that the problem is reated to the resource.h file and the .rc file.
In the resource.h file:-
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 143
#define _APS_NEXT_COMMAND_VALUE 32771 <---- ? how to check
#define _APS_NEXT_CONTROL_VALUE 1114
#define _APS_NEXT_SYMED_VALUE 104
#endif
#endif
I see the use of all apart from _APS_NEXT_COMMAND_VALUE
If I could check this value then I may sort out the problem.
Note: I have this happen in both Visual C++ (Version 6) and on Visual Studio .Net; my current project.
Regards,
Graham.
PS Everyone says delete the dialog and re-do it! They must be a better way.
grahamfff
|
|
|
|
|
Hi!
I wonder if there is a way to get the path to the directory where the program exe file is located. When I use GetCurrentDirectory it works if I start the program with the exe file, but not if I dubble-click a saved file. Do I have to use the registry key. The thing is that other programs don't seem to do that. Is there not a function for this?
Thanx
Martin_j
|
|
|
|
|
MFC:
char szFileName[ _MAX_PATH ];
GetModuleFileName( AfxGetInstanceHandle(), szFileName, sizeof(szFileName) );
char szDrive[ _MAX_DRIVE ];
char szDir[ _MAX_DIR ];
_splitpath( szFileName, szDrive, szDir, NULL, NULL );
CString strTheFolderYouWant;
strTheFolderYouWant.Format( "%s%s", szDrive, szDir ); Win32:
char szFileName[ _MAX_PATH ];
GetModuleFileName( GetModuleHandle(NULL), szFileName, sizeof(szFileName) );
char szDrive[ _MAX_DRIVE ];
char szDir[ _MAX_DIR ];
_splitpath( szFileName, szDrive, szDir, NULL, NULL );
char szTheFolderYouWant[ _MAX_PATH ];
sprintf( szTheFolderYouWant, "%s%s", szDrive, szDir );
|
|
|
|
|
Wow! I always implemented my own _splitpath routine. I had no idea that there was a function that does that. Thank you (even though this is not my post).
// Afterall, I realized that even my comment lines have bugs
When one cannot invent, one must at least improve (in bed).-My latest fortune cookie
|
|
|
|