how to integrate C or C++ program in Visual basic?

surbhi bakshi

surbhi bakshi

@surbhi-bakshi-DCa0kc Oct 26, 2024
How can we integrate some .c or .cpp file in UI made using VB.
for example i made an identical UI using VB of 'minesweeper' the in-famous game!
now i want to use my C program to generate 10 random mines and numbers according to mines in UI of minesweeper i made
say 1st block of my minesweeper UI is array[0][0] according to my C program and if my C program assigns '2' array[0][0] then that mine on clicking must give '2'

how do i integrate my C program and UI build from VB?

Replies

Welcome, guest

Join CrazyEngineers to reply, ask questions, and participate in conversations.

CrazyEngineers powered by Jatra Community Platform

  • greatcoder

    greatcoder

    @greatcoder-Zo4hpf Mar 26, 2012

    surbhi bakshi
    How can we integrate some .c or .cpp file in UI made using VB.
    for example i made an identical UI using VB of 'minesweeper' the in-famous game!
    now i want to use my C program to generate 10 random mines and numbers according to mines in UI of minesweeper i made
    say 1st block of my minesweeper UI is array[0][0] according to my C program and if my C program assigns '2' array[0][0] then that mine on clicking must give '2'

    how do i integrate my C program and UI build from VB?
    You may look into Application Programmability Component (APC)
    The APC, a set of APIs on top of the core Visual Basic for Applications API, simplifies the process of integrating Visual Basic for Applications into your application. It is the preferred method of integration. MFC and C++ helper class templates also are included to ease integration in MFC and C++ applications.
    #-Link-Snipped-#

    All the best.
  • eemichael83

    eemichael83

    @eemichael83-1Q6gID Mar 29, 2012

    One thing you could try is compiling your c/c++ code into a dll. You can then add a reference to the DLL in your VB project and use the DLLImport statement from the System.Runtime.InteropServices namespace to import the methods/functions into your VB project.