What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Interop.Call windows shell help

Interop.Call windows shell help
Author: Message:
Ezra
Veteran Member
*****

Avatar
Forgiveness is between them and God

Posts: 1960
Reputation: 31
37 / Male / Flag
Joined: Mar 2003
RE: Interop.Call windows shell help
I tried creating a C# wrapper for the function however this is the first time I'm attempting to use unsafe code in C# and my C# skills are lacking anyway, so I'm running into some walls.

I can't read the result from the function, maybe anyone here knows what I'm doing wrong?

C# code:
using System;
using System.Runtime.InteropServices;
 
namespace EstimateFileRiskLevelWrapper
{
    public class EstimateFileRiskLevelWrapper
    {
        [DllImport("winshfhc.dll", EntryPoint = "#101")]
        public static extern int EstimateFileRiskLevel([MarshalAs(UnmanagedType.LPWStr)] String pszFilePath, [MarshalAs(UnmanagedType.LPWStr)] String pszExt, [MarshalAs(UnmanagedType.LPWStr)] String pszHandler, ref IntPtr riskLevel);
        /*HRESULT EstimateFileRiskLevel(
            LPCWSTR pszFilePath,
            LPCWSTR pszExt,
            LPCWSTR pszHandler,
            FILE_RISK_LEVEL *pfrlEstimate
        );*/

    }
}


Trying to use the function with:
C# code:
EstimateFileRiskLevelWrapper.EstimateFileRiskLevelWrapper.EstimateFileRiskLevel(
                    fpath,
                    ".php",
                    hpath,
                    ref risklevel);
                IntPtr ptr = Marshal.ReadIntPtr(risklevel);


but I'm getting an AccessViolationException at the last line (reading the pointer).
[Image: 1-0.png]
             
11-09-2009 04:15 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Interop.Call windows shell help - by wincy on 11-08-2009 at 08:19 PM
RE: Interop.Call windows shell help - by Spunky on 11-08-2009 at 08:24 PM
RE: Interop.Call windows shell help - by wincy on 11-09-2009 at 12:10 AM
RE: RE: Interop.Call windows shell help - by CookieRevised on 11-09-2009 at 01:22 AM
RE: RE: RE: Interop.Call windows shell help - by wincy on 11-09-2009 at 03:26 PM
RE: Interop.Call windows shell help - by Ezra on 11-09-2009 at 04:15 PM
RE: Interop.Call windows shell help - by matty on 11-09-2009 at 05:32 PM
RE: Interop.Call windows shell help - by CookieRevised on 11-10-2009 at 07:51 AM
RE: Interop.Call windows shell help - by Ezra on 11-11-2009 at 10:55 PM


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On