|
I can't spot any obvious error, attached is the code I use sucessfully, I know it works on 95, 98, NT and XP.
The obvious question is what is the error return? I have removed my error trapping so you can see the wood for the trees!
m_hInetSession = InternetOpen(_T("FtpUpload"),<br />
INTERNET_OPEN_TYPE_PRECONFIG,<br />
NULL,<br />
NULL,<br />
INTERNET_INVALID_PORT_NUMBER);<br />
<br />
DWORD dwFlag = m_bPASVMOde ? INTERNET_FLAG_PASSIVE : 0;<br />
<br />
m_hFTPConnect = InternetConnect(m_hInetSession,<br />
strURL,<br />
(INTERNET_PORT) m_nPort,<br />
strUser,<br />
strPWD,<br />
INTERNET_SERVICE_FTP,<br />
dwFlag,<br />
NULL);
"Laughing at our mistakes can lengthen our own life. Laughing at someone else's can shorten it."
- Cullen Hightower
|
|
|
|
|
Thanks a lot for reply.
The error return is ErrorCode : 12014 i.e. The request to connect and log on to an FTP server could not be completed because the supplied password is incorrect. Eventhough I am specifying correct password.
Regards,
Chirag.
|
|
|
|
|
You could try ravi's suggestion or my favourite use telnet and connect to port 21 then type
USER username
PASS mypassword
That way you can see what the server is sending
"Laughing at our mistakes can lengthen our own life. Laughing at someone else's can shorten it."
- Cullen Hightower
|
|
|
|
|
Hi, thanks for reply again.
I am now handling the situation in other way ... i.e. See my Code snippet below..
HINTERNET hIntConnect = InternetConnect(hInet,"ftp.corsoft.com",INTERNET_DEFAULT_FTP_PORT,NULL,NULL,INTERNET_SERVICE_FTP,0,NULL);
if (InternetSetOption(hIntConnect,INTERNET_OPTION_USERNAME,"UNIVERSE\\UserName",sizeof("UserName"))==FALSE)
int err=GetLastError();
if (InternetSetOption(hIntConnect,INTERNET_OPTION_PASSWORD,"Password",sizeof("Password"))==FALSE)
int err=GetLastError();
ret = FtpGetCurrentDirectory(hIntConnect,CurDir, &CurDirSize);
if (ret == FALSE)
int err=GetLastError();
ret = FtpSetCurrentDirectory(hIntConnect,"\kothi\cc");
if (ret == FALSE)
{
int err = GetLastError();
InternetGetLastResponseInfo(&nErr, sBuff, &nBuffLen);
}
The usually works fine except last action i.e. to Set the Current Working Directory. I am easily able to get the file from the root directory but not able to Set the Current working Directory.. The error i m getting id ErrorCode:12003.
Any Idea....that helps me a lot.
Thanks in advance.
Regards,
Chirag
|
|
|
|
|
Anonymous wrote:
ret = FtpSetCurrentDirectory(hIntConnect,"\kothi\cc");
shouldn't it be "/kothi/cc" or "./kothi/cc/" or "kothi/cc"? I can't remember off hand
Make sure you are really where you think you are before you try and change directories.
"Laughing at our mistakes can lengthen our own life. Laughing at someone else's can shorten it."
- Cullen Hightower
|
|
|
|
|
Anonymous wrote:
is there any other idea to login to the FTP site with specific USERNAME & PASSWORD.
You can specify the username and password as part of the URL - the format is "ftp://username :password @corsoft.net", where username is the username and password is the password.
You can verify this by opening an instance of Windows Explorer (not IE) and typing this in the address bar. You should see the file system on the FTP server. This is what I use as my FTP client.
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
hello again,
I need to do 3 steps on a file, I've written 3 functions ( step1(),step2(),step3()), all of those steps requires the execution of ShellExecuteEx but I need them do be done sequentialy with mutual exclusion.
I've created a semaphore using CreateSemaphore but step2() starts before step1() finished. Here's the code
<br />
HANDLE hSemaphore=NULL;<br />
....
<br />
Semaphore=CreateSemaphore(NULL, 1, 1, NULL);<br />
if(Semaphore ==NULL)<br />
{<br />
MessageBox(hwndMain, "Unable to assure mutual execution,can't continue","MUTEX",MB_OK|MB_ICONERROR );<br />
break;<br />
}<br />
//into step1()
<br />
dwWaitResult=WaitForSingleObject(Semaphore,0L);<br />
switch(dwWaitResult)<br />
{<br />
case WAIT_OBJECT_0:<br />
if(ShellExecuteEx(&sei)== NULL)<br />
{<br />
ReleaseSemaphore (Semaphore,1, NULL);<br />
return false;<br />
}<br />
ReleaseSemaphore (Semaphore,1, NULL);<br />
return true;<br />
}<br />
//Into step2()
<br />
dwWaitResult=WaitForSingleObject(Semaphore,INFINITE);<br />
<br />
while (dwWaitResult==WAIT_TIMEOUT)<br />
{<br />
};<br />
If anyone can help me, that would be great, thanks!
Paolo
|
|
|
|
|
I take it you mean each step is running on its own thread?
Semaphores dont help you gaurentee order. All the do is protect say thread A accessing the same thing as thread B. Which order thread A and thread B run in is down to the scheduler. So it might happen A grabs the semaphore, B tries to and waits, A releases semaphore, B contnues to run. Or it might happen B grabs the semaphore, A tries to and waits, B releases semaphore, A contnues to run - its up to the scheduler (and of course your theads priority).
If you want things to happen one after the other, run them on the same thread:
void Foo(
{
Step1();
Step2();
Step3();
}
etc.
If you really want each step to happen on it's own thread, then you need to use events. Look up CreateEvent/SetEvent/ResetEvent
If I have the wrong end of the stick, and what you are asking is you want ShellExecuteEx not to return until the spawned process has finished, you do it like this.
SHELLEXECUTEINFO si;
si.fMask = SEE_MASK_NOCLOSEPROCESS;
si.etc etc
ShellExecuteEx(&si);
WaitForSingleObject(si.hProcess, INFINATE);
|
|
|
|
|
Hello!
please help me in this field.
when I run this program in visual C++ (6.0) this link error appears:
error LNK2001: unresolved external symbol _WMCreateEditor@4
Debug/main.exe : fatal error LNK1120: 1 unresolved externals
this program put marker on sound file
thank you for reply.
(I'm sorry.I could not speak English perfectly)
#######################################################
IWMMetadataEditor *pEdit = 0;
IWMHeaderInfo *pInfo = 0;
// Create the metadata editor object.
WMCreateEditor(&pEdit);
pEdit->Open(L"C:\\example.wmv");
pEdit->QueryInterface(IID_IWMHeaderInfo, reinterpret_cast<void**>(pInfo));
// Add the markers. Note that we add the last ones first. Do this when possible
// for improved performance when writing the markers to the file.
hr = pInfo->AddMarker(L"End", 520000000); // 52 sec.
hr = pInfo->AddMarker(L"Segue", 350000000); // 35 sec.
hr = pInfo->AddMarker(L"Intro", 15000000); // 1.5 sec.
// Commit changes and clean up.
pEdit->Flush();
pEdit->Close();
pInfo->Release();
pEdit->Release();
|
|
|
|
|
have you checked if all .lib files are included into the project? or check if prototypes of WMCreateEditor is declared correctly
Paolo
|
|
|
|
|
1. either link in the "wmvcore.lib" into your project settings (link tab)
or
2. add this to your source or into "stdafx.h"
#pragma commend(lib, "wmvcore.lib")
or
3. directly add the lib into your project as one of the files
|
|
|
|
|
Hi,
I have an app with a series on property pages in a row. I was wondering if there was a fancy way that it could dock on the left hand side on the screen tucked away and the subsequent clicks would bring it out to the middle of the screen and vice versa.
I think I have seen something like this some where but can't remember where.
Does any one have a small sample link to such a thing?
|
|
|
|
|
Hello,
I'm writing a GUI to simplify the use of a console-based application, I've created a WIN32 application ( no MFC or ALT), I want to know if it's possible to print the output from dos console to an HWND that it's related to a listbox control;for opening the dos-console program I've used the ShellExecuteEx function.
thanks
Paolo
|
|
|
|
|
There is one article in Codeproject which also redirect stdin, stdout and stderr handles to a window.
Check this out.
http://www.codeproject.com/dialog/quickwin.asp
Sonork 100.41263:Anthony_Yio
|
|
|
|
|
See these two articles:
http://support.microsoft.com/default.aspx?scid=kb;en-us;190351
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dllproc/base/creating_a_child_process_with_redirected_input_and_output.asp
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi there,
Does anyone have an idea of how to go about using Constrained Delaunay Triangulation in Line thinning? The input is a black and white TIFF image, pixel based. The program should thin the lines of the image to one pixel width.
Would really appreciate help here!
regards, fuzzypeach
|
|
|
|
|
Hi,
Now I'm using IHTMLDocument2::write to write html contents to an HTML document. But I found it become slower and slower after many times of writes, even I wrote in the same html contents every time. I dont know why
Below is the sample codes:
IHTMLDocumentPtr doc;
if(FAILED(doc.CreateInstance(CLSID_HTMLDocument, NULL, CLSCTX_INPROC_SERVER)))
return;
CComQIPtr<IHTMLDocument2> doc2 = doc;
if(doc2 == NULL)
return;
time_t startTime, ltime, delta = 0;
int step = 200;
for (int i = 1; i <= 50000; i++)
{
time(& startTime);
if(FAILED(doc2->write(sfArray)))
break;
doc2->close();
time(& ltime);
delta += ltime - startTime;
if (i % step == 0)
{
TRACE (_T("Seconds used on loading %d html DOM from %dth with same doc: %ld\n"), step, i - step, delta);
delta = 0;
}
}
I also write a demo project to demonstrate this but cant attach it here. If you need it, I'll send it to you.
Thanks & regards,
Hailiang
|
|
|
|
|
Okay, so I'm checking out the source code on this project. And I get to this section of code.
<br />
void GetResolution( int &X, int &Y ) {<br />
byte array[8];<br />
X = Y = 0;<br />
unsigned long address;<br />
if ( ReadProcessMemory( g_hCurrentProcess, (void *) g_uiResolutionOffset, (void *) array, 4, NULL ) ) {<br />
address = GetUnsignedLong( array );<br />
if ( ReadProcessMemory( g_hCurrentProcess, (void *) (address + 268), (void *) array, 4, NULL ) ) {<br />
X = GetUnsignedLong( array );<br />
if ( ReadProcessMemory( g_hCurrentProcess, (void *) (address + 272), (void *) array, 4, NULL ) ) {<br />
Y = GetUnsignedLong( array );<br />
Now, I am a bit confused as to what is meant by "address +268" I know 'address' is the base offset, but what is added to it? is it 268 bytes or is it an unsigned long or what?
|
|
|
|
|
looks like 268 bytes to me
|
|
|
|
|
What is added to it is (268 * sizeof(unsigned long)).
For example:
unsigned long al[10];
unsigned long* pal = al + 1; // same as pal = &al[1];
// and
unsigned long al1 = al[1]; // same as al1 = *(al+1);
INTP
|
|
|
|
|
John R. Shaw wrote:
What is added to it is (268 * sizeof(unsigned long)).
This is not correct. address is defined as an "unsigned long ", not as an array or a pointer. So (void*)(address + 268) adds 268 to the number held in address , and then casts to a void pointer. So it is incrementing by 268 bytes, not 268 unsigned long s.
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"
|
|
|
|
|
i gave you a 5 for that, cos you were thinking exactly the same thing as me, but you type faster
oh and your response is more legible
|
|
|
|
|
Whoops! You are correct, I need to be more observant. I saw 'address' and automaticaly saw a pointer variable, instead of an unsigned long variable that is holding a value that happens to be an address.
INTP
|
|
|
|
|
well then I'm confused. In the example given :
unsigned long address;
now if address is then set to 1000;
address = 1000;
then you add 268;
address += 268;
it'll be 1268
NOT 1000 + (268 *sizeof(unsigned long)) = 1072+1000 = 2072
what you have said doesn't make a lot of sense to me.
|
|
|
|
|
How to capture/save a bitmap on the picture box using VC++?
Aparna
|
|
|
|
|