Results 1 to 3 of 3

Thread: setwindowlongptrw vs setwindowlongptr

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2020
    Posts
    3

    setwindowlongptrw vs setwindowlongptr

    hey everyone

    i have difficulties in understanding what's going on with UNICODE.

    example1:
    I create a listbox with createwindow (not the UNICODE)
    i subclass it with the unicode version
    SetWindowLongPtrW
    in the subclassed procedure i use ANSI CallWindowProc

    I use UNICODE SendMessageW to send UNICODE strings
    and I Use ANSI SendMessage to send ANSI strings

    everything seems to be OK

    the subclassed listbox control got the UNICODE strings
    and the ANSI string with no problem..


    example2:
    the same thing as example1
    except that the control is EDIT

    whether i send ANSI whether UNICODE strings
    at the end i get a truncated string
    that means there was a mismatch between ANSI and UNICODE

    to fix this, in the subclassed procedure I use the UNICODE CallWindowProcW
    now the UNICODE strings arrive correctly to the control.


    my question is:
    is there some constant rule when to use CallWindowProcW/CallWindowProc

    why with listbox i DONT need the UNICODE
    and with EDIT I MUST use the UNICODE CallWindowProcW

    I really need to know what's going on so I can use ANSI/UNICODE correctly.

    third question is
    i create custom control
    and i want it to optionally handle UNICODE strings via sendmessageW sent to it.
    when I create it, do i MUST use CreateWindowExW or it's OK to use CreateWindowEx ?

    some details:
    I use GPP.
    I dont use vb6 AT ALL
    i use CreateWindowEx to create all controls
    when i compile i DONT use #define UNICODE (and I DONT want to use it)
    so my app is actually ANSI
    and when i need UNICODE i use it as described above


    thanks in advanced.
    Last edited by jim_box; Aug 15th, 2022 at 01:46 PM.

  2. #2
    Frenzied Member
    Join Date
    Feb 2003
    Posts
    1,567

    Re: setwindowlongptrw vs setwindowlongptr

    Are you trying to create a listbox using the API?

  3. #3
    Super Moderator dday9's Avatar
    Join Date
    Mar 2011
    Location
    South Louisiana
    Posts
    11,076

    Re: setwindowlongptrw vs setwindowlongptr

    Moved from Visual Basic 6 and Earlier to Other Programming Languages since this thread has nothing to do with VB6.
    "Code is like humor. When you have to explain it, itís bad." - Cory House
    VbLessons | Code Tags | Sword of Fury - Jameram

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