Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3398022
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T04:35:57+00:00 2026-05-18T04:35:57+00:00

I’m working with some hardware which has a DLL. I believe it has two

  • 0

I’m working with some hardware which has a DLL. I believe it has two methods of calling the functionality (from using a DLL spy app).

It currently works in VB6 using

Public Type Versions
   Pname As Long
   Manuf As Long
   VMajor As Long
   VMinor As Long
   VState As Long
End Type

Public Declare Function FLASH_GetVersion Lib "C:\flash_cntrl.dll" (ByVal fxc_Versions As Long) As Integer

Dim vVers As Versions
Dim strProdName As String
Dim strManuf As String

strProdName = "                                                                                              "
strManuf = "                                                                                              "

vVers.Manuf = StrPtr(strManuf)
vVers.Pname = StrPtr(strProdName)

iReturn = FLASH_GetVersion(VarPtr(vVers))

I’m being “forced” to move to C# 2008/2010 to be able to use some other hardware which isn’t supported in VB6.

So, I’m trying to use the above and running into the AccessViolationException error. I’m “lucky” enough to have a C++ header file with the WinAPI definitions but still struggling. Any help would be much appreciated.

 typedef struct {
 LPWSTR productname;
 LPWSTR manufacturer;
 unsigned Vers_Major;
 unsigned Vers_Minor;
 unsigned Vers_State;      // = 0 released, > 0 internal use only
} FLASH_INFO;

int WINAPI FLASH_GetVersion  (FLASH_INFO *fxc_Version);

My C# so far is

static class NativeMethods
{
    [DllImport("C:\\flash_cntrl.dll")]
    public static extern short FLASH_GetVersion(FLASH_INFO vVers);
}

public class FLASH_INFO
{
    public string productname;
    public string manufacturer;
    public int Vers_Major;
    public int Vers_Minor;
    public int Vers_State;
}

        FLASH_INFO vers = new FLASH_INFO();

        string strManuf = "                                ";
        string strProdName = "                                ";

        vers.productname = strProdName;
        vers.manufacturer = strManuf;
        vers.Vers_Major = 0;
        vers.Vers_Minor = 0;
        vers.Vers_State = 0;

        short sRet = NativeMethods.FLASH_GetVersion(vers);

        Console.WriteLine("{0}|{1}", "sRet", sRet.ToString());

It’s probably something simple, but I’m relatively new to the C# language (done some desktop programming and silverlight only).

Thank you in advance

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-18T04:35:57+00:00Added an answer on May 18, 2026 at 4:35 am

    The default marshaling for strings is as 8-bit characters, LPWSTR is a Unicode string though. The return type isn’t correct either. Fix:

    [DllImport("C:\\flash_cntrl.dll")]
    public static extern int FLASH_GetVersion(ref FLASH_INFO vVers);
    
    [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)
    public struct FLASH_INFO
    {
        public string productname;
        public string manufacturer;
        public int Vers_Major;
        public int Vers_Minor;
        public int Vers_State;
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

That's pretty much it. I'm using Nokogiri to scrape a web page what has
link Im having trouble converting the html entites into html characters, (&# 8217;) i
Does anyone know how can I replace this 2 symbol below from the string
I'm trying to decode HTML entries from here NYTimes.com and I cannot figure out
I have just tried to save a simple *.rtf file with some websites and
I want to count how many characters a certain string has in PHP, but
I want use html5's new tag to play a wav file (currently only supported
Seemingly simple, but I cannot find anything relevant on the web. What is the
this is what i have right now Drawing an RSS feed into the php,
I ran into a problem. Wrote the following code snippet: teksti = teksti.Trim() teksti

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.