473,396 Members | 1,734 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,396 software developers and data experts.

override WndProc in a C# form

Hi, I am trying to intercept the message sent back by winmm.dll's
mciSendString method when playback is finished. I tried to override the
WndProc in the form but I didn't get/intercept the message, here is the
code fragment:

public const int MM_MCINOTIFY = 953;
public const int MM_NOTIFY_ABORTED = 4;
public const int MCI_NOTIFY_FAILURE = 8;
public const int MCI_NOTIFY_SUCCESSFUL = 1;
public const int MCI_NOTIFY_SUPERSEDED = 2;
public const int GWL_WNDPROC = -4;

protected override void WndProc(ref Message m)
{
if ( m.Msg == MCITest.MM_MCINOTIFY )
{
string stuff = "xxx";
switch ( m.WParam.ToInt32() )
{
case MCITest.MCI_NOTIFY_SUCCESSFUL:
this.mediaStatus = (int) MCITest.playStatus.FINISHED;
stuff = "Finished Successfully!";
break;
case MCITest.MCI_NOTIFY_FAILURE:
this.mediaStatus = (int) MCITest.playStatus.FAILURE;
stuff = "Finished Failure!";
break;
case MCITest.MM_NOTIFY_ABORTED:
this.mediaStatus = (int) MCITest.playStatus.ABORTED;
stuff = "Finished Aborted!";
break;
case MCITest.MCI_NOTIFY_SUPERSEDED:
this.mediaStatus = (int) MCITest.playStatus.SUSPENDED;
stuff = "Finished Suspended!";
break;
default:
stuff = "Default!";
break;
}
System.Diagnostics.Debug.WriteLine ("Stuff -> " + stuff);
base.WndProc (ref m);
}
System.Diagnostics.Debug.WriteLine ("Msg -> " + m.Msg);
base.WndProc (ref m);
}

Any help is greatly appreciated ...

Nov 17 '05 #1
0 4088

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: cs | last post by:
I have been playing around with overriding the wndproc method on a winform. Now I am wondering, can you override the winproc method on any window even if they arent a .net widnow? I see some...
1
by: Tom | last post by:
Hi friends. How do I override minimise event ? so that it does not minimise and simply hide my form ? the reason is I have the problem with the form after its been minimised calling activate...
3
by: Richard | last post by:
I have a requirement to put a GDI style circle or rectangle border around the selected row of a datagrid/ It will overlap into the row above and below the selected row. Doing this in a the OnPaint...
1
by: James Ramaley | last post by:
I am trying to modify the way a NumericUpDown control draws itself. I just need to hide the up/down arrows. I tried overriding both the OnPaint method and the wm_paint message inside WndProc....
2
by: Lenster | last post by:
When using PostMessage to post myself a message, the msg and wparam parameters somehow get swapped over. They are in the correct order when calling PostMessage but by the time wndproc handles the...
4
by: mike2036 | last post by:
I'm having problems with the reliability of WndProc in my application. The application has a hidden form, which it instantiates in the Main() and then calls Application.Run(). There are cases...
4
by: Rob | last post by:
I've constructed a user control inherited from ListView so I can handle and respond to scrolling events (to keep 2 listviews scrolling in sync). My user control includes an Overrides of WndProc...
1
by: --== Alain ==-- | last post by:
Hi, i was thinkging to override WNDPROC of my ListView control, in order to control how the headers and items will be redrawn. My purpose is to : - keep the header format (horizontal and...
0
by: JDeats | last post by:
I need to be able to detect when the user clicks on the browser control area. The control offers no Mouse events whatsoever. I have tried to resort to override WndProc on the control, I have a...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.