So this is using UEZ's initial example but I've added the option of when a user selects the combo or inputbox it will delete the data & if you don't add any data then it will revert back to the previous text!
#AutoIt3Wrapper_Au3Check_Parameters=-d -w 1 -w 2 -w 3 -w 4 -w 5 -w 6
#include <ComboConstants.au3>
#include <EditConstants.au3>
#include <GuiComboBox.au3>
#include <GUIConstantsEx.au3>
#include <WinAPI.au3>
#include <WindowsConstants.au3>
Global $__ControlID, $__PreviousText
_Main()
Func _Main()
Local $hGUI
$hGUI = GUICreate("Example by guinness 2011", 230, 230, -1, -1)
GUISetBkColor(0xFFFFFF)
GUICtrlCreateCombo("Example555@hotmail.com", 8, 8, 209, 25, BitOR($CBS_DROPDOWN, $CBS_AUTOHSCROLL))
GUICtrlSetFont(-1, 9, 400, 2, "Arial")
GUICtrlSetColor(-1, 0x808080)
GUICtrlCreateInput("Enter your password", 8, 40, 209, 23)
GUICtrlSetFont(-1, 9, 400, 2, "Arial")
GUICtrlSetColor(-1, 0x808080)
GUICtrlSetState(-1, $GUI_FOCUS)
GUIRegisterMsg($WM_COMMAND, 'WM_CHECK')
GUISetState(@SW_SHOW, $hGUI)
While 1
Switch GUIGetMsg()
Case $GUI_EVENT_CLOSE
Exit
EndSwitch
WEnd
EndFunc ;==>_Main
Func WM_CHECK($hWnd, $iMsg, $iwParam, $ilParam)
#forceref $hWnd, $iMsg, $ilParam
Local $hHandle, $iCode
$hHandle = GUICtrlGetHandle($__ControlID)
$iCode = _WinAPI_HiWord($iwParam)
Switch $iCode
Case $EN_SETFOCUS, $CBN_SETFOCUS
$__ControlID = _WinAPI_LoWord($iwParam)
$__PreviousText = GUICtrlRead($__ControlID)
GUICtrlSetData($__ControlID, "")
Case $EN_KILLFOCUS, $CBN_KILLFOCUS
If _WinAPI_GetClassName($hHandle) = "ComboBox" Then
_GUICtrlComboBox_SetEditText($hHandle, $__PreviousText)
Else
If GUICtrlRead($__ControlID) = "" Then
GUICtrlSetData($__ControlID, $__PreviousText)
EndIf
EndIf
EndSwitch
Return "GUI_RUNDEFMSG"
EndFunc ;==>WM_CHECK