|
The problem is figuring out what the root directory of the FTP server is on a machine. Of course how to ensure FTP is installed and running would probably be a bonus question!!
I'm just giving a peek into what I'm working on when speaking of an installer. The installer isn't the problem.
Thanks..
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
-Frank Outlaw.
|
|
|
|
|
I think finding that out isn't so trivial...i mean, there are probably tonns of FTP server softwares out there, each of them storing its root folder setting differently, in the registry, in some ini file, and so on... your best bet would be to make a connection to the FTP server but i don't know if the FTP protocol can tell you where the root folder is located on the local system. Also, as far as i know there might be different FTP root folders depending on the user who logs onto the server, so which one of the users would you want to use? I don't know much about installers, i hope someone else will give you a better answer.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Sometimes you just have to hate coding to do it well. <
|
|
|
|
|
Actually an ftp server should never tell a client what his root directory is, for security reasons. Some ftp servers don't even have a root directory, but have virtual roots, usually spread out over a number of nfs servers, for redundancy and performance.
If you're talking about the 'standard' ftp server that comes with IIS, it's root location will be in the registry and you may find it during an install. But it won't do you much good: it may be somewhere where you have no access, it may be on a network for which you have no credentials, it may be on a reparse point, it may be on a symbolic link, all situations that may trick into thinking you may do something with it, only to find it causes failure.
|
|
|
|
|
Ed K wrote: Of course how to ensure FTP is installed and running would probably be a bonus question!!
Do you know the name of the FTP service?
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
Cha-Ching!!! Thanks!!!
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
-Frank Outlaw.
|
|
|
|
|
Install what ? where ? and why does an install program should know about the FTP server?
Do you need to configure something on the user's FTP site ?
Watched code never compiles.
|
|
|
|
|
Maximilien wrote: Install what ? where ? and why does an install program should know about the FTP server?
Lesson learned today: Never hint at what the project actually does because it's really irrelevant and developers go there first! I'd probably do the same thing...
How can I find the root directory for an FTP server? (IIS) I've checked the registry.. not there. Not sure where else it could be stored.. Possibly a configuration file somewhere??
ed
~"Watch your thoughts; they become your words. Watch your words they become your actions.
Watch your actions; they become your habits. Watch your habits; they become your character.
Watch your character; it becomes your destiny."
-Frank Outlaw.
|
|
|
|
|
I'm using a ListView to display certain data, yet I can't select the row!
This is the DWORD style used in CreateWindow:
WS_CHILD|LVS_REPORT|LVS_EX_DOUBLEBUFFER|LVS_SINGLESEL|WS_TABSTOP|WS_VISIBLE
The only selection can only be done on Item, but not any of the SubItems.
|
|
|
|
|
Because you have not set the LVS_EX_FULLROWSELECT style.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
WS_CHILD|LVS_REPORT|LVS_SINGLESEL|LVS_EX_GRIDLINES|LVS_EX_FULLROWSELECT|LVS_EX_DOUBLEBUFFER|WS_VISIBLE
Still no changes everything is still the same!
|
|
|
|
|
You need to change these settings with something like :
SendMessage(hWndView,
LVM_SETEXTENDEDLISTVIEWSTYLE,
LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES,
LVS_EX_FULLROWSELECT | LVS_EX_GRIDLINES
);
in your view initialization code. Take a look at the MSDN documentation for LVM_SETEXTENDEDLISTVIEWSTYLE .
It's time for a new signature.
|
|
|
|
|
Hy . I want to build my CSmtp client MFC compatible class , and for that I need to call gethostbyname , but here I'm stuck ... because I use CString , and function parameter is 'const char FAR *' ... my questions is : how can I convert CString to const char * ?
P.S. If you know some SMTP client tutorial , it will be very good ! Thank you !
|
|
|
|
|
You will have to do no conversion. CString already provides you with the LPCTSTR operator!
“Follow your bliss.” – Joseph Campbell
|
|
|
|
|
Ok , and how to put LPCTSTR operator in the function argument ? Because I try in some dummy way , but it failed ... can you draw an little code sample ?
|
|
|
|
|
How did you called? Can you put your code here so we can see what's going on?
|
|
|
|
|
P.S.Here is my trial :
LPHOSTENT lpHostEnt = gethostbyname(sServer.GetBuffer(1 + sServer.GetLength()));
sServer.ReleaseBuffer();
but seems not working ...
|
|
|
|
|
short nProtocolPort;
LPHOSTENT lpHostEnt;
LPSERVENT lpServEnt;
SOCKADDR_IN sockAddr;
SOCKET hServerSocket = INVALID_SOCKET;
struct in_addr addr;
sTemp = sServer;
sTemp = sTemp.Left(1);
if(atoi(sTemp) == 0)
{
lpHostEnt = gethostbyname(sServer.GetBuffer(1 + sServer.GetLength()));
sServer.ReleaseBuffer();
}
else
{
addr.s_addr = inet_addr(sServer.GetBuffer(1 + sServer.GetLength()));
sServer.ReleaseBuffer();
if(addr.s_addr == INADDR_NONE)
{
m_nError = CSMTP_BAD_IPV4_ADDR;
return INVALID_SOCKET;
}
else lpHostEnt = gethostbyaddr((char *)&addr,4,AF_INET);
}
if(lpHostEnt == NULL)AfxMessageBox("lpHostEnd is NULL !");
|
|
|
|
|
Of course
sServer = "smtp.gmail.com"
|
|
|
|
|
Do not call GetBuffer() unless you are modifying the internal buffer.
CString sServer;
LPHOSTENT lpHostEnt = gethostbyname(sServer);
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|
|
I use the following to declare, initializing, and delete arrays. Please check if I am doing OK? Thanks!
float* tim_var[1000];
for (i=0;i<1000;i++)
{
tim_var[i]=new float[6];
}
//
for(i=0;i<1000;i++) {
for(int j=0;j<6;j++)
{
tim_var[i][j]=0;
}
}
//
...........
//
delete [] *tim_var;
|
|
|
|
|
A rule of thumb: for each call to new there needs to be a corresponding delete . In your sample you call new within a loop (1000 times) and have only one delete.
Can you use STL or some other containers instead?
|
|
|
|
|
Thanks.
Should I put a loop of 1000 to delete ? If so could you give me
the correct code to do so. I am not sure how to put code with a loop to delete.
Tahnks again.
|
|
|
|
|
for (i=0;i<1000;i++)
{
delete tim_var[i];
}
and as Nemanja suggested, can't you use the STL container classes ? This will save you a lot of troubles in the future.
|
|
|
|
|
tim_var [][] is a two dimensional array.
float* tim_var[1000];
for (i=0;i<1000;i++)
{
tim_var[i]=new float[6];
}
//
for(i=0;i<1000;i++) {
for(int j=0;j<6;j++)
{
tim_var[i][j]=0;
}
}
//
So the delete loop you gave me is compiled. So this means the two dimensional array is deleted for 6x1000 variable memories.
Thanks
|
|
|
|
|
mrby123 wrote: tim_var [][] is a two dimensional array.
float* tim_var[1000];
But you've only shown one of those dimensions.
"One man's wage rise is another man's price increase." - Harold Wilson
"Fireproof doesn't mean the fire will never come. It means when the fire comes that you will be able to withstand it." - Michael Simmons
"Man who follows car will be exhausted." - Confucius
|
|
|
|