Click here to Skip to main content
15,920,896 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: DLL - Multithreading Pin
borono7-Apr-06 7:01
borono7-Apr-06 7:01 
GeneralRe: DLL - Multithreading Pin
Richard Andrew x647-Apr-06 7:16
professionalRichard Andrew x647-Apr-06 7:16 
GeneralRe: DLL - Multithreading Pin
borono7-Apr-06 7:46
borono7-Apr-06 7:46 
GeneralRe: DLL - Multithreading Pin
Richard Andrew x647-Apr-06 8:01
professionalRichard Andrew x647-Apr-06 8:01 
AnswerRe: DLL - Multithreading Pin
Waldermort7-Apr-06 7:48
Waldermort7-Apr-06 7:48 
GeneralRe: DLL - Multithreading Pin
borono7-Apr-06 8:27
borono7-Apr-06 8:27 
GeneralRe: DLL - Multithreading Pin
Richard Andrew x647-Apr-06 9:04
professionalRichard Andrew x647-Apr-06 9:04 
GeneralRe: DLL - Multithreading Pin
borono7-Apr-06 11:58
borono7-Apr-06 11:58 
no problem my friend, no harm done. In fact, your suggestion on callbacks was quite successful. Just in case anyone needs the same, here is how you perform the callback from DLL to VB.

First you need to write the DLL. Create the new project, "simple project". Then paste this code:

 extern "C" void __stdcall TestCallback( void (*cb) (int*) )
{
        int nrMsg = 123 ;
        cb( &nrMsg );

} 


Create a def file and place this in it:
LIBRARY MYDLLNAME

EXPORTS
TestCallback @1

Note: you have to do this for VB, also notice the _stdcall, again a must for VB.

Then compile the DLL and place in the VB project directory.

Create a new VB project and add a module and command button.

In module:
Option Explicit
'
Declare Sub TestCallback Lib "mydll.dll" (ByVal funcptr As Long)
'
Sub CallbackFunction(ByRef numb As Long)
    MsgBox "Success: " + Str(numb)
End Sub


In form:
Private sub Command1_Click()
TestCallback AddressOf CallbackFunction
end sub


Now compile the project and run. Should return 123.

gdlk, hope this was clear. now off to multi-threading. thanks

best regards


-- modified at 23:42 Friday 7th April, 2006

Update: multi-threading complete. I did what you said and it works great, can start and stop it at will now, easier than I thought it would be. thanks a lot.

this is solved, regards
QuestionAlternative Shell for Windows Pin
Richard Andrew x647-Apr-06 5:15
professionalRichard Andrew x647-Apr-06 5:15 
AnswerRe: Alternative Shell for Windows Pin
James Brown7-Apr-06 6:31
James Brown7-Apr-06 6:31 
QuestionSetting a timer Pin
LCI7-Apr-06 4:54
LCI7-Apr-06 4:54 
AnswerRe: Setting a timer Pin
jhwurmbach7-Apr-06 5:20
jhwurmbach7-Apr-06 5:20 
QuestionRe: Setting a timer Pin
David Crow7-Apr-06 5:24
David Crow7-Apr-06 5:24 
AnswerRe: Setting a timer Pin
LCI7-Apr-06 5:45
LCI7-Apr-06 5:45 
Questionchain code Pin
izzah_mustapha7-Apr-06 4:28
izzah_mustapha7-Apr-06 4:28 
AnswerRe: chain code Pin
toxcct7-Apr-06 4:41
toxcct7-Apr-06 4:41 
AnswerRe: chain code Pin
Chris Losinger7-Apr-06 4:44
professionalChris Losinger7-Apr-06 4:44 
Questionconverting XML to string Pin
nahitan7-Apr-06 3:59
nahitan7-Apr-06 3:59 
QuestionMultiple OpenGL Problem..MFC 8.0 SDI Pin
BrownJacket7-Apr-06 3:55
BrownJacket7-Apr-06 3:55 
QuestionHow to make an MDI child wnd like Model dlg? Pin
Sarvan AL7-Apr-06 3:43
Sarvan AL7-Apr-06 3:43 
AnswerRe: How to make an MDI child wnd like Model dlg? Pin
jhwurmbach7-Apr-06 4:00
jhwurmbach7-Apr-06 4:00 
QuestionRename Variables Add-in Pin
fxam7-Apr-06 3:38
fxam7-Apr-06 3:38 
AnswerRe: Rename Variables Add-in Pin
toxcct7-Apr-06 3:43
toxcct7-Apr-06 3:43 
AnswerYes, at least one I know of Pin
jhwurmbach7-Apr-06 3:57
jhwurmbach7-Apr-06 3:57 
QuestionFinding my way in NYC Pin
alex__b7-Apr-06 3:19
professionalalex__b7-Apr-06 3:19 

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.