473,385 Members | 1,606 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Why function returns 0?

27
I am creating OCX for Http Upload control.can anyone plz tell me why the function UploadFileHTTP returns 0 when used?I am posting my code----
Expand|Select|Wrap|Line Numbers
  1. Public Function UploadFileHTTP(ByVal localFileName As String, ByVal remoteFileName As String) As Integer
  2.     Dim nRet As Integer
  3.     Dim bRet, bQueryInfo As Boolean
  4.     Dim iRet As Integer
  5.     Dim nFileHandle, i As Integer
  6.     Dim bData(BUFFER_SIZE - 1) As Byte
  7.     Dim leftoversize As Long
  8.     Dim blnSendRequest As Boolean
  9.     Dim szContent As String
  10.  
  11.     nFileHandle = FreeFile
  12.  
  13.     hRequest = HttpOpenRequest(hConnect, "POST", "192.168.3.13/Fileupload/Upload_Signature.asp", "HTTP/1.0", 0, 0, INTERNET_FLAG_NO_CACHE_WRITE, 0)
  14.         If hRequest = 0 Then
  15.             LastDllErrorInfo 'Call before calling any other dll function
  16.             If Not HttpErrorCode = 0 Then
  17.                 Err.Raise HttpErrorCode, , HttpErrorString
  18.             End If
  19.             Exit Function
  20.         End If
  21.  
  22.     blnSendRequest = HttpSendRequest(hRequest, vbNullString, 0, localFileName, Len(localFileName))
  23.     bQueryInfo = HttpQueryInfo(hRequest, HTTP_QUERY_CONTENT_TYPE, remoteFileName, Len(remoteFileName), 0)
  24.  
  25.     Close nFileHandle
  26.     InternetCloseHandle hRequest
  27. End Function
Apr 3 '08 #1
2 1421
danp129
323 Expert 256MB
You're not telling the fuction to return anything.

UploadFileHTTP=bQueryInfo would make the function return the true/false value of HttpQueryInfo(*)
Apr 3 '08 #2
debasisdas
8,127 Expert 4TB
Since you are returning anything from the function and the function return type is integer it returns 0.
Apr 4 '08 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

2
by: | last post by:
OK: Purpose: Using user's input and 3 recursive functions, construct an hour glass figure. Main can only have user input, loops and function calls. Recursive function 1 takes input and displays...
9
by: Marek Lewczuk | last post by:
Hello, I'm moving out from MySQL to PostgreSQL and there are some function which are not supported in PG so I'm trying to write my own functions. Currently I have big problem with function IF(),...
8
by: Tweaxor | last post by:
Hey, I was trying to figure out was it possible in C to pass the values in an array from one function to another function. Is the possible in C? ex. y is the array that holds seven values If...
11
by: Marco Loskamp | last post by:
Dear list, I'm trying to dynamically generate functions; it seems that what I really want is beyond C itself, but I'd like to be confirmed here. In the minimal example below, I'd like to...
17
by: Razzel | last post by:
I created this as a test: #include <time.h> main(){ printf(X1: %s\n", putim()); printf(X2: %s\n", putim()); } putim() { time_t t; time(&t); return(ctime(&t));
4
by: ranjmis | last post by:
Hi all, I have come across a piece of code wherein a function returns a function pointer as it seems to me but not very clear from the prototype. As shown below - although return type is void...
2
by: mosesdinakaran | last post by:
Hi everybody, Today I faced a problem where I am very confused and I could not solve it and I am posting here.... My question is Is is possible to return a value to a particular function ...
7
by: jknaty | last post by:
I'm trying to create a function that splits up a column by spaces, and I thought creating a function that finds the spaces with CHARINDEX and then SUBSTRING on those values would an approach. I...
11
by: Antoninus Twink | last post by:
What's the correct syntax to define a function that returns a pointer to a function? Specifically, I'd like a function that takes an int, and returns a pointer to a function that takes an int and...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.