|
-
May 9th, 2005, 05:02 AM
#1
Thread Starter
Frenzied Member
Pointers to arrays..? a[spaz][how_what][i]?
Code:
UINT ExtractIconEx(
LPCTSTR lpszFile,
int nIconIndex,
HICON *phiconLarge,
HICON *phiconSmall,
UINT nIcons
);
Okay, I have a pointer to an array of icons being passed out by phiconLarge, and phiconSmall. How do I move through the array?
I'm actually going to be trying to do this in C#
Code:
#region Win32 API (UnManaged)
[DllImport("User32")]
private static extern bool DestroyIcon(
IntPtr hIcon
);
[DllImport("Shell32")]
private static extern uint ExtractIconEx(
LPCTSTR lpszFile,
int nIconIndex,
IntPtr *phiconLarge,
IntPtr *phiconSmall,
uint nIcons
);
#endregion
Also, does anyone know the values for these. To retrieve the dimensions of the large and small icons, use the function with the SM_CXICON, SM_CYICON, SM_CXSMICON, and SM_CYSMICON flags.
Code:
#region Bit Flag Enumerations
/// <summary>
/// To retrieve the dimensions of the large and small icons, use the function with the SM_CXICON, SM_CYICON, SM_CXSMICON, and SM_CYSMICON flags.
/// </summary>
[Flags]
enum SM
{
SM_CXICON,
SM_CYICON,
SM_CXSMICON,
SM_CYSMICON
}
#endregion
I don't have the needed header on my system to look it up.
I know this could be an API or C# thread, but I thought who better to ask than the experts... On the C# side of things though. Will releaseing the System.Drawing.Icon I plan to load from my Icon Handle sufice or should I call DestroyIcon? Or could I say open the icon from the handle draw it into a new managed icon and then destroy the icon I first opened? I'm planning to Open the Icons and throw them into an ImageList.
Magiaus
If I helped give me some points.
-
May 9th, 2005, 01:04 PM
#2
Thread Starter
Frenzied Member
Re: Pointers to arrays..? a[spaz][how_what][i]?
Magiaus
If I helped give me some points.
-
May 9th, 2005, 01:33 PM
#3
Frenzied Member
Re: Pointers to arrays..? a[spaz][how_what][i]?
The best advice I can give you for getting the values of SM_CXICON and other defines is to create a very small c++ program just for that purpose. That's the way I did it when I programmed in c#. Download Dev-c++
I believe if you create a .net Icon from a HICON the .net Icon is a copy of the HICON and therefore you need to destroy both Icon and HICON. DestroyIcon for the HICON and the .net way for the Icon.
In c# I don't know how you would deal with an array of HICON's. I assume like you would in c++ use []- indexing.
-
May 9th, 2005, 08:06 PM
#4
Thread Starter
Frenzied Member
Re: Pointers to arrays..? a[spaz][how_what][i]?
Thx for the info. I don't know why I don't have all the headers avaliable I have vc7 installed..... I have them all in one of my stacks of cd's somewhere.
I have never made a c++ project that was complex enough to have pointers to arrays so I wasn't sure if it was [accessor] or if you had to create an object of some kind from the pointer to access the memory. I was trying to decied if I needed to byte shift or not. I know bit shifting a pointer can behave in strange ways.
I'm still getting the hang of DllImport also; it is a bit tricky. Some things you have to explicitly set IDL for type conversion and in/out some you don't...
Magiaus
If I helped give me some points.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|