Click here to Skip to main content
15,512,456 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Dear All,

I have got something like this in C#:

public static Cursor CreateCursor(Bitmap bmp, int xHotSpot, int yHotSpot)
            IconInfo tmp = new IconInfo();
            GetIconInfo(bmp.GetHicon(), ref tmp);
            tmp.xHotspot = xHotSpot;
            tmp.yHotspot = yHotSpot;
            tmp.fIcon = true;
            return new Cursor(CreateIconIndirect(ref tmp));

public struct IconInfo
            public bool fIcon;
            public int xHotspot;
            public int yHotspot;
            public IntPtr hbmMask;
            public IntPtr hbmColor;

Can Anyone please help me to convert the same into VB6.0 code?

♥…ЯҠ…♥ 26-Nov-13 9:07am    
You sure, you want it in VB6.0? or VB.Net?
thatraja 26-Nov-13 9:14am    
I have posted a blog about list of converters but not this one included & I won't. I suggest you to get rid of VB 6, it's almost dead.
Dave Kreskowiak 26-Nov-13 10:20am    
Almost?? It IS dead!
thatraja 26-Nov-13 10:25am    
No, few some people made that as zombie
CHill60 26-Nov-13 18:19pm    
Good Heavens! I've wasted so much time trying to convince non-technical managers to allow us to use .NET languages (ANY .net language would do) and to migrate VB6 code NOW (actually about 3 years ago would still have been rather late)... please, please, please don't do this conversion. Stick with the C#, or if you must then stick with the VB.NET conversion (in solution 1)

1 solution

Hi Raj,

I do not know why you want to convert C# code to VB6.0 ;-)
What I would like to suggest is, try to convert the C# code to VB.Net initially then convert VB.Net code to VB6.0.
Probably it would be easy for you to do it.
I have converted C# code to VB.Net code for you
Public Shared Function CreateCursor(bmp As Bitmap, xHotSpot As Integer, yHotSpot As Integer) As Cursor
    Dim tmp As New IconInfo()
    GetIconInfo(bmp.GetHicon(), tmp)
    tmp.xHotspot = xHotSpot
    tmp.yHotspot = yHotSpot
    tmp.fIcon = True
    Return New Cursor(CreateIconIndirect(tmp))
End Function

Public Structure IconInfo
	Public fIcon As Boolean
	Public xHotspot As Integer
	Public yHotspot As Integer
	Public hbmMask As IntPtr
	Public hbmColor As IntPtr
End Structure

Now its your work to rewrite the concept from VB.Net to VB6.0
Hope this helps you a bit.

Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900