1. setFocus console
- Posted by doncCcole Aug 30, 2016
- 1550 views
I had a program that setFocus(console) and other functions and procedures dealing with the console.
I believe it was written by Otter Dad.
Does anybody know the name of that file?
or
Does anyone have the Euphoria code to focus the console window?
Don Cole
2. Re: setFocus console
- Posted by jimcbrown (admin) Aug 30, 2016
- 1573 views
I had a program that setFocus(console) and other functions and procedures dealing with the console.
I believe it was written by Otter Dad.
Does anybody know the name of that file?
No. But was it one of these?
http://www.rapideuphoria.com/cgi-bin/asearch.exu?dos=on&win=on&lnx=on&gen=on&keywords=otterdad
Does anyone have the Euphoria code to focus the console window?
Don Cole
You've asked this before, and gotten answers:
3. Re: setFocus console
- Posted by doncCcole Aug 30, 2016
- 1534 views
Thank you jimbrown,
He either emailed it to me or put it as an answer to one of my posts.
I don't think it was ever in the archives.
I checked all my past posts but can't seem to find it.
He has another one called autoDetect.exw.
That finds your USB drives.
I see the Microsoft codes. He had wrapped it for Euphoria. I don't know how to do that.
Don Cole
4. Re: setFocus console
- Posted by jmduro Sep 06, 2016
- 1425 views
Does anyone have the Euphoria code to focus the console window?
What are you expecting exactly? A list of open windows handles with their title and the wrapped function to focus on the handle of a console window with the expected title ?
Jean-Marc
5. Re: setFocus console
- Posted by jmduro Sep 06, 2016
- 1443 views
What are you expecting exactly? A list of open windows handles with their title and the wrapped function to focus on the handle of a console window with the expected title ?
If so, then this might help:
include dll.e include machine.e include window.ew -- Window Finding functions, Thomas Parslow (PatRat), 25/June/2001 constant USER32 = open_dll("user32.dll"), dllEnumThreadWindows = define_c_func(USER32, "EnumThreadWindows", {C_INT, C_POINTER, C_ULONG}, C_INT), dllGetWindowThreadProcessId = define_c_func(USER32, "GetWindowThreadProcessId", {C_LONG, C_POINTER}, C_LONG), dllSetFocus = define_c_proc(USER32, "SetFocus", {C_POINTER}) sequence windowsList ------------------------------------------------------------------------------ procedure setFocus(atom hwnd) c_proc(dllSetFocus, {hwnd}) end procedure ------------------------------------------------------------------------------ function findWindow(object val, integer field) for i = 1 to length(windowsList) do if compare(windowsList[i][field], val) = 0 then return i end if end for return 0 end function ------------------------------------------------------------------------------ function listWindows(sequence s) sequence wins atom pid, thPID, buffer object caption sequence winList wins = window_GetHwnds(s) winList = repeat("", length(wins)) buffer = allocate(4) for i = 1 to length(wins) do caption = window_GetCaption( wins[i] ) if not (sequence(caption) and (length(caption)>1)) then caption = "" end if thPID = c_func(dllGetWindowThreadProcessId,{wins[i],buffer}) pid =peek4u(buffer) winList[i] = { caption, wins[i], pid, thPID } end for free(buffer) return winList end function -- addWindows ------------------------------------------------------------------------------ sequence winList winList = listWindows("Command Window*") for x = 1 to length(winList) do windowsList = append(windowsList, {winList[x][1], -- Window title winList[x][2], -- Window Handle (hWnd) winList[x][3], -- process ID winList[x][4], -- thread ID 0, "", 0}) end for -- add function to select your console window handle from windowsList -- according to its title then call setFocus
Jean-Marc