Results 1 to 9 of 9

Thread: Callback from C dll to VB6

Hybrid View

  1. #1
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Callback from C dll to VB6

    Here's another idea if you're using Forms: Subclass your form and send it a message you've defined yourself each time the callback procedure is called. That way you can use the wParam or lParam arguments to pass on the data without storing them in global variables first.

  2. #2

    Thread Starter
    Old Member moeur's Avatar
    Join Date
    Nov 2004
    Location
    Wait'n for Free Stuff
    Posts
    2,712

    Re: Callback from C dll to VB6

    Yes, there are many work arounds that I could implement, but shouldn't I be able to build my callback so that it acts like callbacks from APIs? I would just like to know how they do it.
    For example I've been able to call up MsgBoxes and such in a TimerProc callback after a SetTimer call
    This is exactly my point. If I don't have problems with callbacks MS devises why is mine not working?
    in your callback procedure in VB you simply create a timer with a low interval, just enough for your callback to finish executing and then do the job in the callback procedure for the timer.
    I doubt that this would work since if the problem is as I expect that the thread has not been properly initialized, then a callback to an unintialized thread isn't going to work either. I may try it just to confirm my suspicions however. Thanks

  3. #3
    I'm about to be a PowerPoster! Joacim Andersson's Avatar
    Join Date
    Jan 1999
    Location
    Sweden
    Posts
    14,649

    Re: Callback from C dll to VB6

    Quote Originally Posted by moeur
    in your callback procedure in VB you simply create a timer with a low interval, just enough for your callback to finish executing and then do the job in the callback procedure for the timer
    I doubt that this would work since if the problem is as I expect that the thread has not been properly initialized, then a callback to an unintialized thread isn't going to work either. I may try it just to confirm my suspicions however. Thanks
    Maybe you're right! However the subclassing and sending a message to your form approach should work, since it's then sent to the regular thread in the VB process.

  4. #4
    Addicted Member
    Join Date
    Apr 2003
    Posts
    148

    Re: Callback from C dll to VB6

    Code:
      lProcAdr = (long)(&DoTheWork);
    what do if i change DoTheWork to :
    Code:
    LRESULT CALLBACK GetMsgProc(int nCode, WPARAM wParam, LPARAM lParam)
    I got Error when i do this
    Code:
      lProcAdr = (long)(GetMsgProc);

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width