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

Upgrade problem - help required

Hi,

I am upgrading a VB6 project that used a stdPicture and passed it's handle
property to a DirectX 7 API function.

VB .net doesn't support the stdPicture and advises using
system.drawing.image as an alternative, but the .net image control doesn't
have a handle property.

I have worked out how to add a stdPicture object to my .net project by
adding a reference to stdOLE, but now I can't work out how to load a picture
into it. In VB6 I used the LoadPicture() function, but this isn't available
in .net.

Can someone either suggest a way to obtain the handle for the .net image or
advise how to load a picture into a stdPicture object.

Thanks,

Martin Horn.
Nov 21 '05 #1
4 1285
I haven't tried this myself, but the PictureBox .NET control has a handle
property that you might be able to pass to the DirectX 7 API.

You can load an image into the picturebox with:

PictureBox1.Image = System.Drawing.Image.FromFile(fileName)

HTH,
Scott Swigart
www.swigartconsulting.com
blog.swigartconsulting.com

"Martin Horn" wrote:
Hi,

I am upgrading a VB6 project that used a stdPicture and passed it's handle
property to a DirectX 7 API function.

VB .net doesn't support the stdPicture and advises using
system.drawing.image as an alternative, but the .net image control doesn't
have a handle property.

I have worked out how to add a stdPicture object to my .net project by
adding a reference to stdOLE, but now I can't work out how to load a picture
into it. In VB6 I used the LoadPicture() function, but this isn't available
in .net.

Can someone either suggest a way to obtain the handle for the .net image or
advise how to load a picture into a stdPicture object.

Thanks,

Martin Horn.

Nov 21 '05 #2


"Martin Horn" wrote:
Hi,

I am upgrading a VB6 project that used a stdPicture and passed it's handle
property to a DirectX 7 API function.

VB .net doesn't support the stdPicture and advises using
system.drawing.image as an alternative, but the .net image control doesn't
have a handle property.

I have worked out how to add a stdPicture object to my .net project by
adding a reference to stdOLE, but now I can't work out how to load a picture
into it. In VB6 I used the LoadPicture() function, but this isn't available
in .net.

Can someone either suggest a way to obtain the handle for the .net image or
advise how to load a picture into a stdPicture object.

Thanks,

Martin Horn.

Nov 21 '05 #3
Hi Scott,

thanks for the reply, but I have already tried using a picturebox and
passing the handle property without any success.

Regards,

Martin.

"Scott Swigart" <sc***@swigartconsulting.com> wrote in message
news:E9**********************************@microsof t.com...
I haven't tried this myself, but the PictureBox .NET control has a handle
property that you might be able to pass to the DirectX 7 API.

You can load an image into the picturebox with:

PictureBox1.Image = System.Drawing.Image.FromFile(fileName)

HTH,
Scott Swigart
www.swigartconsulting.com
blog.swigartconsulting.com

"Martin Horn" wrote:
Hi,

I am upgrading a VB6 project that used a stdPicture and passed it's
handle
property to a DirectX 7 API function.

VB .net doesn't support the stdPicture and advises using
system.drawing.image as an alternative, but the .net image control
doesn't
have a handle property.

I have worked out how to add a stdPicture object to my .net project by
adding a reference to stdOLE, but now I can't work out how to load a
picture
into it. In VB6 I used the LoadPicture() function, but this isn't
available
in .net.

Can someone either suggest a way to obtain the handle for the .net image
or
advise how to load a picture into a stdPicture object.

Thanks,

Martin Horn.

Nov 21 '05 #4
In case anyone else has the same problem, here is a solution that worked for
me.

Dim fs As New System.IO.FileStream(Application.StartupPath &
"\Invader1_1.bmp", System.IO.FileMode.Open)
Dim b As New Bitmap(Application.StartupPath & "\Invader1_1.bmp")
Dim handle As IntPtr
handle = b.GetHbitmap()

handle can now be passed to the DirectX API function and everything works as
expected.
Nov 21 '05 #5

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

Similar topics

1
by: cpchan | last post by:
According the documentation from Metalink, the following files are required for the Oracle Upgrade from 8.1.6 to 8.1.7 : u0801060.sql c0801060.sql a0801060.sql i0801060.sql utlip.sql ...
16
by: Braxton Beyer | last post by:
I have just added a message to my website, wellheard.com, notifying WinIE users that their browsers will not render the site correctly as the site uses PNGs with alpha transparency. I then give...
2
by: Danny | last post by:
What is required before you have the MS Access upgrade, or the Office pro upgrade? Thanks
1
by: SKG | last post by:
Hi all We currently use a split A2k database system with about 10,000 clients / 45,000 orders / 90,000 order entries etc with about 17 users (only 8 users do editing) We currently upload data...
6
by: Terry Bell | last post by:
We've had a very large A97 app running fine for the last seven years. I've just converted to SQL Server backend, which is being tested, but meanwhile the JET based version, running under terminal...
1
by: noone | last post by:
I upgraded VS 2003 and asked my ISP (MaximumASP) to upgrade the server to net 1.1. That was two weeks ago and I am having a problem that will not go away. When publishing the site from VS I get an...
4
by: john | last post by:
I'm having some Interop problems. I really need someone's help on this, i'm running out of ideas. I have upgraded my Data access controls to the latest ver. Now then i have a form with these...
4
by: Goofy | last post by:
I bought VS2003 in 2003 of course :) Now I want to upgrade but I was wondering when you install an upgrade if it A.) Requires that VS2003 be already installed B.) Overwrites it or allows...
2
by: KR | last post by:
Hi, We are running a test upgrade form sql 2000 standard edition to sql 2005 developer edition. Followed through all the steps and specified the account(SA priveleges and currently used by the...
1
by: Paul Cheetham | last post by:
Hi, I have had an old VS6 MFC application dumped on me and I am attempting to upgrade it to VS2005. I have a problem in that the filebuf::open command now only takes 2 parameters instead of 3....
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: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new...

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.