1

I have no idea how I should solve the following task and I would be pleased if someone can give me a small advice at least.

I've got old sourcecode in visual basic 6.0, active x browser plugins that start an VB .dll module to upload documents to the server. This is part of a webclient. To start the upload-services, the active-x control is called.

Private Sub ProgressStarter()
Dim hModule As Long
hModule = 0

Dim strExe As String
Dim strParam As String
Dim nResult As Long

 strExe = App.path & "\ClientServiceStarter.exe"


strParam = "some_params"

' wait for Exe
nResult = ExecCmd(strExe & strParam)


If nResult < 32 Then
    MsgBox "Error", vbCritical Or vbOKOnly
End If

Exit Sub

The execcmd-func starts the VB .dll

Public Function ExecCmd(cmdline$)
Dim proc As PROCESS_INFORMATION
Dim Start As STARTUPINFO

' Initialize the STARTUPINFO structure:
Start.cb = Len(Start)

' Start the shelled application:
Dim Ret As Long
Ret& = CreateProcessA(vbNullString, cmdline$, 0&, 0&, 1&, _
                      NORMAL_PRIORITY_CLASS, 0&, _
                      vbNullString, Start, proc)

' Wait for the shelled application to finish:
ExecCmd = Ret&

Ret& = WaitForSingleObject(proc.hProcess, 1)
While Ret& = WAIT_TIMEOUT
    DoEvents
    Ret& = WaitForSingleObject(proc.hProcess, 1)
Wend
Call GetExitCodeProcess(proc.hProcess, Ret&)
Call CloseHandle(proc.hThread)
Call CloseHandle(proc.hProcess)
End Function

Now I want to change the VB .dll into a in c# written application. My question is, what kind of application should I use and how should I call it, because just changing the filename in the ProgressStarter-function doesn't work (nothing happened). I tried it with an wpf-application, that runs on its own, but could not executed from this active-x. So...what am I doing wrong? Any ideas how to solve this?

Kind regards and Sorry for my bad english.

Comintern
  • 21,855
  • 5
  • 33
  • 80
  • My VB6 is a bit rusty but from what I understand, all you are trying to do is upload a file from the browser to some place. Is that correct? – Imran Saeed Mar 23 '17 at 09:37
  • yes, vb6 is old, thats the reason why I want to change the old dll to something newer. And yeah...I want to add files and then upload them to the server. The module needs some parameters, that define what type of file could be uploaded, etc – arabella2034 Mar 23 '17 at 09:40
  • If you want to replace an ActiveX control with something that uploads a file then this won't be possible on a like-to-like basis as ActiveX controls are deprecated (especially for non IE browser). The equivalent of VB6 application would be a C# console application in your context if that makes sense. – Imran Saeed Mar 23 '17 at 09:44
  • So, how do I call the application from the browser? Should it be a wpf-browserapplication or just a normal one? My module contains an window with a list of files that should be uploaded and a few buttons to add, delete and uploade them. – arabella2034 Mar 23 '17 at 10:02
  • If all you want to do is upload a file, you don't need to call an application. Just use file upload from HTML. wpf applications are limited and will only work on certain platforms. Like i said before, you won't get a like-to-like solution easily. It might be easier to explain the business requirement and work on a solution from there. – Imran Saeed Mar 23 '17 at 10:06
  • unfortunately the file upload from html isn't enough because my boss don't want it in this way. I need to differentiate if one or more files are allowed, what extension it could be, and where to post (this is what I get in the parameters for this module). And...html5 is not supported. I don't even know why. – arabella2034 Mar 23 '17 at 10:26
  • 1
    That's a big constraint. I would recommend rephrasing this question with clear requirements so that a wider community can help you with better and more suitable alternatives. Good luck! – Imran Saeed Mar 23 '17 at 10:34

0 Answers0