Announcement

Collapse
No announcement yet.

Who makes the mistake? I, ASUS H-1000 or PB

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Who makes the mistake? I, ASUS H-1000 or PB

    Hello,
    The following programme is the part of my programme which contains the problem.
    >>>>>> Everything works on my desktop PC ! ! !
    The problem only exist on an ASUS H-1000

    The following happens:
    at the function: "Control set text CBHNDL, % IDC_PASSWORD, Password"
    goes control (pointed in the DEBUG) to the function
    "CALLBACK FUNCTION ShowDIALOG1Proc",
    The programm-window is disappeared
    In DEBUG-MODE it seems, the programme is still active. But only in DEBUG.

    Can anybody give me a tip?
    Perhaps somebody works with an ASUS H-1000 and can test it????

    Dieter Heyn



    #PBFORMS CREATED V1.51
    #COMPILE EXE
    #DIM ALL
    '------------------------------------------------------------------------
    ' ** Includes **
    '------------------------------------------------------------------------------
    #PBFORMS BEGIN INCLUDES
    #IF NOT %DEF(%WINAPI)
    #INCLUDE "WIN32API.INC"
    #ENDIF
    #PBFORMS END INCLUDES
    '------------------------------------------------------------------------------
    ' ** Constants **
    '------------------------------------------------------------------------------
    #PBFORMS BEGIN CONSTANTS
    %IDD_DIALOG1 = 101
    %IDC_Password = 1001
    #PBFORMS END CONSTANTS
    '------------------------------------------------------------------------------
    GLOBAL Password AS STRING
    GLOBAL PasswordLesbar AS STRING
    '------------------------------------------------------------------------------
    ' ** Declarations **
    '------------------------------------------------------------------------------
    DECLARE CALLBACK FUNCTION ShowDIALOG1Proc()
    DECLARE FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
    #PBFORMS DECLARATIONS
    '------------------------------------------------------------------------------
    ' ** Main Application Entry Point **
    '------------------------------------------------------------------------------
    FUNCTION PBMAIN()
    ShowDIALOG1 %HWND_DESKTOP
    END FUNCTION
    '------------------------------------------------------------------------------
    ' ** CallBacks **
    '------------------------------------------------------------------------------
    CALLBACK FUNCTION ShowDIALOG1Proc()

    SELECT CASE AS LONG CBMSG
    CASE %WM_INITDIALOG
    ' Initialization handler

    CASE %WM_NCACTIVATE
    STATIC hWndSaveFocus AS DWORD
    IF ISFALSE CBWPARAM THEN
    ' Save control focus
    hWndSaveFocus = GetFocus()
    ELSEIF hWndSaveFocus THEN
    ' Restore control focus
    SetFocus(hWndSaveFocus)
    hWndSaveFocus = 0
    END IF

    CASE %WM_COMMAND
    ' Process control notifications
    SELECT CASE AS LONG CBCTL

    '#######################################################################################
    CASE %IDC_Password
    IF CBCTLMSG = %EN_CHANGE THEN
    CONTROL GET TEXT CBHNDL, %IDC_PASSWORD TO Password
    IF LEN(password) = 1 THEN Passwordlesbar = ""
    Passwordlesbar = PasswordLesbar + RIGHT$(Password,1)
    password = REPEAT$(LEN(password), "#")

    CONTROL SET TEXT CBHNDL, %IDC_PASSWORD, Passwort

    '''''>>>>> the programme does not come back from this function any more.
    '''''>>>>> The window is gone and the next shown function (DEBUG) is: '''''>>>>> CALLBACK '''''FUNCTION ShowDIALOG1Proc"

    DIALOG REDRAW CBHNDL
    ' MSGBOX Password + $CRLF + Passwordlesbar
    END IF
    '#######################################################################################
    END SELECT
    END SELECT
    END FUNCTION
    '------------------------------------------------------------------------------

    '------------------------------------------------------------------------------
    ' ** Dialogs **
    '------------------------------------------------------------------------------
    FUNCTION ShowDIALOG1(BYVAL hParent AS DWORD) AS LONG
    LOCAL lRslt AS LONG

    #PBFORMS BEGIN DIALOG %IDD_DIALOG1->->
    LOCAL hDlg AS DWORD

    DIALOG NEW hParent, "Dialog1", 265, 114, 201, 121, %WS_POPUP OR _
    %WS_BORDER OR %WS_DLGFRAME OR %WS_SYSMENU OR %WS_CLIPSIBLINGS OR _
    %WS_VISIBLE OR %DS_MODALFRAME OR %DS_3DLOOK OR %DS_NOFAILCREATE OR _
    %DS_SETFONT, %WS_EX_CONTROLPARENT OR %WS_EX_LEFT OR _
    %WS_EX_LTRREADING OR %WS_EX_RIGHTSCROLLBAR, TO hDlg
    CONTROL ADD TEXTBOX, hDlg, %IDC_Password, "", 45, 37, 100, 13
    #PBFORMS END DIALOG

    DIALOG SHOW MODAL hDlg, CALL ShowDIALOG1Proc TO lRslt

    #PBFORMS BEGIN CLEANUP %IDD_DIALOG1
    #PBFORMS END CLEANUP

    FUNCTION = lRslt
    END FUNCTION
    '------------------------------------------------------------------------------

    #2
    Answer A)

    Your program is getting stuck in an infinite loop because CONTROL SET TEXT triggers another EN_CHANGE notification.

    Try this:

    Code:
    CASE %IDC_Password
    
    IF CBCTLMSG = %EN_CHANGE THEN
       STATIC snBusy AS LONG
       IF (snBusy) THEN EXIT FUNCTION
       snBusy = %TRUE
       CONTROL GET TEXT CBHNDL, %IDC_PASSWORD TO Password
       IF LEN(password) = 1 THEN Passwordlesbar = ""
       Passwordlesbar = PasswordLesbar + RIGHT$(Password,1)
       password = REPEAT$(LEN(password), "#")
    
       CONTROL SET TEXT CBHNDL, %IDC_PASSWORD, Passwort 
       snBusy = %FALSE
    END IF
    I don't know exactly what your code is intended to be doing, but try ES_PASSWORD style in CONTROL ADD TEXTBOX if you need to hide password chars from view.
    kgpsoftware.com | Slam DBMS | PrpT Control | Other Downloads | Contact Me

    Comment


      #3
      Code as posted should not compile, Note the spelling error
      CONTROL SET TEXT CBHNDL, %IDC_PASSWORD, Passwort <--
      Apart from that in the CASE %IDC_Password section you have two IF statements but only one END IF, this means that forgetting the spelling error it should still not compile

      Comment


        #4
        Kev Peel - - - - Thanks (no text)

        ..

        Comment

        Working...
        X
        😀
        🥰
        🤢
        😎
        😡
        👍
        👎