473,327 Members | 2,112 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,327 software developers and data experts.

How to delegate in vb.net (Mohammad)

Hi to all friends. i convert this code from vb6 to vb.net and raise this error "'AddressOf' expression cannot be converted to 'Long' because 'Long' is not a delegate type."

there is some code in here :

Public Declare Function EnumResourceNames Lib "kernel32" Alias "EnumResourceNamesA" (ByVal ghmodule As Long, ByVal lpType As ResType, ByVal lpEnumFunc As Long, ByVal lParam As Long) As Long

Public Function EnumResNameProc(ByVal ghmodule As Long, ByVal lpszType As ResType, ByVal lpszName As Long, ByVal lParam As Long) As Long
Dim sNumber As String, IsNum As Boolean

If (lpszName > &HFFFF&) Or (lpszName < 0) Then
sNumber = PtrToVBString(lpszName)
IsNum = False
Else
sNumber = CStr(lpszName)
IsNum = True
End If

' 16x16
arIcon(SIZE_16, COLOR_4) = 296
arIcon(SIZE_16, COLOR_16) = 1384
arIcon(SIZE_16, COLOR_24) = 872
arIcon(SIZE_16, COLOR_32) = 1128
' 24x24
arIcon(SIZE_24, COLOR_4) = 488
arIcon(SIZE_24, COLOR_16) = 1736
arIcon(SIZE_24, COLOR_24) = 1864
arIcon(SIZE_24, COLOR_32) = 2440
' 32x32
arIcon(SIZE_32, COLOR_4) = 744
arIcon(SIZE_32, COLOR_16) = 2216
arIcon(SIZE_32, COLOR_24) = 3240
arIcon(SIZE_32, COLOR_32) = 4264
' 48x48
arIcon(SIZE_48, COLOR_4) = 1640
arIcon(SIZE_48, COLOR_16) = 3752
arIcon(SIZE_48, COLOR_24) = 7336
arIcon(SIZE_48, COLOR_32) = 9640



If IsNum Then
If lpszType = ResType.RT_ICON Then
LoadIconRes(lpszType, sNumber, giSize, giColorDepth)
End If
End If
EnumResNameProc = 1
End Function


Private Sub Form1_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
....
....
For tRes = ResType.RT_FIRST To ResType.RT_LAST
Application.DoEvents()
EnumResourceNames(ghmodule, tRes, AddressOf EnumResNameProc, 0)
Next
...
End Sub

Please help me to delegate this...
Feb 15 '07 #1
0 938

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

Similar topics

4
by: Paul E Collins | last post by:
Hello. I want an enum where each member corresponds to a method call - which seems reasonable enough. I tried something along these lines: internal class MyAttribute : Attribute { public...
3
by: Minh Khoa | last post by:
Please give me more information about delegate and its usage? Why do i use it and when?
4
by: ^MisterJingo^ | last post by:
Hi all, I've been trying to get my head around delegates. The book i'm using had a single example, not much explaination, and didn't show how to set up a delegate and pass variables in and out...
7
by: Ant | last post by:
Hello, Very simple question but one I need clarified. Which part of the statement below is considered the 'delegate'? Is it the 'new System.EventHandler' or the btnAccept_Click? or is it...
1
by: Quimbly | last post by:
I'm having some problems comparing delegates. In all sample projects I create, I can't get the problem to occur, but there is definitely a problem with my production code. I can't give all the...
11
by: matsi.inc | last post by:
I am looking to make something like a delegate that i can use in my projects but am having a hard time getting started. The behavior I am most interested in is how a delegate changes it's Invoke...
0
by: dawa-dawa | last post by:
Who is this person?? This is Mohammad Who is this person?? This is Mohammad http://mohammad.islamway.com//?lang=eng
26
by: raylopez99 | last post by:
Here is a good example that shows generic delegate types. Read this through and you'll have an excellent understanding of how to use these types. You might say that the combination of the generic...
10
by: vcquestions | last post by:
Hi. Is there way to have a function pointer to a delegate in c++/cli that would allow me to pass delegates with the same signatures as parameters to a method? I'm working with managed code. ...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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.