Click here to Skip to main content
15,918,624 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
AnswerRe: XML parsing in QT Pin
Albert Holguin27-Dec-13 4:20
professionalAlbert Holguin27-Dec-13 4:20 
GeneralRe: XML parsing in QT Pin
Utheen29-Dec-13 20:48
Utheen29-Dec-13 20:48 
AnswerRe: XML parsing in QT Pin
Albert Holguin30-Dec-13 7:05
professionalAlbert Holguin30-Dec-13 7:05 
QuestionDynamically updating image (PNG) Pin
Don Guy26-Dec-13 12:53
Don Guy26-Dec-13 12:53 
AnswerRe: Dynamically updating image (PNG) Pin
Albert Holguin26-Dec-13 15:25
professionalAlbert Holguin26-Dec-13 15:25 
Questionhow to know file type and its protection type for office files? Pin
Le@rner24-Dec-13 1:22
Le@rner24-Dec-13 1:22 
SuggestionRe: how to know file type and its protection type for office files? Pin
Richard MacCutchan24-Dec-13 4:23
mveRichard MacCutchan24-Dec-13 4:23 
GeneralRe: how to know file type and its protection type for office files? Pin
Le@rner25-Dec-13 18:23
Le@rner25-Dec-13 18:23 
GeneralRe: how to know file type and its protection type for office files? Pin
Richard MacCutchan25-Dec-13 23:57
mveRichard MacCutchan25-Dec-13 23:57 
QuestionDirectShow - video resize interpolation Pin
sdancer7523-Dec-13 22:09
sdancer7523-Dec-13 22:09 
AnswerRe: DirectShow - video resize interpolation Pin
sdancer757-Jan-14 23:20
sdancer757-Jan-14 23:20 
AnswerRe: DirectShow - video resize interpolation Pin
sdancer754-Mar-14 21:52
sdancer754-Mar-14 21:52 
QuestionStuck at FILE_ATTRIBUTE_REPARSE_POINT attribute Pin
vishalgpt23-Dec-13 19:39
vishalgpt23-Dec-13 19:39 
AnswerRe: Stuck at FILE_ATTRIBUTE_REPARSE_POINT attribute Pin
Richard MacCutchan23-Dec-13 22:11
mveRichard MacCutchan23-Dec-13 22:11 
AnswerRe: Stuck at FILE_ATTRIBUTE_REPARSE_POINT attribute Pin
Randor 24-Dec-13 19:00
professional Randor 24-Dec-13 19:00 
AnswerRe: Stuck at FILE_ATTRIBUTE_REPARSE_POINT attribute Pin
jschell25-Dec-13 8:03
jschell25-Dec-13 8:03 
QuestionLittle OT, but I am really puzzled by this. Pin
Vaclav_23-Dec-13 15:12
Vaclav_23-Dec-13 15:12 
AnswerRe: Little OT, but I am really puzzled by this. Pin
enhzflep23-Dec-13 21:02
enhzflep23-Dec-13 21:02 
AnswerRe: Little OT, but I am really puzzled by this. Pin
Richard MacCutchan23-Dec-13 22:09
mveRichard MacCutchan23-Dec-13 22:09 
QuestionRe: Little OT, but I am really puzzled by this. Pin
CPallini26-Dec-13 7:17
mveCPallini26-Dec-13 7:17 
AnswerRe: Little OT, but I am really puzzled by this. Pin
Vaclav_26-Dec-13 8:20
Vaclav_26-Dec-13 8:20 
GeneralRe: Little OT, but I am really puzzled by this. Pin
CPallini26-Dec-13 9:04
mveCPallini26-Dec-13 9:04 
QuestionCan't call a VB6 function from C Pin
Arm5523-Dec-13 5:42
Arm5523-Dec-13 5:42 
Hello everybody, I'm new in this forum. I don't know where to place this thread, because it's about VB6 and C, but I think the problem is in the C code so here I am. I'm working with C with no special focus, so the solution can be in C++ too Smile | :)

Well, this is the problem. I have a VB6 program that simply calls a function when the Command1 is pressed. This one:

VB
Public Function SampleSub(ByVal x As Integer, ByVal y As Integer) As Boolean
    MsgBox "Hello world!"
    SampleSub = True
End Function


I'm trying to call it from C like this:

C++
#include "main.h"

typedef BOOL (__stdcall *SampleSubPtr)(WORD, WORD);
static SampleSubPtr SampleSub;

DLL_EXPORT BOOL APIENTRY DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
{
    BOOL ret;

    if (fdwReason == DLL_PROCESS_ATTACH)
    {
            SampleSub = (SampleSubPtr)(0x00401B90);
            if (SampleSub == NULL)
                MessageBox(0, "SampleSub is NULL.", "M", 0);
            ret = SampleSub(5, 5);
    }

    return TRUE;
}


0x00401B90 is the pointer to the VB6 function. Then I place this DLL into the VB6 program memory space and the function is called. But it simply doesn't work. Debugging this with OllyDbg gives me this error when calling the function:

Access violation when reading [00000076]

I'm 100% sure that the function is at the address 0x00401B90. VB6 uses __stdcall and I use __stdcall from C. VB6 uses 16-bit integers and I use 16-bit integers (WORD) from C.

I can't solve this. Any ideas?

Thanks in advance! Smile | :)
QuestionRe: Can't call a VB6 function from C Pin
David Crow23-Dec-13 5:44
David Crow23-Dec-13 5:44 
AnswerRe: Can't call a VB6 function from C Pin
Arm5523-Dec-13 7:01
Arm5523-Dec-13 7:01 

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.