Click here to Skip to main content
15,899,754 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: Writing Vector object into a .txt file Pin
Jochen Arndt18-Mar-15 22:44
professionalJochen Arndt18-Mar-15 22:44 
GeneralRe: Writing Vector object into a .txt file Pin
Member 935023719-Mar-15 22:27
Member 935023719-Mar-15 22:27 
GeneralRe: Writing Vector object into a .txt file Pin
Jochen Arndt19-Mar-15 22:29
professionalJochen Arndt19-Mar-15 22:29 
GeneralRe: Writing Vector object into a .txt file Pin
Member 935023723-Mar-15 5:12
Member 935023723-Mar-15 5:12 
GeneralRe: Writing Vector object into a .txt file Pin
Jochen Arndt23-Mar-15 5:57
professionalJochen Arndt23-Mar-15 5:57 
GeneralRe: Writing Vector object into a .txt file Pin
Member 935023723-Mar-15 6:20
Member 935023723-Mar-15 6:20 
GeneralRe: Writing Vector object into a .txt file Pin
Jochen Arndt23-Mar-15 6:44
professionalJochen Arndt23-Mar-15 6:44 
GeneralRe: Writing Vector object into a .txt file Pin
Richard Andrew x6423-Mar-15 8:39
professionalRichard Andrew x6423-Mar-15 8:39 
GeneralRe: Writing Vector object into a .txt file Pin
Jochen Arndt23-Mar-15 21:53
professionalJochen Arndt23-Mar-15 21:53 
GeneralRe: Writing Vector object into a .txt file Pin
Member 935023723-Mar-15 23:47
Member 935023723-Mar-15 23:47 
GeneralRe: Writing Vector object into a .txt file Pin
Jochen Arndt24-Mar-15 0:17
professionalJochen Arndt24-Mar-15 0:17 
GeneralRe: Writing Vector object into a .txt file Pin
Member 935023725-Mar-15 4:25
Member 935023725-Mar-15 4:25 
GeneralRe: Writing Vector object into a .txt file Pin
Jochen Arndt25-Mar-15 4:46
professionalJochen Arndt25-Mar-15 4:46 
GeneralMessage Closed Pin
25-Mar-15 6:47
Member 935023725-Mar-15 6:47 
GeneralRe: Writing Vector object into a .txt file Pin
Jochen Arndt25-Mar-15 6:56
professionalJochen Arndt25-Mar-15 6:56 
QuestionBIG trouble with 64-bit Shell_NotifyIcon() - can anyone help? Pin
Tacitonitus16-Mar-15 11:24
Tacitonitus16-Mar-15 11:24 
AnswerRe: BIG trouble with 64-bit Shell_NotifyIcon() - can anyone help? Pin
Frankie-C16-Mar-15 13:00
Frankie-C16-Mar-15 13:00 
GeneralRe: BIG trouble with 64-bit Shell_NotifyIcon() - can anyone help? Pin
Tacitonitus16-Mar-15 15:36
Tacitonitus16-Mar-15 15:36 
GeneralRe: BIG trouble with 64-bit Shell_NotifyIcon() - can anyone help? Pin
Frankie-C16-Mar-15 22:39
Frankie-C16-Mar-15 22:39 
GeneralRe: BIG trouble with 64-bit Shell_NotifyIcon() - can anyone help? Pin
Tacitonitus17-Mar-15 3:34
Tacitonitus17-Mar-15 3:34 
GeneralRe: BIG trouble with 64-bit Shell_NotifyIcon() - can anyone help? Pin
Frankie-C17-Mar-15 4:11
Frankie-C17-Mar-15 4:11 
GeneralRe: BIG trouble with 64-bit Shell_NotifyIcon() - can anyone help? Pin
Tacitonitus17-Mar-15 7:21
Tacitonitus17-Mar-15 7:21 
GeneralRe: BIG trouble with 64-bit Shell_NotifyIcon() - can anyone help? Pin
Frankie-C17-Mar-15 7:29
Frankie-C17-Mar-15 7:29 
GeneralRe: BIG trouble with 64-bit Shell_NotifyIcon() - can anyone help? Pin
Frankie-C17-Mar-15 22:48
Frankie-C17-Mar-15 22:48 
QuestionVC++ DLL throws error when call it from C#[EntryPointNotFound] Pin
Member 988367216-Mar-15 1:38
Member 988367216-Mar-15 1:38 
Here i created in DLL project in vc++ 2008. Following are two code files lib.h and lib.cpp.
lib.h
C++
#include "stdafx.h";

    class __declspec(dllexport) test
    {
    public:
        test();
        static void  hello();
        static void  hello1();
    };

    class __declspec(dllexport) test1
    {
    public:
        test1();
        void  hello_test1();
        void  hello1_test1();

    };

lib.cpp
C++
#include "stdafx.h"
   #include "lib.h"
   #include <stdio.h>

   void test::hello()
   {
       printf("Hello");
   }

   void test::hello1()
   {
       printf("Hello1");
   }

   void test1::hello_test1()
   {
       printf("Hello_test1");
   }

   void test1::hello1_test1()
   {
       printf("Hello1_test1");
   }

stdafx.h
C++
#include "targetver.h"
#define WIN32_LEAN_AND_MEAN 
// Windows Header Files:
#include <windows.h>

dllMain.cpp
C++
#include "stdafx.h"

BOOL APIENTRY DllMain( HMODULE hModule,
                       DWORD  ul_reason_for_call,
                       LPVOID lpReserved
                     )
{
    switch (ul_reason_for_call)
    {
    case DLL_PROCESS_ATTACH:
    case DLL_THREAD_ATTACH:
    case DLL_THREAD_DETACH:
    case DLL_PROCESS_DETACH:
        break;
    }
    return TRUE;
}

I have written C# code to call the method of test and test1 classes:
consoleApp
C#
 [DllImport("lib.dll" )]
    public static extern void hello();

    [DllImport("lib.dll")]
    public static extern void hello1();

    [DllImport("lib.dll")]
    public static extern void hello_test1();

    [DllImport("lib.dll")]
    public static extern void hello1_test1();

 static void Main()
{ 
        hello();
        hello1();
        hello_test1();
        hello1_test1();
        Console.ReadKey();
    }

when i run above code i have got following error: EntryPointNotFoundException: Unable to find an entry point named 'hello' in DLL 'lib.dll' 1****<-Click 1 for image
I know about how to call function only(without using Class) of vc++ DLL from C# but i don't know how to call method of any class and how to code that in proper way in vc++.

I know somewhere is mistake in my above code, please experts guide me about my mistake because i tried all from my side.

If anyone has full example like above then suggest me.

Thanks in advance..

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.