Click here to Skip to main content
15,886,664 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
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 
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 
GeneralRe: Can't call a VB6 function from C Pin
Richard Andrew x6423-Dec-13 9:13
professionalRichard Andrew x6423-Dec-13 9:13 
GeneralRe: Can't call a VB6 function from C Pin
Arm5523-Dec-13 10:08
Arm5523-Dec-13 10:08 
GeneralRe: Can't call a VB6 function from C Pin
Richard Andrew x6423-Dec-13 16:43
professionalRichard Andrew x6423-Dec-13 16:43 
GeneralRe: Can't call a VB6 function from C Pin
Arm5524-Dec-13 4:41
Arm5524-Dec-13 4:41 
Hi, thanks for your answer. I tried calling a function without parameters and without return value and it doesn't work. This is the VB function now:

VB
Public Sub SampleSub()
    MsgBox "Hello world!"
End Sub


And the new C prototype:

C++
typedef void (__stdcall *SampleSubPtr)(void);


But the same Access violation error (that says OllyDbg).

In the past I was able to call a VB6 function from C, that's why I'm so angry! Frown | :( But I just can't remeber how I did it. I'm sure I did it like I'm doing now, but I don't know why it doesn't work Hmmm | :| . Now SampleSub() is at 0x00401BC0.

Do you think that the way of compiling, the language (if C or C++) or something like that is causing errors? Because I'm 90% sure that the code is the same that the one I used in the past to call a VB6 function, so I need to think that I'm compiling wrong or something like that. I'm compiling like this (or that's what CodeBlocks does for me Poke tongue | ;-P ).

mingw32-g++.exe  -Wall -DBUILD_DLL -O2     -c "C:\Path\main.cpp" -o obj\Release\main.o


And using extern "C" in the main function.

Thanks again Smile | :) .

modified 24-Dec-13 10:49am.

GeneralRe: Can't call a VB6 function from C Pin
Richard Andrew x6424-Dec-13 6:51
professionalRichard Andrew x6424-Dec-13 6:51 
GeneralRe: Can't call a VB6 function from C Pin
Arm5524-Dec-13 7:11
Arm5524-Dec-13 7:11 
GeneralRe: Can't call a VB6 function from C Pin
Randor 24-Dec-13 18:12
professional Randor 24-Dec-13 18:12 
GeneralRe: Can't call a VB6 function from C Pin
Arm5525-Dec-13 9:25
Arm5525-Dec-13 9:25 
QuestionFrom where start? Pin
Le@rner20-Dec-13 21:15
Le@rner20-Dec-13 21:15 
AnswerRe: From where start? Pin
Richard MacCutchan20-Dec-13 22:05
mveRichard MacCutchan20-Dec-13 22:05 
GeneralRe: From where start? Pin
Le@rner20-Dec-13 22:34
Le@rner20-Dec-13 22:34 
GeneralRe: From where start? Pin
Richard MacCutchan20-Dec-13 22:40
mveRichard MacCutchan20-Dec-13 22:40 
GeneralRe: From where start? Pin
Le@rner20-Dec-13 22:44
Le@rner20-Dec-13 22:44 
GeneralRe: From where start? Pin
Richard MacCutchan20-Dec-13 23:12
mveRichard MacCutchan20-Dec-13 23:12 
GeneralRe: From where start? Pin
Le@rner20-Dec-13 23:58
Le@rner20-Dec-13 23:58 
GeneralRe: From where start? Pin
Richard MacCutchan21-Dec-13 0:18
mveRichard MacCutchan21-Dec-13 0:18 
Questionhow to detect ms office files are password protected? Pin
Le@rner19-Dec-13 20:26
Le@rner19-Dec-13 20:26 
AnswerRe: how to detect ms office files are password protected? Pin
Richard Andrew x6420-Dec-13 9:38
professionalRichard Andrew x6420-Dec-13 9:38 
GeneralRe: how to detect ms office files are password protected? Pin
Le@rner20-Dec-13 17:23
Le@rner20-Dec-13 17:23 
GeneralRe: how to detect ms office files are password protected? Pin
Richard MacCutchan20-Dec-13 22:03
mveRichard MacCutchan20-Dec-13 22:03 
GeneralRe: how to detect ms office files are password protected? Pin
Le@rner20-Dec-13 22:45
Le@rner20-Dec-13 22:45 

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.