Solved

Visual Basic error 32

Posted on 2004-09-08
5
955 Views
Last Modified: 2013-11-25
Receiving this error while trying to put file on our unix server. Seems to connect just fine and does a directory change, just errors while trying to put the file.

Any help would be appriciated!
0
Comment
Question by:campbelc
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
5 Comments
 
LVL 32

Expert Comment

by:Erick37
ID: 12007110
What is the exact error message?
How are you connecting to the server?
0
 
LVL 6

Author Comment

by:campbelc
ID: 12007991
The returned error code is 32. No error text is returned.

The InternetOpen works just fine and returns 13369348.
The InternetConnect works just fine and returns 13369352.
The FtpSetCurrentDirectory works just fine and returns true.
I can easily test any of the above simply by providing invalid values, which as expected result in failure return codes.

The FtpPutFile fails. It returns false, and the last error code is 32 as noted above. No text is returned.

I have multiple examples of VB source code. All work just dandy. All transfer the test file just fine. I have used code from each of these examples in my target program, and the result is always as noted above. I've compared variable contents value-for-value between the working and target programs, variable types and everything else I can think of. Obviously something is different between several working source codes and my target program, but I'm damned if I can find a difference.

Any suggestions would be appreciated. Thanks!
0
 
LVL 32

Accepted Solution

by:
Erick37 earned 150 total points
ID: 12008542
OK,

Assuming that the error number 32 is derived from calling err.lastDLLerror immediately after the call to FtpPutFile, you can get the text of the error with this function:

Private Declare Function FormatMessage Lib "kernel32" _
      Alias "FormatMessageA" (ByVal dwFlags As Long, _
      lpSource As Any, ByVal dwMessageId As Long, _
      ByVal dwLanguageId As Long, ByVal lpBuffer As String, _
      ByVal nSize As Long, Arguments As Long) As Long
   
Private Const FORMAT_MESSAGE_FROM_SYSTEM As Long = &H1000

'----------------------------------------------------------------------------
Private Function ApiErrorText(ByVal ErrNum As Long) As String
      Dim msg As String
      Dim nRet As Long
   
      msg = Space$(1024)
      nRet = FormatMessage(FORMAT_MESSAGE_FROM_SYSTEM, ByVal 0&, _
                           ErrNum, 0&, msg, Len(msg), ByVal 0&)
      If nRet Then
         ApiErrorText = Left$(msg, nRet)
      Else
         ApiErrorText = "Error (" & ErrNum & ") not defined."
      End If
End Function
'----------------------------------------------------------------------------

Plugging in the number 32 results in the text message:
"The process cannot access the file because it is being used by another process."

That's all I have so far... still searching for an answer.
0
 
LVL 26

Expert Comment

by:EDDYKT
ID: 12008566
Have you tried this program

http://support.microsoft.com/default.aspx?scid=kb%3Ben-us%3BQ175179


May be there is security problem have you tried to connect via just


ftp


run from command prompt?
0
 
LVL 6

Author Comment

by:campbelc
ID: 12009073
oh. ouch.

That's it, absolutely. The target program hadn't closed the file. Program worked immediately when I explicitly closed the file.

That's why the other sources worked fine, because the program I was developing wasn't running and holding the file open.

Thanks!
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

A theme is a collection of property settings that allow you to define the look of pages and controls, and then apply the look consistently across pages in an application. Themes can be made up of a set of elements: skins, style sheets, images, and o…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Get people started with the process of using Access VBA to control Outlook using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Microsoft Outlook. Using automation, an Access applic…
Show developers how to use a criteria form to limit the data that appears on an Access report. It is a common requirement that users can specify the criteria for a report at runtime. The easiest way to accomplish this is using a criteria form that a…
Suggested Courses
Course of the Month4 days, 9 hours left to enroll

635 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question