473,399 Members | 3,302 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,399 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 4090

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: 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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
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.