flat assembler
Message board for the users of flat assembler.

Index > Windows > [SOLVED] Find text dialog box

Author
Thread Post new topic Reply to topic
frech



Joined: 10 Mar 2009
Posts: 31
frech
Hi. Another problem in my simple editor, this time regarding the way to add a find dialog box.
I tried with the WinAPI FindText function and the common dialog box, without success, then I decided to create a stripped down version of that dialog box (just to try, then I'll add something) and call it following the examples in Iczelion tutorial, in MDIRichEditFasm and in AsmWork. No way.
Any tip?
Thank you in advance.


Description:
Download
Filename: ISIDE.zip
Filesize: 27.55 KB
Downloaded: 37 Time(s)



Last edited by frech on 24 Apr 2009, 15:55; edited 3 times in total
Post 24 Apr 2009, 10:04
View user's profile Send private message Visit poster's website Reply with quote
pete



Joined: 20 Apr 2009
Posts: 110
pete
What exactly does not work? To search for the entered text in the RichEditControl? What was the problem with the FindText function?
Post 24 Apr 2009, 10:38
View user's profile Send private message Reply with quote
frech



Joined: 10 Mar 2009
Posts: 31
frech
Hi again, pete. I can't search for the entered text in the control. Here is the portion of code:
Code:
  .dlgfindok:
        invoke  SendMessage,[hwnd_client],WM_MDIGETACTIVE,NULL,NULL
        invoke  GetWindow,eax,GW_CHILD
        mov     [hRichEdit],eax
        invoke  SendMessage,[hRichEdit],EM_EXGETSEL,0,ft.chrg
        invoke GetDlgItemText,[hdlgwnd],IDC_EDT_FIND,search_text,100h
        cmp     eax,0
        je      .processed
        mov     [ft.chrg.cpMin],0
        mov     [ft.chrg.cpMax],-1
        mov     [ft.lpstrText],search_text
        invoke  SendMessage,[hRichEdit],EM_FINDTEXTEX,0,ft
        cmp     eax,-1
        je      .processed
        invoke MessageBox,0,search_text,_title,MB_OK
        invoke SendMessage,[hRichEdit],EM_EXSETSEL,0,ft.chrgText ; seleziona il testo trovato
        jmp     .processed
    
The problem is that
Code:
invoke  SendMessage,[hRichEdit],EM_FINDTEXTEX,0,ft    
returns always -1, so it always fails.
Post 24 Apr 2009, 11:52
View user's profile Send private message Visit poster's website Reply with quote
pete



Joined: 20 Apr 2009
Posts: 110
pete
When you read the docu at http://msdn.microsoft.com/en-us/library/bb788011(VS.85,loband).aspx, you will discover that wparam should be one of the flags listed there. I did a research and discovered, that no flag has the value 0, so this is an invalid parameter you use with EM_FINDTEXTEX.
Post 24 Apr 2009, 13:02
View user's profile Send private message Reply with quote
frech



Joined: 10 Mar 2009
Posts: 31
frech
Uhm... Here's what I found in WIN32Help fo EM_FINDTEXTEX:
Quote:
Finds text within a rich edit control.

EM_FINDTEXTEX
wParam = (WPARAM) (UINT) fuFlags;
lParam = (LPARAM) (FINDTEXTEX FAR *) lpFindText;


Parameters

fuFlags

Zero or more of the FT_MATCHCASE and FT_WHOLEWORD values.

lpFindText

Address of a FINDTEXTEX structure containing information about the find operation.



Return Values

Returns the zero-based character position of the next match or - 1 if there are no more matches.

It says that even 0 is allowed... Anyway, I tried with FR_DOWN: now it finds the text but does not select it. In the mean while, I'll try and implement "find next"... Wink
Post 24 Apr 2009, 13:17
View user's profile Send private message Visit poster's website Reply with quote
pete



Joined: 20 Apr 2009
Posts: 110
pete
Well WIN32HLP is out of date. If you are having trouble with something documented in WIN32HLP, check out the online MSDN docs!

There is no up-to-date WIN32HLP as far as i know…
Post 24 Apr 2009, 13:23
View user's profile Send private message Reply with quote
frech



Joined: 10 Mar 2009
Posts: 31
frech
Yeah, that's true... I will, thanks. Is there a downloadable version, anyway? And what about the selection of the text?
Post 24 Apr 2009, 13:30
View user's profile Send private message Visit poster's website Reply with quote
frech



Joined: 10 Mar 2009
Posts: 31
frech
Ok, I solved the text selection "bug" invoking SetFocus on the rich edit control and now it works ok.
Thank you again, pete!
Post 24 Apr 2009, 14:54
View user's profile Send private message Visit poster's website Reply with quote
pete



Joined: 20 Apr 2009
Posts: 110
pete
Yes, there's a downloadable version of the MSDN, but it's several GIGABYTES in size…
Check the last post of the Windows FAQ thread!
Post 27 Apr 2009, 11:25
View user's profile Send private message Reply with quote
Display posts from previous:
Post new topic Reply to topic

Jump to:  


< Last Thread | Next Thread >
Forum Rules:
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You can download files in this forum


Copyright © 1999-2020, Tomasz Grysztar. Also on YouTube, Twitter.

Website powered by rwasa.