473,387 Members | 1,791 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,387 software developers and data experts.

HINSTANCE

Hi,

how do I get the HINSTANCE for an .NET application?
ExtractAssociatedIcon always complains about an missing pointer reference...

Regards,

Martin
Nov 16 '05 #1
2 4809
mphanke,

I am curious, why not use SHGetFile info? It will get the icon
associated with a file, and take into account shell handlers and the like
(unlike ExtractAssociatedIcon). Also, you don't need an application handle.

If you still want to get the HINSTANCE, then you will have to get a
module from the application (through a call to the GetModule or GetModules
method on the Assembly class) and pass that to the static GetHINSTANCE
method on the Marshal class.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"mphanke" <mp*****@nospam.nospam> wrote in message
news:OO**************@TK2MSFTNGP12.phx.gbl...
Hi,

how do I get the HINSTANCE for an .NET application?
ExtractAssociatedIcon always complains about an missing pointer
reference...

Regards,

Martin

Nov 16 '05 #2
Hi,

I tried your way - the problem was the file was on a Server and this
didn't work, as long as the file is stored locally there is no problem.
Look at the "Retrieve File Icon from Registry"-thread, I posted some source.

Thanks for your hint though this really helped me!
Regards,

Martin

Nicholas Paldino [.NET/C# MVP] wrote:
mphanke,

I am curious, why not use SHGetFile info? It will get the icon
associated with a file, and take into account shell handlers and the like
(unlike ExtractAssociatedIcon). Also, you don't need an application handle.

If you still want to get the HINSTANCE, then you will have to get a
module from the application (through a call to the GetModule or GetModules
method on the Assembly class) and pass that to the static GetHINSTANCE
method on the Marshal class.

Hope this helps.

Nov 16 '05 #3

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

Similar topics

2
by: Yves | last post by:
Hello, Using VB6, i am trying to get the module filename from the cursor positioned on any windows, with the following code (modified from Article ID: Q112649 in MSDN LIBRARY for Visual Studio...
0
by: dag | last post by:
Hi! I would like to do an overlap window, over my main window (of my application), with a Progress Bar. Exactly when I push a button of my application I want show a window, with a Progress bar,...
12
by: Bonj | last post by:
i'm trying to create a class that will contain all the features of instantiating a window and showing it. I've got the SetWindowLong / GetWindowLong pair to succesfully store the 'this' pointer in...
3
by: SHC | last post by:
Hi all, 1) I have used VC++.NET 2002 (v7.0) for a while. Recently I just installed VC++.NET 2003 (v7.1) - I saw the message "Settings were not migrated from Visual Studio.NET 2002 to Visual...
6
by: Maileen | last post by:
Hi, When i try to use HINSTANCE under VC.NET 2005 (windows.forms application), VC informs me that i must place a token (;) after HINSTANCE... but it is not correct. So, where is the problem ?...
6
by: scottt | last post by:
I am trying to call into some C++ code from C#. One of the functions requires a handle to the instance (HINSTANCE hInstance) of the C# program. How do I access this in C#. Thanks,
6
by: Pucca | last post by:
I have a program that originally compiles into a exe file. I changed the compile option to generate dll file. This program calls a com component. Can I use pinvoke in C# to call it? The...
1
by: dave | last post by:
I'm writing a little helper class in C++ for my C# project to do some things that aren't available in frameworks (like managing the clipboard chain). In order to create a proxy window to catch...
1
by: rsteph | last post by:
I bought a book to help me learn to use DirectX with windows programming. It's first trying to walk me through some basic windows programming and graphics before getting into DirectX. I'm trying to...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: 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
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
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.