Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsFree MagazinesWhite PapersSubmit Content
Discussion GroupsASP.NETWindows FormsLanguages.NET FrameworkVisual Studio.NET
Articles.NET FrameworkASP.NETToolsWindows Forms
.NET DirectoryOpen Source ProjectsUser GroupsWeb Resources
Related Topics
Visual Basic 6SQL ServerMS AccessOther DB ProductsMS Server ProductsMore Topics ...

.NET Forum / Languages / C# / February 2008

Tip: Looking for answers? Try searching our database.

How Do I Get A Handle To and Assembly Object???

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
E.D.I - 25 Feb 2008 16:14 GMT
How Do I Get A Handle To and Assembly Object???
Actually i need to use Bitmap.FromResource() and i need to give it the
name and a handle of the Assembly...
Please Help!!!! Realy Realy Stuck....
Jon Skeet [C# MVP] - 25 Feb 2008 16:18 GMT
> How Do I Get A Handle To and Assembly Object???
> Actually i need to use Bitmap.FromResource() and i need to give it the
> name and a handle of the Assembly...
> Please Help!!!! Realy Realy Stuck....

Well, which assembly are you trying to get hold of?

You're likely to find that typeof(...).Assembly is what you're after,
but you need to know a type within the assembly in order to use
typeof.

Jon
E.D.I - 25 Feb 2008 18:39 GMT
> > How Do I Get A Handle To and Assembly Object???
> > Actually i need to use Bitmap.FromResource() and i need to give it the
[quoted text clipped - 8 lines]
>
> Jon

this shoud be an assembly of a Form i guess, u see i'm in the middle
of a project in witch we are at work of creating a program for
automatic converting our delphi coded program to C# coded progran
in .NET so this function is a general functiion that works in delphi
and i'm looking for a prallel way in c# so i'm not sure about the type
but i guess it should be a Form so thanks for the help
Jon Skeet [C# MVP] - 25 Feb 2008 18:52 GMT
>  this shoud be an assembly of a Form i guess, u see i'm in the middle
> of a project in witch we are at work of creating a program for
> automatic converting our delphi coded program to C# coded progran
> in .NET so this function is a general functiion that works in delphi
> and i'm looking for a prallel way in c# so i'm not sure about the type
> but i guess it should be a Form so thanks for the help

Well it's likely to be a *particular* form, rather than just the Form
type, unless you really want to get a resource from the
System.Windows.Forms assembly.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk

E.D.I - 27 Feb 2008 06:45 GMT
> >  this shoud be an assembly of a Form i guess, u see i'm in the middle
> > of a project in witch we are at work of creating a program for
[quoted text clipped - 10 lines]
> Jon Skeet - <sk...@pobox.com>http://www.pobox.com/~skeet  Blog:http://www.msmvps.com/jon.skeet
> World class .NET training in the UK:http://iterativetraining.co.uk

Thats not working , i need the handle ( IntPtr Type )of an assembly :(
E.D.I - 27 Feb 2008 08:06 GMT
> > >  this shoud be an assembly of a Form i guess, u see i'm in the middle
> > > of a project in witch we are at work of creating a program for
[quoted text clipped - 12 lines]
>
> Thats not working , i need the handle ( IntPtr Type )of an assembly :(

i think this one should is fine ,
IntPtr HINSTANCE =
Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetType().Module);
but i dont understand what the type got to do with this and how is the
module referenced from it,
Jon Skeet [C# MVP] - 27 Feb 2008 08:48 GMT
<snip>

> i think this one should is fine ,
> IntPtr HINSTANCE =
> Marshal.GetHINSTANCE(Assembly.GetExecutingAssembly().GetType().Module);
> but i dont understand what the type got to do with this and how is the
> module referenced from it,

To be honest, I think you're going about things the wrong way. Getting
a Bitmap from an assembly resource is usually a lot easier than this,
usually using the ResourceManager class, or using Bitmap.FromStream by
providing it with the result of a call to
Assembly.GetManifestResourceStream.

Signature

Jon Skeet - <skeet@pobox.com>
http://www.pobox.com/~skeet   Blog: http://www.msmvps.com/jon.skeet
World class .NET training in the UK: http://iterativetraining.co.uk

E.D.I - 27 Feb 2008 12:59 GMT
> <snip>
>
[quoted text clipped - 13 lines]
> Jon Skeet - <sk...@pobox.com>http://www.pobox.com/~skeet  Blog:http://www.msmvps.com/jon.skeet
> World class .NET training in the UK:http://iterativetraining.co.uk

you were write thanks for the help

Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.