|
Thanks, good to know
|
|
|
|
|
I've done some more investigation into this and have found others that have had this problem with different hardware.
The problem seems to be that some drivers block on the Reset call until all the MIDIHDR s are returned. This means that UnprepareHeader cannot be called on any buffer (during a reset only) until they have all been returned to windows, so can't be done in the callback!
I have managed to code around this by setting an IsResetting flag when Reset is called, having an IsReturned flag on each buffer that is set it is returned and when the last buffer is returned - launch a thread (so the callback returns!) that unprepares and frees the buffers. A bit of a pain but it appears to work and should do on all systems
|
|
|
|
|
That's good to know Dave!
I've been playing more with the Pure MIDI code, and determined his exit code also failed on closing the MIDI output. It's not closing the buffers either. Between your code and the Pure MIDI code, I've gotten the Short MIDI in figured out, and the outgoing Long & Short msgs figured out.
I thank you for all your efforts once again!
|
|
|
|
|
Got another query here...
When a SYSEX is sent out over MIDI, Should it not trigger a MIM_LONGDATA message in my app regardless of if I have code to do something with that message or not?
Or, Is there something I need to do to setup my callback to see these messages?
|
|
|
|
|
MIM_LONGDATA will be sent to your callback only if (some of these are obvious so I'm sure you can ignore them but I'll include them for completeness!):
- The MIDI Input is open (midiInOpen)
- The MIDI Input is started (midiInStart)
- There is at least one buffer available
- The buffer is prepared (midiInPrepareHeader)
- The buffer has been added (midiInAddBuffer)
- The buffer has been (re)initialized correctly (dwFlags cleared etc if reusing the buffer)
What caught me out the first time I ever tried it was that I hadn't done 4 and 5. I expected a buffer to just be given to me that the system created for the SysEx. Unfortunately, it will only fill buffers we create and add.
|
|
|
|
|
Interesting!
I assumed that because the port was open, that the message would be toggled regardless in the callback, and if it wasn't handled, it would then be ignored. That would explain why I don't see that occurring at all then. I need to create a buffer, prepare it, add it, and be sure I have the right flags then before it is even visible in the message cue.
Thanks again Dave!
|
|
|
|
|
Correct, and no problem.
dwBufferLength needs to be set to the size (in bytes) of the buffer.
lpData needs to be a valid memory location that unmanaged code can write to. I use Marshal.AllocHGlobal using the same value as dwBufferLength . Make sure you free this once it's returned with Marshal.FreeHGlobal .
dwBytesRecorded will tell you how many bytes have been received.
If the buffer isn't big enough, or more SysEx is received it will use the next buffer so you need to ensure you have at least two available.
You only need to clear the flags if you are reusing the buffer once you are done with a used one. Reusing can give better performance as there is no need to be constantly allocating and freeing memory. I just add new new ones and discard the old personally.
|
|
|
|
|
In a C# 2008 console application, I am getting the following error:
"Error 4 The type or namespace name 'eDataContext' could not be found (are you missing a using directive or an assembly reference?)".
I am getting this error on the following line of code:
eDataContext rptData = new eDataContext();
I have created the *.dbml file, I have dragged a table onto the designer surface, I have added the *.dbml file to the project folder that will be using the *.dbml file, and I have built the application.
The name 'eDataContext', in the name of the datacontext object that is located in the eD.designer.cs file.
The only thing that i can think to try is to add something in an app.config file, but I do not know what to add.
Thus can you tell me and/or point me to a reference on what i can do to solve this problem?
|
|
|
|
|
You must have missed importing the namespace. Find out what namespace eDataContext belongs to and import it in your code. For example, if eDataContext belongs to dcof.Entities namespace, you must write this line of code in the .cs file where you use the eDataContext class.
using dcof.Entities;
|
|
|
|
|
I have a piece of software that compiles and installs properly. It uses loosely coupled events to pass information to another application. All of the code works except for the other application actually receiving the event and processing it. It works on Windows XP perfectly but not on Windows 7.
Thanks
|
|
|
|
|
Without seeing any code, we can only offer guesses at best. It could be security related.
|
|
|
|
|
Due to company policy I can't post the code. If it were security related what would your best guess be. I have turned off UAC and ajusted permissions on many registry entries just to get it installed.
Thanks,
|
|
|
|
|
Well, for a start, I'd be using remote debugging on a debug version of the app installed on that machine and I'd check to see whether exceptions were being consumed. Also, is your LCE a COM event? If so, that can sometimes be a problem and you may have to adjust DCOM settings.
|
|
|
|
|
It is indeed a com event. I will have a look at DCOM settings. Thank you. If you have any specific suggestions let me know. Also if you can point me to a good remote debugging tutorial I would appreciate it. I am actually an Electrical Engineer with a a computer science degree and this is one of my first major coding projects and have never worked with com/com+/dcom before.
Thanks,
|
|
|
|
|
Good luck - this is pretty arcane stuff I'm afraid. Anyway, you should start here[^] for remote debugging.
|
|
|
|
|
I am beginning to realise this, have had so many issues over that last couple weeks just getting the majority of it working, now this last piece is taking forever.
Thanks for the help.
|
|
|
|
|
If it works on XP, but not on Windows 7, its most likely a security issue. Not necessarily a DCOM security issue, but one app being run under a different security context then the other. For example, one is running as a service and the other is a desktop app, or something like that.
|
|
|
|
|
One is running as a service and the other as a desktop type application, do you have suggestions on how to work around this?
Thanks,
|
|
|
|
|
Ha! Called it!
If you go into the service control panel, right click on your service & view the properties (Log On) tab... is it running as Local System? If so, you might need to turn on the interact w/ desktop checkbox. If that doesn't work, try run it as yourself (for testing).
|
|
|
|
|
That does not seem to have worked either. Both changing user and the desktop check box failed to succeed for me. It is a fairly complex program I am stuck with that uses MSMQ to talk across computers and then uses loosely coupled events to send the messages to another program which fires them out a serial port. Still hoping you have come more ideas.
Thanks,
|
|
|
|
|
Did you try tweak the security settings with dcomcnfg? Do you get any COM errors on the side that is sending the events?
|
|
|
|
|
I have been adjusting a few things in DCOMCnfg but with no success, I will check it all again in the morning, I have left the office for the day.
Thanks for all your help
|
|
|
|
|
Here are some errors I found in Event Viewer.
1.
General Tab
The COM+ Queued Components Player was unable to create an instance of a Queued Component. CPlayer BindToObject
Server Application ID: {2C3D0543-17EC-4FBA-92B9-AEAE22AF3BFB}
Server Application Instance ID:
{354D390F-B182-4CFC-8CD9-A66F09428921}
Server Application Name: StationQueue1
Error Code = 0x80004005 : Unspecified error
COM+ Services Internals Information:
File: d:\w7rtm\com\complus\src\comsvcs\qc\player\player.cpp, Line: 467
Comsvcs.dll file version: ENU 2001.12.8530.16385 shp
Log Name: Application
Source: Complus
Event ID: 4772
Level: Error
User: N/A
OpCode: Info
Logged: 9/6/2012 11:29:19 AM
Task Category: QC Player
Keywords: Classic
Computer: My Computer
Details Tab
+ System
- Provider
[ Name] Microsoft-Windows-Complus
[ Guid] {0f177893-4a9c-4709-b921-f432d67f43d5}
[ EventSourceName] COM+
- EventID 4772
[ Qualifiers] 49154
Version 0
Level 2
Task 26
Opcode 0
Keywords 0x80000000000000
- TimeCreated
[ SystemTime] 2012-09-06T16:29:19.000000000Z
EventRecordID 2228
Correlation
- Execution
[ ProcessID] 0
[ ThreadID] 0
Channel Application
Computer WIN-BMLLA06V4GM
Security
- EventData
param1 CPlayer BindToObject Server Application ID: {2C3D0543-17EC-4FBA-92B9-AEAE22AF3BFB} Server Application Instance ID: {354D390F-B182-4CFC-8CD9-A66F09428921} Server Application Name: StationQueue1 Error Code = 0x80004005 : Unspecified error COM+ Services Internals Information: File: d:\w7rtm\com\complus\src\comsvcs\qc\player\player.cpp, Line: 467 Comsvcs.dll file version: ENU 2001.12.8530.16385 shp
2.
General Tab
DCOM got error "1068" attempting to start the service netman with arguments "" in order to run the server:
{BA126AD1-2166-11D1-B1D0-00805FC1270E}
Log Name: System
Source: Distributed COM
Event ID: 10005
Level: Error
User: N/A
OpCode: Info
Logged 9/6/2012 11:29:35 AM
Task Category: None
Keywords: Classic
Computer: My Computer
Details Tab
+ System
- Provider
[ Name] Microsoft-Windows-DistributedCOM
[ Guid] {1B562E86-B7AA-4131-BADC-B6F3A001407E}
[ EventSourceName] DCOM
- EventID 10005
[ Qualifiers] 49152
Version 0
Level 2
Task 0
Opcode 0
Keywords 0x80000000000000
- TimeCreated
[ SystemTime] 2012-09-06T16:29:35.000000000Z
EventRecordID 5098
Correlation
- Execution
[ ProcessID] 0
[ ThreadID] 0
Channel System
Computer WIN-BMLLA06V4GM
Security
- EventData
param1 1068
param2 netman
param3
param4 {BA126AD1-2166-11D1-B1D0-00805FC1270E}
3.
General
DCOM got error "1068" attempting to start the service netprofm with arguments "" in order to run the server:
{A47979D2-C419-11D9-A5B4-001185AD2B89}
Log Name: System
Source: Distributed COM
Event ID: 10005
Level: Error
User: N/A
OpCode: Info
Logged 9/6/2012 11:29:31 AM
Task Category: None
Keywords: Classic
Computer: My Computer
|
|
|
|
|
I am trying to have a new C# 2010 console application execute an existing C# 2008 console application using the following code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Diagnostics;
using System.ComponentModel;
namespace ClientScripts
{
class RunRPT
{
static void Main(string[] args)
{
Process e_Process = new Process();
try
{
e_Process.StartInfo.UseShellExecute = false;
e_Process.StartInfo.FileName = "C:\\eclient\\bin\\Debug\\Eclient.exe encriptvalue";
eRPT_Process.StartInfo.Arguments = "http://test1 1 SUB";
eRPT_Process.Start();
}
catch (Exception e)
{
Console.WriteLine(e.Message);
}
}
}
}
I am getting the following error message: {System.ComponentModel.Win32Exception (0x80004005): The system cannot find the file specified at System.Diagnostics.Process.StartWithCreateProcess(ProcessStartInfo startInfo) at system.Diagnostics.Process.Start().
The console app that I am trying to call does run from a dos prompt command if you are in the correct directory running the following command:
Start .\eclient\bin\Debug\Eclient.exe encriptvalue http:
Thus can you tell me what parameters I would need to change in the process class for this execute to work? If you have any other ideas I can use to make this work, can you tell me what they would be?
|
|
|
|
|
You have one of your parameters at the end of the StartInfo.FileName . That should be in the Arguments .
|
|
|
|