Results 1 to 18 of 18

Thread: Textbox Style

  1. #1

    Thread Starter
    Frenzied Member numtel's Avatar
    Join Date
    Apr 2000
    Location
    CA
    Posts
    1,163

    Textbox Style

    How can I change the style of a textbox from Spy++ or by writing my own application? Take a look at my Spy++ screenshot to see what it is I'm trying to change.

  2. #2

    Thread Starter
    Frenzied Member numtel's Avatar
    Join Date
    Apr 2000
    Location
    CA
    Posts
    1,163
    Nobody knows? Not even megatron?

  3. #3
    I saw the screenshot, but what does the Style represent? The border of the textbox?

  4. #4
    It's also kinda late in the night.

  5. #5

    Thread Starter
    Frenzied Member numtel's Avatar
    Join Date
    Apr 2000
    Location
    CA
    Posts
    1,163
    The style is the different propertys and stuph, I'm trying to change the locked property and I know the style for a non-locked textbox and for a locked text box.

  6. #6
    PowerPoster beachbum's Avatar
    Join Date
    Jul 2001
    Location
    Wollongong, NSW, Australia
    Posts
    2,274
    Originally posted by numtel
    Nobody knows? Not even megatron?
    Aarghhh. Pls try not to be so presumptious. I am sure that megatron would hate u saying this as much as other programmers on this site. Probably the reason that noone has answered is becos we (well at least I) have no idea what u are talking about. Do u want to change the style as in colours? 3d look? what? U mentioned the locked property. Do u want locked boxes to appear diff to non locked ones?
    Pls rephrase qtn so that ppl can help... and who knows u may even get blessed by a *guru* visiting ur thread.
    Regards
    Stuart
    Stuart Laidlaw
    Brightspark Financial Software
    http://www.gstsmartbook.com

  7. #7
    Fanatic Member Kaverin's Avatar
    Join Date
    Oct 2000
    Posts
    930
    If you want to get/change the style bits of a window, you use the GetWindowLong or SetWindowLong functions with the constant GWL_STYLE, or GWL_EXSTYLE for extended styles (you need the latter for things like determining if a window is an 'on top' one).
    I'm baaaack...
    VB5 Professional Edition, VC++ 6
    Using a 1 gHz Thunderbird, 256 mb RAM, 40 gb HD system with Win98se

    I feel special because I finally figured out how to loop midis: Post link
    I'm a fanatic too

  8. #8
    PowerPoster beachbum's Avatar
    Join Date
    Jul 2001
    Location
    Wollongong, NSW, Australia
    Posts
    2,274
    Originally posted by beachbum
    ..and who knows u may even get blessed by a *guru* visiting ur thread.
    See, one just did. Hold on i didnt mean to say that... can't control fingers. Am typing "Kaverin is a genius".... arrrghhhh.... hhhheeeelppppppp mmmmeeeeeeeeeee
    Stuart Laidlaw
    Brightspark Financial Software
    http://www.gstsmartbook.com

  9. #9
    Tygur
    Guest
    Well, the reason why I haven't answered yet is because I've never seen this thread before...

    Use SetWindowLong. Here's an example that locks or unlocks an edit control (same thing as a textbox). EditHwnd is the handle ( or hWnd) if the control.

    VB Code:
    1. 'These are the declarations
    2. Private Declare Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long) As Long
    3. Private Declare Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As Long, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long
    4. Private Const GWL_STYLE = (-16)
    5. Private Const ES_READONLY = &H800&
    6.  
    7. 'This code locks the edit control, or textbox
    8. Dim lStyle As Long
    9. lStyle = GetWindowLong(EditHwnd, GWL_STYLE)
    10. lStyle = lStyle Or ES_READONLY
    11. SetWindowLong EditHwnd, GWL_STYLE, lStyle
    12.  
    13. 'This code unlocks it
    14. Dim lStyle As Long
    15. lStyle = GetWindowLong(EditHwnd, GWL_STYLE)
    16. lStyle = lStyle And Not ES_READONLY
    17. SetWindowLong EditHwnd, GWL_STYLE, lStyle

    Note: When I was testing this on a vb textbox, the property of the textbox would change as expected, but the behavior wasn't changing for some reason. Just figured I'd let you know.

  10. #10
    Tygur
    Guest
    wow, two posts were made in the time it took for me to make my post. Looks like I spent too much time on it..

  11. #11
    PowerPoster beachbum's Avatar
    Join Date
    Jul 2001
    Location
    Wollongong, NSW, Australia
    Posts
    2,274
    OK Maybe i am missing something here. but surely numtel would just use the Locked property of the textbox if that was what was required. I was assuming that he wanted the textbox to somehow *look* different if locked. I guess we need to wait for him to repost to clarify
    Regards
    Stuart
    Stuart Laidlaw
    Brightspark Financial Software
    http://www.gstsmartbook.com

  12. #12
    Tygur
    Guest
    I'm guessing he wants to change it in a textbox outside his app.

  13. #13

    Thread Starter
    Frenzied Member numtel's Avatar
    Join Date
    Apr 2000
    Location
    CA
    Posts
    1,163
    I just woke up... The set window long might be what I'm looking for. What I'm trying to do is unlock a Edit control in another application.

  14. #14
    DaoK
    Guest

    *Cough* Hacking *Cough*

    Why unlock if the programmer of the program wont let you ^_^

  15. #15
    Member tsoftonline's Avatar
    Join Date
    Aug 2001
    Posts
    42
    If it takes all this trouble (bruhaha?) to do what you're trying to do, it's probably because someone doesn't want you doing it...
    Executive Project Director
    Technosoft Enterprises

    Any of my opinions stated on this or any other forums do not represent the official policy of Technosoft Enteprises, unless otherwise specified.

  16. #16
    Tygur
    Guest

    Re: *Cough* Hacking *Cough*

    Originally posted by DaoK
    Why unlock if the programmer of the program wont let you ^_^
    Why does it matter? There are plenty of legitimite reasons to want to change the properties and behavior of controls on other programs.

  17. #17
    DaoK
    Guest
    ^_^
    That a smile = I dont care lol

  18. #18
    Tygur
    Guest
    Oh, I was wondering what that was

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