|
Hello,
I would like convert codes sources VB.NET into VB6. I have one application who uses components for VB6 only, so i can't migrate now to VB.NET
I saw good sources in your site ( like "http://www.codeproject.com/vb/net/autoupdate.asp") and i'm trying to use it in my application, but i have some problem with API/functions VB.NET.
Example :
How convert "Imports System.IO", "System.IO.StreamReader", "System.Net.WebClient", ...
What code must i use in VB6 ?
Thanks a lot for your help !
Bye
PS : sorry for my english, i'm french ...
-- modified at 11:27 Monday 23rd January, 2006
|
|
|
|
|
You'll have to re-write your application from scratch. VB6 doesn't have any equivalent to the constructs you listed.
You can pretty easily convert VB6 code to VB.NET, not definately not the other way around. It'll take some serious work to do that. For instance, VB6 has no native web access built in. You'll have to use an external control in VB6 to do the same thing, like downloading a web page. About the best you'll be able to get is the basic idea and steps behind the process of what you want to do. Converting the code is next to impossible.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
Ok, thanks for the answer !
I must find anothers things !
Bye
|
|
|
|
|
It might be possible to keep the VB.NET code and call it from VB6. Take a look at the VB Fusion section on MSDN.
http://msdn.microsoft.com/vbrun/vbfusion/[^]
I've never tried this myself. Nor want to. So, you're on your own from here.
-- modified at 13:21 Monday 23rd January, 2006
|
|
|
|
|
|
Hi,
Is it possible to use dll VB.NET in my application VB6 ?
If it's possible, how can i use it ?
I think that i need a new parameter for RemotePath in the class AutoUpdate ?
Thanks for your help !
|
|
|
|
|
It is possible. Go to the link I provided in my previous post. It contains several articles by Microsoft on how to do this.
|
|
|
|
|
In my opinion, it is impossible to do that.
|
|
|
|
|
Hi,
As far as i could think of it, why don't you convert the .NET code into a .NET Assembly (DLL) and register it in GAC so that you can use it in VB6 by adding it's reference into your VB6 project?
Hope that might help and if you find some better way then please post it on the forum.
With warm regards,
KEDAR
-- modified at 7:45 Wednesday 1st February, 2006
|
|
|
|
|
Hi,
We have find a good solution.
You can see it in french forum : http://www.developpez.net/forums/viewtopic.php?t=446317
And download source for VB6 here : http://thierry_aim.developpez.com/downloads/AutoUpdateExe.zip
Thanks for your help and interrest.
Bye
|
|
|
|
|
I'm trying to grab the share name (e.g.: \\server1\share) of an already mapped drive (Q:\). I've been looking for like a week on how to do this. I can disconnect drives, map drives and bring up the Win dialagos to do the same but I just can't find a way to grab that name. I just want to put it into a text box on the form Using vb.net on XP.
PLEASE HELP
thanks, N
-- modified at 14:06 Monday 23rd January, 2006
|
|
|
|
|
Something like this:
Private Const NO_ERROR = 0
Private Const ERROR_MORE_DATA = 234
Private Declare Auto Function WNetGetUniversalName Lib "mpr.dll" ( _
<MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPTStr)> _
ByVal lpLocalPath As String, _
ByVal dwInfoLevel As INFO_LEVEL, _
ByVal lpBuffer As IntPtr, _
ByRef lpBufferSize As Integer _
) As Integer
Private Structure REMOTE_NAME_INFO
<MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPTStr)> _
Public lpUniversalName As String
<MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPTStr)> _
Public lpConnectionName As String
<MarshalAs(System.Runtime.InteropServices.UnmanagedType.LPTStr)> _
Public lpRemainingPath As String
End Structure
Private Enum INFO_LEVEL As Integer
UNIVERSAL_NAME_INFO_LEVEL = 1
REMOTE_NAME_INFO_LEVEL = 2
End Enum
Public Function GetUniversalName( _
ByVal Path As String, _
ByRef UniversalName As String, _
ByRef ConnectionName As String, _
ByRef RemainingPath As String) As Boolean
' When successful, returns TRUE with UniversalName,
' ConnectionName, and RemainingPath data. If not
' successful, it may be the drive is local and not mapped.
Dim buffer As Integer
Dim ptrbuffer As IntPtr
Dim status As Integer
Dim rni As REMOTE_NAME_INFO
Dim Success As Boolean
Dim SafteyCount As Integer = 0
UniversalName = ""
ConnectionName = ""
RemainingPath = ""
buffer = 1024
ptrbuffer = Marshal.AllocHGlobal(buffer)
status = WNetGetUniversalName( _
Path, INFO_LEVEL.REMOTE_NAME_INFO_LEVEL, _
ptrbuffer, buffer)
Do While True
Select Case status
Case NO_ERROR
rni = Marshal.PtrToStructure(ptrbuffer, GetType(REMOTE_NAME_INFO))
UniversalName = rni.lpUniversalName
ConnectionName = rni.lpConnectionName
RemainingPath = rni.lpRemainingPath
Success = True
Exit Do
Case ERROR_MORE_DATA
If SafteyCount > 3 Then
Success = False
Exit Do
End If
SafteyCount += 1
Marshal.FreeHGlobal(ptrbuffer)
ptrbuffer = Marshal.AllocHGlobal(buffer)
status = WNetGetUniversalName(Path, _
INFO_LEVEL.REMOTE_NAME_INFO_LEVEL, ptrbuffer, buffer)
Case Else
Success = False
Exit Do
End Select
Loop
Marshal.FreeHGlobal(ptrbuffer)
Return Success
End Function
Hope that helps
progload
|
|
|
|
|
Thanks !!
|
|
|
|
|
I've inherited a VB6 app with a TreeView.
The child nodes are loaded when the parent is expanded.
It all works except that part of the tree can be recursive (A parent of B parent of C parent of A).
If a user selects node A and presses * on the keypad the tree tries to expand all of A's tree thus ending up in an infinite recursion.
How can I trap this (eat the * or expand only 1 level).
TIA
PeteB
I wouldn't say "he's not the sharpest knife",
I'd say "he's a spoon."
|
|
|
|
|
|
Thanks, but I couldn't find any relevant info about expand-all functionality on that page.
PeteB
|
|
|
|
|
|
Sorry, that one doesn't help either. ExpandAll is not available in VB6 so I can't intercept it and prevent the behaviour
PeteB
I wouldn't say "he's not the sharpest knife",
I'd say "he's a spoon."
-- modified at 6:06 Wednesday 1st February, 2006
|
|
|
|
|
|
That looks really good. Unfortunately I don't have the time to replace the standard tree (especially with getting the code security checked) and any new projects are .Net
PeteB
I wouldn't say "he's not the sharpest knife",
I'd say "he's a spoon."
|
|
|
|
|
Having been unsuccessful in trapping the expand all event, I've simply trapped the keystrokes and filtered out the keypad *.
Not ideal but it works...
PeteB
I wouldn't say "he's not the sharpest knife",
I'd say "he's a spoon."
|
|
|
|
|
Hello,
I have developed an application to call a C++ DLL from VB.
If I send the values to the functions of DLL as Call By Value method, it gives correct output.
If I do the same through Call By Reference method, it gives improper values as result.
For example,
Instead of printing 47000, it prints the value 2.55471e-041.
Please help me to clear this problem.
Premalatha
|
|
|
|
|
Please tell me you rewrote the C++ function to accept a parameter pass by reference? Without changing BOTH the C function and the VB Declaration, you're trying to fit a square peg in a round hole.
If the C++ function is expecting a parameter passed by value, you obviously can't pass in a reference to it. The opposite is also true...
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|
|
FloatPtr = & max_ceiling;
for(i=2; i<7; i++, FloatPtr++)
*FloatPtr = atof(GetValue(instr,s,128));
This code i wrote in C++ within a function. max_ceiling is the array.
GetValue is a function which reads single line from the binary file(instr) and converts to value to update in text file.
In this for loop, i have to get values like 47000 516 0.63 3000 100. But i am getting the values as 2.55471e-041, 89224, -2.26464e-041, 2.48352e-041,2.07628e-040
This is my problem
|
|
|
|
|
This isn't enough to diagnose the problem. You have to post the function header that is defined in the C++ code. Yout also have to post the VB Declare statement that defines how VB passes parameters.
RageInTheMachine9532
"...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
|
|
|
|