473,222 Members | 1,809 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,222 software developers and data experts.

expert help needed converting vb6

Hello,

I am trying to convert a project from vb6 to vb.net. The code is a
sample from an sdk for Canon digital camera's. I have gotten most of the
issues resolved, but there are some that I am lacking knowledge in. I would
appreciate any help give with this. The main errors have to deal with the
VarPtr and AddressOf expression. Unfortunetly I do not have much experience
with delegates. Below is some of the code. I can produce the entire project
if anyone would like it. Thanks in advance for your time.

John
addressOf issue:

Private Sub cmdViewFinder_Click(ByVal eventSender As System.Object, ByVal
eventArgs As System.EventArgs) Handles cmdViewFinder.Click

Dim err_Renamed As Integer
If m_bCamConnect = False Then

Exit Sub

End If
If m_bViewFinder = False Then

'UPGRADE_WARNING: Add a delegate for AddressOf ViewFinderCallbackFunc Click
for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1048"'

err_Renamed = CDStartViewfinder(m_hSource, 1, AddressOf
ViewFinderCallbackFunc, 0)

If err_Renamed <> cdOK Then

GoTo ErrHandler

End If

cmdViewFinder.Text = "End"

cmdAEAF.Enabled = True

m_bViewFinder = True

Else

err_Renamed = CDTermViewfinder(m_hSource)

If err_Renamed <> cdOK Then

GoTo ErrHandler

End If

cmdViewFinder.Text = "Start"

cmdAEAF.Enabled = False

m_bViewFinder = False

picViewFinder.Image = Nothing

End If
Exit Sub

VarPrt issue:

Private Sub GetRelData(ByRef NumData As Integer)
'UPGRADE_NOTE: err was upgraded to err_Renamed. Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1061"'

Dim err_Renamed As Integer

Dim myMedium As cdStgMedium

Dim RelImgInfo As cdReleaseImageInfo

Dim i As Integer

Dim szPrefix As String

Dim szExt As String

Dim index As String

Dim bytBuff() As Byte
If NumData = 0 Then

Exit Sub

End If
m_Progress = New Progress.CProgress
'/* UI is locked so that information may not be changed. */

err_Renamed = CDLockUI(m_hSource)

If err_Renamed <> cdOK Then

GoTo ErrHandler

End If
For i = 1 To NumData

'/* A preservation file name is decided. */

If CDGetReleasedData(m_hSource, 0, 0, 0, RelImgInfo, 0) <> cdOK Then

Exit For

End If
Select Case RelImgInfo.DataType

Case cdDATA_TYPE_THUMBNAIL

szPrefix = "TH"

szExt = "JPG"

Case cdDATA_TYPE_PICTURE

szPrefix = "FV"

If RelImgInfo.Format_Renamed = 1 Then

szExt = "JPG"

Else

szExt = "CRW"

End If

Case cdDATA_TYPE_PLUS_JPEG

szPrefix = "FP"

szExt = "JPG"

End Select
m_RelFileIndex = m_RelFileIndex + 1

index = VB6.Format(m_RelFileIndex, "000000")

myMedium.Type = cdMEMTYPE_FILE

myMedium.u.lpszFileName = txtSavePath.Text & szPrefix & index & "." & szExt
ReDim bytBuff(Len(myMedium.Type) + Len(myMedium.u.lpszFileName))

'UPGRADE_ISSUE: VarPtr function is not supported. Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1040"'

Call RtlMoveMemory(VarPtr(bytBuff(0)), myMedium.Type, Len(myMedium.Type))

'UPGRADE_ISSUE: VarPtr function is not supported. Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1040"'

Call RtlMoveMemory(VarPtr(bytBuff(Len(myMedium.Type))),
myMedium.u.lpszFileName, Len(myMedium.u.lpszFileName))
m_Progress.startProgress((Me.Handle.ToInt32))

'UPGRADE_ISSUE: VarPtr function is not supported. Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1040"'

'UPGRADE_WARNING: Add a delegate for AddressOf ProgressCallbackFunc Click
for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1048"'

err_Renamed = CDGetReleasedData(m_hSource, AddressOf ProgressCallbackFunc,
0, cdPROG_REPORT_PERIODICALLY, RelImgInfo, VarPtr(bytBuff(0)))

m_Progress.endProgress()

If err_Renamed <> cdOK Then

GoTo ErrHandler

End If
Next i
'UPGRADE_NOTE: Object m_Progress may not be destroyed until it is garbage
collected. Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1029"'

