CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4

Thread: API questions

  1. #1
    Join Date
    Jan 2000
    Location
    Madison, WI
    Posts
    6

    API questions

    Hello, I have these two api calls that I would like to use. They seem to call the find/replace windows. I just have a simple project with a text box and a command button. I would like to have the ability to call the find/replace window. I understand I will have to use VB code to do the find/replace. I am wondering if it is possible to call these windows so that my project will "look" standardized.
    module contains

    option Explicit
    public Declare Function FindText Lib "comdlg32.dll" Alias "FindTextA " (pFindreplace as FINDREPLACE) as Long
    public Declare Function ReplaceText Lib "comdlg32.dll" Alias "ReplaceTextA" (pFindreplace as FINDREPLACE) as Long
    public Type FINDREPLACE
    lStructSize as Long ' size of this struct 0x20
    hwndOwner as Long ' handle to owner's window
    hInstance as Long ' instance handle of.EXE that
    ' contains cust. dlg. template
    flags as Long ' one or more of the FR_??
    lpstrFindWhat as string ' ptr. to search string
    lpstrReplaceWith as string ' ptr. to replace string
    wFindWhatLen as Integer ' size of find buffer
    wReplaceWithLen as Integer ' size of replace buffer
    lCustData as Long ' data passed to hook fn.
    lpfnHook as Long ' ptr. to hook fn. or null
    lpTemplateName as string ' custom template name
    End Type



    command button code

    private Sub Command1_Click()
    Dim result as Long
    Dim x as string
    Dim test as FINDREPLACE
    x = "svelt"
    test.lpstrFindWhat = x
    'what to do what to do
    End Sub



    I am very new to the whole API thing and VB.
    I can see that I have to find the handles of some windows. How do I do that?
    also, how could I get this project to flash the find/replace window and get some info from it.
    thank you for your time and have a good day

    I’m so skeptical I can hardly believe it!

  2. #2
    Join Date
    Dec 1999
    Location
    Malaysia
    Posts
    56

    Re: API questions

    Hi...
    Hopefully, I may be able to help you with one of the questions since I'm pretty new to API too.
    I am sure if you have had fully installed VB in your machine, you would have seen a program called "API Text Viewer". If you start this up, you may load the API text files with this program by selecting "File --> Load Text File".
    The listing of all the API functions are there for you to use in your VB programs. Then, you can "cut-and-paste" this code in your VB programs... as simple as that!!!
    Anyway, scout around the Net for API help.. plenty of those around... and of course, the forum here is always ready to help anyone in dire need of VB help...

    ____________________________________
    The VB Bugs in my Life...

  3. #3
    Join Date
    Jan 2000
    Location
    Madison, WI
    Posts
    6

    Re: API questions

    thank you for your response
    you would have seen a program called "API Text Viewer".
    that is how I got the declares for the functions and the declare for the findreplace datatype.
    It does not show you how to use the functions. It appears I may need to pass the findreplace datatype the handle of some items, more then just me.hwnd
    thank you for your time and have a good day

    I’m so skeptical I can hardly believe it!

  4. #4
    Join Date
    Dec 1999
    Location
    Malaysia
    Posts
    56

    Re: API questions

    Hi again,
    I am not too familiar with API since I am starting to learn how to use it. Anyway, I have found this site that might help alot for API stuff,
    http://wpr.hypermart.net/
    Hope this helps...

    ____________________________________
    The VB Bugs in my Life...

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured