473,382 Members | 1,238 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

How do I get data from a callback into my form?

My program analyzes MIDI information.
I have a VB6 callback function, which the system calls when MIDI messages arrive. It works in the development environment, but when I make a .exe, it crashes when I try to modify the form. I presume this is illegal, and I somehow need to get the information from the callback function back to a form procedure. What is the best way to do this?

Details:

At form_load time, I open a MIDI input stream like this:
Expand|Select|Wrap|Line Numbers
  1. ret = midiInOpen(midiInHnd, midiInDev, AddressOf MidiInProc, 0, CALLBACK_FUNCTION)
MidiInProc gets called when MIDI messages arrive. When I try to do something like this:

Expand|Select|Wrap|Line Numbers
  1. MidiMon.lblMsgCounts(stat) = Str(MessageCounts(stat))
  2.  
the program crashes when it is compiled to a .exe.
Expand|Select|Wrap|Line Numbers
  1. Unhandled exception in MidiM.exe (OLEAUT32.DLL): 0C0000005: Access Violation
So I presume that I need to push dwParam1 and dwParam2 into some kind of FIFO, and retrieve the information in a form procedure. I started looking at PostMessage and GetMessage, but I'm worried that this may be a dead end, and haven't tried it. It seems there must be a simpler method.
Expand|Select|Wrap|Line Numbers
  1. PostMessage(NULL, WM_USER, dwParam1, dwParam2)
  2. GetMessage(msg, NULL, WM_USER, WM_USER)
Jan 21 '07 #1
1 2421
I think you may be right about it being a dead end. The thing that I find most interesting is that it is not crashing in your module. It is crashing in OLEAUT32.DLL under Access Violation. This probably means one of the functions you have called is attempting to read from an invalid memory address.
Jan 22 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: ma740988 | last post by:
// file sltest.h #ifndef SLTEST_H #define SLTEST_H class CallbackBase // herb shutters gotW source .. { public: virtual void operator()() const { }; virtual ~CallbackBase() = 0; };
1
by: Jim P. | last post by:
I've got a Async callback delegate that processes incoming socket data. It works fine, but the class that does the work is outside the scope of my form. How can I take the completed data (string)...
1
by: Dennis Burns | last post by:
I've posted this question before, and since then I've tried a variety of work-arounds, with no success. So, here goes again... I'd like to create forms and open them from within a callback...
0
by: Roy | last post by:
The following code - straight out of the MSDN help - uses ASP.NET 2.0's Client Callback features, and yet, ALWAYS postback to the page. Why? I expected no postbacks to occur. <%@ Page...
7
by: Roemer | last post by:
Hi all I stumbled over a new problem: I have a programm with just a class that is asynchronous listening for network connections. As soon as someone connected, a new form needs to be created....
6
by: jeet_sen | last post by:
Hi, I have a file containing variables defined in javascript syntax, like, var a = 15; var list = ; .. .. I want to load this external file dynamically and read in the data. I can successfuly...
0
by: abhi81 | last post by:
Hello All, I implemented a callback on page. So basically this is what is happening during the page load i populate 2 dropdowns 1 for country and one for state based on the default values for...
10
by: SQACPP | last post by:
Hi, I try to figure out how to use Callback procedure in a C++ form project The following code *work* perfectly on a console project #include "Windows.h" BOOL CALLBACK...
3
by: waldek | last post by:
Hi, I'm trying to handle data passed to Py Callback which is called from C dll. Callback passes data to another thread using Queue module and there the data are printed out. If data is...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.