Results 1 to 9 of 9

Thread: Api questions

  1. #1

    Thread Starter
    Hyperactive Member phrozeman's Avatar
    Join Date
    Apr 2000
    Location
    Netherlands
    Posts
    442

    Api questions

    Does anyone know how to convert this VB6 api to VB.Net?
    I always used it in vb6 to give my textboxes an flatter style.

    VB Code:
    1. Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long) As Long
    2. Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hWnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    3. Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Long, ByVal hWndInsertAfter As Long, ByVal x As Long, ByVal y As Long, ByVal CX As Long, ByVal CY As Long, ByVal wFlags As Long) As Long
    4. Const GWL_EXSTYLE = (-20)
    5. Const WS_EX_CLIENTEDGE = &H200
    6. Const WS_EX_STATICEDGE = &H20000
    7. Const SWP_FRAMECHANGED = &H20
    8. Const SWP_NOMOVE = &H2
    9. Const SWP_NOOWNERZORDER = &H200
    10. Const SWP_NOSIZE = &H1
    11. Const SWP_NOZORDER = &H4
    12.  
    13. Sub MakeFlat(lHwnd As Long)
    14.     Dim lRet As Long
    15.     lRet = GetWindowLong(lHwnd, GWL_EXSTYLE)
    16.     lRet = WS_EX_STATICEDGE
    17.     SetWindowLong lHwnd, GWL_EXSTYLE, lRet
    18.     SetWindowPos lHwnd, 0, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOOWNERZORDER Or SWP_NOZORDER Or SWP_FRAMECHANGED
    19. End Sub
    There's a certain mystique when I speak, that you notice that it's sorta unique, cause you know it's me

  2. #2
    Banished Cander's Avatar
    Join Date
    Dec 2000
    Location
    Why do you care?
    Posts
    6,913
    textbox1.BorderStyle =BorderStyle.None
    Stack Overflow
    See the features of Visual Studio 2010 and C# 4.0: The 10-4 show on Channel9

  3. #3
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    try this now
    VB Code:
    1. Declare Function GetWindowLong Lib "user32"  Alias "GetWindowLongA"(ByVal hWnd As Integer, ByVal nIndex As Integer) As Integer
    2.     Declare Function SetWindowLong Lib "user32"  Alias "SetWindowLongA"(ByVal hWnd As Integer, ByVal nIndex As Integer, ByVal dwNewLong As Integer) As Integer
    3.     Declare Function SetWindowPos Lib "user32" (ByVal hWnd As Integer, ByVal hWndInsertAfter As Integer, ByVal x As Integer, ByVal y As Integer, ByVal CX As Integer, ByVal CY As Integer, ByVal wFlags As Integer) As Integer
    4.     Const GWL_EXSTYLE As Short = (-20)
    5.     Const WS_EX_CLIENTEDGE As Short = &H200s
    6.     Const WS_EX_STATICEDGE As Integer = &H20000
    7.     Const SWP_FRAMECHANGED As Short = &H20s
    8.     Const SWP_NOMOVE As Short = &H2s
    9.     Const SWP_NOOWNERZORDER As Short = &H200s
    10.     Const SWP_NOSIZE As Short = &H1s
    11.     Const SWP_NOZORDER As Short = &H4s
    12.    
    13.     Sub MakeFlat(ByRef lHwnd As Integer)
    14.         Dim lRet As Integer
    15.         lRet = GetWindowLong(lHwnd, GWL_EXSTYLE)
    16.         lRet = WS_EX_STATICEDGE
    17.         SetWindowLong(lHwnd, GWL_EXSTYLE, lRet)
    18.         SetWindowPos(lHwnd, 0, 0, 0, 0, 0, SWP_NOMOVE Or SWP_NOSIZE Or SWP_NOOWNERZORDER Or SWP_NOZORDER Or SWP_FRAMECHANGED)
    19.     End Sub

  4. #4

    Thread Starter
    Hyperactive Member phrozeman's Avatar
    Join Date
    Apr 2000
    Location
    Netherlands
    Posts
    442
    Originally posted by Cander
    textbox1.BorderStyle =BorderStyle.None
    Thats not what i ment

    Pirate, in vb6 i used Makeflat Text1.hWnd, but in .net the textbox doesn't have a .hWnd function.

    How should i do that?
    There's a certain mystique when I speak, that you notice that it's sorta unique, cause you know it's me

  5. #5
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    Did you try the code ?It's the converted version .I guess it will work !

  6. #6

    Thread Starter
    Hyperactive Member phrozeman's Avatar
    Join Date
    Apr 2000
    Location
    Netherlands
    Posts
    442
    no, it didn't work
    There's a certain mystique when I speak, that you notice that it's sorta unique, cause you know it's me

  7. #7
    Sleep mode
    Join Date
    Aug 2002
    Location
    RUH
    Posts
    8,083
    this should work for you !

  8. #8
    l33t! MrPolite's Avatar
    Join Date
    Sep 2001
    Posts
    4,428
    Originally posted by phrozeman
    Thats not what i ment

    Pirate, in vb6 i used Makeflat Text1.hWnd, but in .net the textbox doesn't have a .hWnd function.

    How should i do that?
    use textbox.Handle instead of hwnd
    rate my posts if they help ya!
    Extract thumbnail without reading the whole image file: (C# - VB)
    Apply texture to bitmaps: (C# - VB)
    Extended console library: (VB)
    Save JPEG with a certain quality (image compression): (C# - VB )
    VB.NET to C# conversion tips!!

  9. #9

    Thread Starter
    Hyperactive Member phrozeman's Avatar
    Join Date
    Apr 2000
    Location
    Netherlands
    Posts
    442
    Thanks MrPolite/Pirate... got it working now
    There's a certain mystique when I speak, that you notice that it's sorta unique, cause you know it's me

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width