Customizing Windows with C#

T

Tamir Khason

Is it possible? or just my fantasy?
I did it before with cpp. Handle and change base classes such as dialogs,
windows etc.
Is it possible to do with C#? Someone knows good reference to such kind of
programming?

TNX
 
N

Nicholas Paldino [.NET/C# MVP]

Tamir,

Yes, it is. The Handle property on the Form class (or Control class)
gives you access to the Windows handle, which you can pass to any API method
you wish that accepts it.

However, I would make sure that there isn't something in the framework
that doesn't already provide the functionality you need. Check out the
article on MSDN titled "Microsoft Win32 to Microsoft .NET Framework API
Map", located at (watch for line wrap):

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/win32map.asp

It will show you the functionality that .NET provides as it relates to
Win32 API functions.

Hope this helps.
 
T

Tamir Khason

Thank you for response, but the question is "How to change ALL e.g dialog
boxes in current Windows installation, not just in my project". This means
that I have to handle each Dialog base class invoked by OS. Is it possible?

--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "

Nicholas Paldino said:
Tamir,

Yes, it is. The Handle property on the Form class (or Control class)
gives you access to the Windows handle, which you can pass to any API
method you wish that accepts it.

However, I would make sure that there isn't something in the framework
that doesn't already provide the functionality you need. Check out the
article on MSDN titled "Microsoft Win32 to Microsoft .NET Framework API
Map", located at (watch for line wrap):

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/win32map.asp

It will show you the functionality that .NET provides as it relates to
Win32 API functions.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Tamir Khason said:
Is it possible? or just my fantasy?
I did it before with cpp. Handle and change base classes such as dialogs,
windows etc.
Is it possible to do with C#? Someone knows good reference to such kind
of programming?

TNX
 
N

Nicholas Paldino [.NET/C# MVP]

Tamir,

Yes, I would think it is. You would have to do some heavy API work
though.

Generally speaking, you might just want to set up a system wide hook,
and handle the WM_CREATE message. Then, you would change the properties of
the window as it is created.

Of course, this will cause a perf hit (system wide hooks usually do),
and there are some caveats with creating a system wide hook.

Check out codeproject.com and look for System Hook. There should be an
article there on how to do it in .NET (I was looking at it yesterday, so I
am pretty sure it is there).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Tamir Khason said:
Thank you for response, but the question is "How to change ALL e.g dialog
boxes in current Windows installation, not just in my project". This means
that I have to handle each Dialog base class invoked by OS. Is it
possible?

--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "

Nicholas Paldino said:
Tamir,

Yes, it is. The Handle property on the Form class (or Control class)
gives you access to the Windows handle, which you can pass to any API
method you wish that accepts it.

However, I would make sure that there isn't something in the framework
that doesn't already provide the functionality you need. Check out the
article on MSDN titled "Microsoft Win32 to Microsoft .NET Framework API
Map", located at (watch for line wrap):

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/win32map.asp

It will show you the functionality that .NET provides as it relates to
Win32 API functions.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Tamir Khason said:
Is it possible? or just my fantasy?
I did it before with cpp. Handle and change base classes such as
dialogs, windows etc.
Is it possible to do with C#? Someone knows good reference to such kind
of programming?

TNX
 
S

Stoitcho Goutsev \(100\) [C# MVP]

Hi,

IMHO even in cpp and native programing this is done via hooks there is no
other way around

Take a look at this MSDN Magazine article it can be a good start.

Anyways, I doubt it can be done from pure managed code. Global windows
hooks except 2 of them can not be writen in managed code. The hooks that
might help you in this are not among supported ones. What you can do is to
customize only dialog boxes open from your process.
Otherwise the solution that will work is to write the hook in native code
and put the code in DLL then using PInvoke you can use it.


--
HTH
Stoitcho Goutsev (100) [C# MVP]
Nicholas Paldino said:
Tamir,

Yes, I would think it is. You would have to do some heavy API work
though.

Generally speaking, you might just want to set up a system wide hook,
and handle the WM_CREATE message. Then, you would change the properties
of the window as it is created.

Of course, this will cause a perf hit (system wide hooks usually do),
and there are some caveats with creating a system wide hook.

Check out codeproject.com and look for System Hook. There should be an
article there on how to do it in .NET (I was looking at it yesterday, so I
am pretty sure it is there).


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Tamir Khason said:
Thank you for response, but the question is "How to change ALL e.g dialog
boxes in current Windows installation, not just in my project". This
means that I have to handle each Dialog base class invoked by OS. Is it
possible?

--
Tamir Khason
You want dot.NET? Just ask:
"Please, www.dotnet.us "

Nicholas Paldino said:
Tamir,

Yes, it is. The Handle property on the Form class (or Control class)
gives you access to the Windows handle, which you can pass to any API
method you wish that accepts it.

However, I would make sure that there isn't something in the
framework that doesn't already provide the functionality you need.
Check out the article on MSDN titled "Microsoft Win32 to Microsoft .NET
Framework API Map", located at (watch for line wrap):

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dndotnet/html/win32map.asp

It will show you the functionality that .NET provides as it relates
to Win32 API functions.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Is it possible? or just my fantasy?
I did it before with cpp. Handle and change base classes such as
dialogs, windows etc.
Is it possible to do with C#? Someone knows good reference to such kind
of programming?

TNX
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top