473,386 Members | 1,705 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,386 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 2824
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...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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
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...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.