🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
4 messages
4 total messages Started by Renald Yazmir Tue, 04 Sep 2007 19:44
How to determine active edit control in Windows API
#1366
Author: Renald Yazmir
Date: Tue, 04 Sep 2007 19:44
38 lines
1493 bytes
Hello



I am using Windows API. I have 2 edit controls in the dialog box.

I get HWND for each edit control using:

  edit_1_hwnd = GetDlgItem(parent_hwnd,  3);
  edit_1_hwnd = GetDlgItem(parent_hwnd, 4);



The cursor can be in any edit box at any position.



I need to know where the cursor is in edit 1 or in edit 2.

Then I will use

SendMessage (edit_1_hwnd, EM_GETSEL, (UINT)&start, (UINT)&end);

or

SendMessage (edit_2_hwnd, EM_GETSEL, (UINT)&start, (UINT)&end);

to get cursor position.



I tried GetFocus() unsuccessfully



Thank you

Rony
Re: How to determine active edit control in Windows API
#1367
Author: Remy Lebeau (TeamB)
Date: Tue, 04 Sep 2007 18:56
19 lines
1384 bytes
"Renald Yazmir" <renald@partmaker.com> wrote in message
news:46dda78f@newsgroups.borland.com...

> I am using Windows API. I have 2 edit controls in the dialog box.

Is it a dialog that you created yourself, or is it a dialog in another
thread/process?

> I tried GetFocus() unsuccessfully

GetFocus() only works if the calling thread is the same thread that is
running the dialog, or if the calling thread has attached itself to the
dialog's thread via AttachThreadInput().

Have you tried GetActiveWindow() yet?


Gambit
Re: How to determine active edit control in Windows API
#1369
Author: Remy Lebeau (TeamB)
Date: Tue, 04 Sep 2007 19:17
12 lines
1231 bytes
"Renald Yazmir" <renald@partmaker.com> wrote in message
news:46ddacb5@newsgroups.borland.com...

> Yes, It is a dialog that I create myself

Then GetFocus() should be working.  What is happening exactly when you say
it is not working?  You need to be more specific.  Can you show your actual
code?


Gambit
Re: How to determine active edit control in Windows API
#1368
Author: Renald Yazmir
Date: Tue, 04 Sep 2007 20:06
26 lines
1787 bytes
Yes, It is a dialog that I create myself
GetActiveWindow()  returns the HWND of the dialog, not of the edit control.

"Remy Lebeau (TeamB)" <no.spam@no.spam.com> wrote in message 
news:46ddaa5f$1@newsgroups.borland.com...
>
> "Renald Yazmir" <renald@partmaker.com> wrote in message
> news:46dda78f@newsgroups.borland.com...
>
>> I am using Windows API. I have 2 edit controls in the dialog box.
>
> Is it a dialog that you created yourself, or is it a dialog in another
> thread/process?
>
>> I tried GetFocus() unsuccessfully
>
> GetFocus() only works if the calling thread is the same thread that is
> running the dialog, or if the calling thread has attached itself to the
> dialog's thread via AttachThreadInput().
>
> Have you tried GetActiveWindow() yet?
>
>
> Gambit
>
> 
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads