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

  • Home
  • SEARCH
  • 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 7588663
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 30, 20262026-05-30T19:58:42+00:00 2026-05-30T19:58:42+00:00

I have a DLL with the following code using System.Text; using Microsoft.Win32; using System.Diagnostics;

  • 0

I have a DLL with the following code

using System.Text;
using Microsoft.Win32;
using System.Diagnostics;
using System.Runtime.InteropServices;

namespace ApplicationCheck
{
    public  class ApCkr
    {

        #region .NET
        public string Netframeworkavailable()
        {
            bool NETinstall;
            RegistryKey k1 = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\NET Framework Setup\\NDP\\v4\\Client");
            if (k1 == null)
            {
                NETinstall = false;
            }
            else
            {
                NETinstall = true;
            }
            return NETinstall.ToString();
        }


        #endregion

        #region PDF
        public string PDFavailable()
        {
            bool PDFinstall;
            RegistryKey k2 = Registry.ClassesRoot.OpenSubKey(".pdf");
            if (k2 == null)
            {
                PDFinstall = false;
            }
            else
            {
                PDFinstall = true;
            }
            return PDFinstall.ToString(); 
        }
        #endregion


        #region IExplore

        public string IEavailable()
        {

            bool IEversion;
            string  k3 = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\Internet Explorer").GetValue("Version").ToString();
            string z = k3.Substring(0, 1);
            int a = Int32.Parse(z);

             if (a < 8)
            {
                IEversion = false;
            }
            else
            {
                IEversion = true;
            }
            return IEversion.ToString();
        }
        #endregion


        #region IIS
        public string IISavailable()
        {
            bool IISinstall;
            RegistryKey k4 = Registry.LocalMachine.OpenSubKey("SOFTWARE\\Microsoft\\InetStp");
            if (k4 == null)
            {
                IISinstall = false;
            }
            else
            {
                IISinstall = true;
            }
            return IISinstall.ToString();
        }


        #endregion

    }

}

And a WPF window with the followig XAML code

<Window x:Class="WpfApplication1.Window2"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        ResizeMode="CanResizeWithGrip"
        WindowStyle="None" Background="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"
        Title="Window2" Height="350" Width="525">
    <Grid>
        <Label Content="Windows" Height="25" HorizontalAlignment="Left" Margin="12,15,0,0" Name="label1" VerticalAlignment="Top" Width="106" />
        <Label Content="Edition " Height="25" HorizontalAlignment="Left" Margin="12,45,0,0" Name="label2" VerticalAlignment="Top" Width="106" />
        <Label Content="Service Pack " Height="25" HorizontalAlignment="Left" Margin="12,75,0,0" Name="label3" VerticalAlignment="Top" Width="106" />
        <Label Content="Version " Height="25" HorizontalAlignment="Left" Margin="12,105,0,0" Name="label4" VerticalAlignment="Top" Width="106" />
        <Label Content="Processor Bits " Height="25" HorizontalAlignment="Left" Margin="12,135,0,0" Name="label5" VerticalAlignment="Top" Width="106" />
        <Label Content="OS Bits " Height="25" HorizontalAlignment="Left" Margin="12,165,0,0" Name="label6" VerticalAlignment="Top" Width="106" />
        <Label Content="Program Bits " Height="25" HorizontalAlignment="Left" Margin="12,195,0,0" Name="label7" VerticalAlignment="Top" Width="106" />
        <TextBlock Height="21" HorizontalAlignment="Left" Margin="114,19,0,0" Name="textBlock1"   Text="{Binding Path=var}" VerticalAlignment="Top" Width="249" ContextMenuOpening="textBlock1_ContextMenuOpening" />
    </Grid>
</Window>

and the WPF’s c# code

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;

namespace WpfApplication1
{
    /// <summary>
    /// Interaction logic for Window2.xaml
    /// </summary>
    public partial class Window2 : Window
    {
        public Window2()
        {
            InitializeComponent();
        }

        private void textBlock1_ContextMenuOpening(object sender, ContextMenuEventArgs e)
        {
            var NET = new ApplicationCheck.ApCkr();
            textBlock1.Text = NET.Netframeworkavailable();
            this.DataContext = textBlock1;

        }


    }
}

I researched data binding in MSDN and At stack overflow namely this – DataBinding Between a WPF GUI and a couple of ListBox/CheckBox

and others but i cannot get it right.And although stack overflow helped me utilise this in a console app.Now i have to do this in a WPF window.

Edit:I have to display the returned values from the DLL

  • 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-30T19:58:43+00:00Added an answer on May 30, 2026 at 7:58 pm

    In order to present the data from the DLL in the UI using binding, you need to have an object with public getters. In your UI DLL create a class (in mvvm design patern, this class is called ‘View Model’) with the public getters:

    public class ApCkrVm {
        public string netFrameworkAvailable {
            get { return ApCkr.NetFrameworkAvailable(); }
        }
        public string pdfAvailable {
            get { return ApCkr.PDFAvailable(); }
        }
        ...
    }
    

    Then, in Window2 constructor, set ApCkrVm to be the DataContext:

    public Window2( ) {
        this.DataContext = new ApCkrVm( );
        InitializeComponent( );
    }
    

    Finally, add text blocks in the XML file, binding the Text to the properties:

    <TextBlock Text="{Binding Path=netFrameworkAvailable}" ... />
    

    Some other comments:

    • You aren’t utilizing very well the <Grid> element. You’ll be better off defining ColumnDefinitions and RowDefinitions, creating a 2xn table.
    • ApCkr method can all be static. This class has no context.
    • I don’t think your application could run if .net framework isn’t available. If your application is running, you can safely put ‘true’ there.
    • Consider caching the values in ApCkrVm.
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a DLL with the following code using System.Text; using Microsoft.Win32; using System.Diagnostics;
I have tried the following code but has no effect: Imports system.Runtime.InteropServices <DllImport(UxTheme.DLL, BestFitMapping:=False,
I have the following C# code that uses DLLImport. using System; namespace LvFpga {
I start the NServisBus.host.exe file from my wpf application using the following code: System.Diagnostics.Process.Start(NServiceBus.Host.exe);
I have used the following code in a number of applications to load .DLL
I have following requirement, I have C#/.Net console application, which refers to 'System.Data.Sqlite.dll' 'System.Data.Sqlite.dll'
I have a third-party (Win32) DLL, written in C, that exposes the following interface:
The following code (packaged in a 'Console Application' Visual Studio project): using System; using
I have a dll with following signature in C++. It is working in c++;
I have a DLL that I can use to pull the following information about

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.