473,402 Members | 2,072 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,402 software developers and data experts.

Overrides for WndProc... using the overriden component class on a form...

Hello,
I'm very new to this level of programming and .net in general. My
background is VB.
I am attempting to use the WebBrowser control to load a flash movie,
and it is a known issue that the WebBrowser control doesn't natively
support mouse clicks (unless the form loses and regains focus).
A workaround has been presented over at CodeProject and it is as
follows:
Imports System
Imports System.Collections.Generic
Imports System.Text

Public Class myWebBrowser
Inherits System.Windows.Forms.WebBrowser

Protected Overrides Sub WndProc(ByRef m As
System.Windows.Forms.Message)
Select Case m.Msg
Case &H201, &H204, &H207, &H21 ' WM_LMOUSEBUTTON
MyBase.DefWndProc(m)
Return
End Select
MyBase.WndProc(m)
End Sub 'WndProc
End Class 'myWebBrowse

My question is, how and where do I implement this? Do I make a new
class and put this there? How do I use the "myWebBrowser" class to
create the component that appears on the form?
If you can point me in the right direction, it'd be appreciated. I've
found plenty of documentation on overriding, and controls, but none on
creating and using a component control.
Thanks very much,

Matt

Feb 3 '07 #1
2 2249
I would add a new class file to your project and add it there. Then,
do a Project =Rebuild and open up the form you wish to use the
control on. At the top of the toolbox there is a group (the name
escapes me) that contains all of your project's custom controls.
Alternatively, you can drag the class's name from the solution
explorer onto the form to add the control that way. A third option is
to add the control dynamically (usually for parameterized
constructors) but you probably don't need to do that here.

If I can help out more let me know!

Thanks,

Seth Rowe
On Feb 3, 12:21 pm, "Matt Brown - identify" <MatthewBr...@gmail.com>
wrote:
Hello,

I'm very new to this level of programming and .net in general. My
background is VB.

I am attempting to use the WebBrowser control to load a flash movie,
and it is a known issue that the WebBrowser control doesn't natively
support mouse clicks (unless the form loses and regains focus).

A workaround has been presented over at CodeProject and it is as
follows:

Imports System
Imports System.Collections.Generic
Imports System.Text

Public Class myWebBrowser
Inherits System.Windows.Forms.WebBrowser

Protected Overrides Sub WndProc(ByRef m As
System.Windows.Forms.Message)
Select Case m.Msg
Case &H201, &H204, &H207, &H21 ' WM_LMOUSEBUTTON
MyBase.DefWndProc(m)
Return
End Select
MyBase.WndProc(m)
End Sub 'WndProc
End Class 'myWebBrowse

My question is, how and where do I implement this? Do I make a new
class and put this there? How do I use the "myWebBrowser" class to
create the component that appears on the form?

If you can point me in the right direction, it'd be appreciated. I've
found plenty of documentation on overriding, and controls, but none on
creating and using a component control.

Thanks very much,

Matt

Feb 4 '07 #2
On Feb 3, 9:08 pm, "rowe_newsgroups" <rowe_em...@yahoo.comwrote:
I would add a newclassfile to your project and add it there. Then,
do a Project =Rebuild and open up theformyou wish to use the
control on. At the top of the toolbox there is a group (the name
escapes me) that contains all of your project's custom controls.
Alternatively, you can drag theclass'sname from the solution
explorer onto theformto add the control that way. A third option is
to add the control dynamically (usually for parameterized
constructors) but you probably don't need to do that here.

If I can help out more let me know!

Thanks,

Seth Rowe

Exactly what I was looking for! Thanks very much!
-Matt

Feb 4 '07 #3

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

Similar topics

4
by: Christopher W. Douglas | last post by:
I am developing a VB.NET app using Visual Studio.NET 2003. VB.NET allows me to create a class with two or more methods that have the same name, as long as they have different (non-optional)...
0
by: sshuangw | last post by:
Hello: I am encountering a very weird issue with MDI child, Overriden WndProc function and hidden form. Basically, the application has two forms, Form1(parent form), Form2(Child form),...
2
by: Ed Sutton | last post by:
How can a WndProc be created inside a component? Currently I have a WndProc in my frmMain. It looks for WM_DEVICECHANGE messages for connection and removal events for a USB/Serial device. My...
0
by: cyrille | last post by:
Hello from example from web i did a little code to avoiding columnHeader resize. this code seems to work well, but when I put a 'normal' ListView on the same Form than my overrided ListView it...
2
by: Edward Diener | last post by:
In C++ an overridden virtual function in a derived class must have the exact same signature of the function which is overridden in the base class, except for the return type which may return a...
0
by: dxben | last post by:
I am using VC8 and I have a System.Windows.Forms.Form derived class that I want to override the message proc for in order to perform custom message handling. However when I set a breakpoint on...
3
by: S Wheeler | last post by:
Hi - I have a vc++ WinForms app. Can I override the WndProc so I can send custom messages to my app. Is there any way to do this? I need to notify the main form of events from a library. How is...
12
by: André | last post by:
Hi, i'm learning working with classes. In class "classbase1", i defined an overridable function. In the class "subclass1", i defined the same function with 'Overrides'. In class "classbase2", i...
4
by: Piotrekk | last post by:
Hi I have overriden WndProc to detect when the key is pressed. Because it didnt work i inserted debug code to detect what messages pass through the WndProc exactly.My application is minimized in...
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
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:
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...

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.