m_Progress = Nothing
'/* The lock of UI is canceled. */

err_Renamed = CDUnlockUI(m_hSource)

If err_Renamed <> cdOK Then

GoTo ErrHandler

End If
Exit Sub
ErrHandler:

'UPGRADE_NOTE: Object m_Progress may not be destroyed until it is garbage
collected. Click for more:
'ms-help://MS.VSCC.2003/commoner/redir/redirect.htm?keyword="vbup1029"'

m_Progress = Nothing
CDUnlockUI(m_hSource)
If GETERRORID(err_Renamed) <> cdOPERATION_CANCELLED Then

MsgBox("ErrorCode = 0x" & Hex(err_Renamed), MsgBoxStyle.Critical, "Error")

End If
End Sub
Nov 20 '05 #1
1 2810
Hi John

Here is the link that explain the AddressOf issue well.

http://msdn.microsoft.com/library/de...us/vbcon/html/
vbup1048.asp
or
ms-help://MS.VSCC/MS.MSDNQTR.2003APR.1033/vbcon/html/vbup1048.htm

This link contains general recommendation for the upgration.
http://msdn.microsoft.com/library/de...us/vbcon/html/
vbconUpgradingApplicationsCreatedInPreviousVersion sOfVisualBasic.asp

Hope this would help.

John Chen

Nov 20 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Ray | last post by:
Hello, This one I think should be easy when you now how but I couldn't get it today. I have to run a kind of double check routine. 1 database, 2 tables. No linking or referential integrity or...
0
by: Tom Gugger | last post by:
OMNI GROUP tgugger@buckeye-express.com 419-380-8853 BEA MIDDLEWARE EXPERT/ CONTRACT TO PERM/ PA
7
by: John Smith | last post by:
Hi All, Sorry if I am calling expert's advice on such a simple thing. I am reading a c++ code but do not understand what this means? #define DM_ITEMS 6 #define FM_ITEMS ( 1 << (DM_ITEMS -...
1
by: ViperDK \(Daniel K.\) | last post by:
i've a database where relations are hold in a special way which the project leaders think of as "performant and uncomplicated" but which is very questionable to me:...
1
by: Holli Graham | last post by:
Hi, Could some Opera CSS expert take a look at http://www.cahabagba.com and tell me if there is a problem with my stylesheets or if it's just Opera weirdness? I've tested this on many browsers...
5
by: KevinGPO | last post by:
Two quick queries: 1. I have programmed a little network performance monitor. It monitors a set of remote hosts over a network. It gets the CPU statistics and all gets collected at one of the...
4
by: Tony Houghton | last post by:
Can anyone recommend a good book for intermediate up to expert level? I'm an experienced C programmer and I learnt Python from the "Learning Python" O'Reilly book because it had good reviews. I was...
3
by: Wendell III | last post by:
Meetroduction (Meetro) is looking for a full-time JavaScript expert. Chicago-based startup seeks an experienced, dedicated and energetic JavaScript programmer to develop components of a robust,...
4
by: jesper_lofgren | last post by:
Hi there, I have some webcontrols that i want to add dynamically on a page. I have stored the path / namespace in database (ex MyNameSpace.WebControls.Control1) to the class/webcontrol. Lets...
1
isladogs
by: isladogs | last post by:
The next online meeting of the Access Europe User Group will be on Wednesday 6 Dec 2023 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, Mike...
0
by: veera ravala | last post by:
ServiceNow is a powerful cloud-based platform that offers a wide range of services to help organizations manage their workflows, operations, and IT services more efficiently. At its core, ServiceNow...
0
by: VivesProcSPL | last post by:
Obviously, one of the original purposes of SQL is to make data query processing easy. The language uses many English-like terms and syntax in an effort to make it easy to learn, particularly for...
3
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 3 Jan 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). For other local times, please check World Time Buddy In...
0
by: mar23 | last post by:
Here's the situation. I have a form called frmDiceInventory with subform called subfrmDice. The subform's control source is linked to a query called qryDiceInventory. I've been trying to pick up the...
0
by: abbasky | last post by:
### Vandf component communication method one: data sharing ​ Vandf components can achieve data exchange through data sharing, state sharing, events, and other methods. Vandf's data exchange method...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: fareedcanada | last post by:
Hello I am trying to split number on their count. suppose i have 121314151617 (12cnt) then number should be split like 12,13,14,15,16,17 and if 11314151617 (11cnt) then should be split like...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....

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.