Home Upgrade Search Memberlist Extras Hacker Tools Award Goals Help Wiki Contact

.NET 

Window Manager

Why are there drawing methods? What are they used for?

Also "Public Shared Function GetStringState(ByVal hwnd As IntPtr) As String", why are you returning the state as a string, and not a enum?

Most of this code looks C/Ped of Google anyway.
(Jul 28, 2014 01:38 PM)SIM-1456245 Wrote:  If you look closer, there are two methods, one returns it as Enum one as String. The string one is included there, just because probably everyone will use it as string and would most likely code that. The drawing methods are just there as proof of concept. And believe it or not, the pinvoke functions are copied from pinvoke.net, just how they are supposed to be. Everything other is coded by me. All of your questions are answered in the OP, read before you ask.

You know you can use <enum>.ToString(), right?
LOL, what is this?

Code
Public Shared Function ClearGaphics(ByVal hwnd As IntPtr) As Boolean
      Try
      Using g As Graphics = Graphics.FromHwnd(hwnd)
            g.Clear(Color.LightGray)
      End Using
      Return True
      Catch ex As Exception
      Return False
      End Try
    End Function

What the hell do you expect to catch here?

Anyway, moving on, why the hell do you put every WinAPI call in Try Catch blocks? Do you think it throws an exception within your code?

And this:

Code
Public Shared Function IsForeground(ByVal hwnd As IntPtr) As Boolean
      Try
      Return hwnd = GetForegroundWindow()
      Catch ex As Exception
      Return False
      End Try
    End Function

How can this ever throw an exception?
So, you're just wrapping everything inside of it like you "left" it here?
That's good practice.


Possibly Related Threads...
Thread / Author Replies Views Last Post
[Shell] by annikk.exeMar 18, 2014 06:05 AM 4 738 Mar 18, 2014 06:05 AM
Last Post: annikk.exe
[.NET] by BlackCapOct 30, 2013 03:20 AM 42 1,364 Oct 30, 2013 03:20 AM
Last Post: OneTXxL
[.NET] by MicroPastSep 17, 2013 07:27 AM 4 531 Sep 17, 2013 07:27 AM
Last Post: Normal69