Results 1 to 9 of 9

Thread: How to: place lots of text into VB app?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Feb 1999
    Location
    Austin,TX,USA
    Posts
    98

    Post

    Hi all! I’m building a test engine for new employees for my company using VB 6.0 in Visual Studio 6.0. The last thing I need to do is put about 20-30 pages of text info about the company into the program for the new employees to read over, then take a test on. What’s the best, most secure way to get this text into the VB app to be read by the new employees? Can I use HTML pages & have them viewed by a customizable browser I build into the VB app? If so, can the HTML pages be packaged with the program when it’s compiled? Or should I use a text file, which the app can access If so, how do I protect the text file from being read? ? Or is there a way to use Acrobat pdf files within the app? Thanks in advance for any answers/help I can get!

  2. #2
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303

    Post

    You can do you pages in HTML no problem and have you VB app open it up in the standard Web Browswer (IE5 for exmaple)

    I use something like this
    Place this code in a command button for something
    Call RunShellExecute("Open", "c:\help\default.htm", 0&, 0&, SW_SHOWNORMAL)

    Then
    Sub RunShellExecute(sTopic As String, sFile As Variant, sParams As Variant, sDirectory As Variant, nShowCmd As Long)

    ' runs a program to shell
    Dim success As Long
    Dim hWndDesk As Long
    Const SE_ERR_NOASSOC = &H31
    success = ShellExecute(hWndDesk, sTopic, sFile, sParams, sDirectory, nShowCmd)

    End Sub

    Place this in a module
    Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" (ByVal hWnd As Long, ByVal lpOperation As String, ByVal lpFile As String, ByVal lpParameters As String, ByVal lpDirecttory As String, ByVal nShowCmd As Long) As Long


    ------------------
    Thanks in advance for any help provided.

  3. #3
    Hyperactive Member parkes's Avatar
    Join Date
    Jan 1999
    Location
    Unitied Kingdom
    Posts
    303

    Post

    Sorry forget to add this bit to the module

    Public Const SW_SHOWNORMAL As Long = 1 'used with ShellExecute
    Public Const SW_SHOWMAX As Long = 3 'used with ShellExecute
    Public Const SW_SHOWDEFAULT As Long = 10 'used with ShellExecute




    ------------------
    Thanks in advance for any help provided.

  4. #4
    Guest

    Post

    Why not using a res file. you can use the resource addin app for it.

    The Legend Will Return.

  5. #5

    Thread Starter
    Lively Member
    Join Date
    Feb 1999
    Location
    Austin,TX,USA
    Posts
    98

    Post

    [QUOTE]Originally posted by kayoca:
    [B]Why not using a res file. you can use the resource addin app for it.

    Already thought of that, but guess what? A string resource file is limited to 256 characters only!(according to Microsoft) SO that won't work, unfortunately. Parkes, how do you associate the HTML files with your VB project when you're compiling it? Thanks for the help, guys!


  6. #6
    Member
    Join Date
    Feb 2000
    Posts
    43

    Post

    here is one way:

    when you run the setup wizard utility thingy, at the the end it asks you for "other files" to distribute with it. Just select your .HTML files there.

    Then it compresses everything and makes a SETUP.EXE

    in the code, give the path to the HTML file as:

    Code:
    if right$(app.path, 1) <> "\" then
        htmlfile$=app.path & "\"
    else
        htmlfile$=app.path
    end if
    
    htmlfile$ = htmlfile$ & "file001.html"
    assuming that the HTML files are stored in the same folder as the EXE file (which is found by app.path)

    I believe you can also "Add..." a "related file" in VB similar to the way you add forms. I've seen it done, but never done it myself. This is really unnecessary though, as long as you install the HTML files with the rest of the program.


    ------------------
    Rapmaster

  7. #7

    Thread Starter
    Lively Member
    Join Date
    Feb 1999
    Location
    Austin,TX,USA
    Posts
    98

    Post

    Oh MAN! I't CAN'T be that simple! <sg> So all I need to do is build the text into an HTML file then just add it to the project? That's great! Thanks Rapmaster! Altho I feel kinda silly, since I couldn't find that answer in ANY of the VB books I've got-OR at MSDN. I guess they don't tell you about the easy stuff! Thanks again Rapmaster.

  8. #8
    Member
    Join Date
    Feb 2000
    Posts
    43

    Post

    you don't even have to add it to the project. There is no need for the HTML file to be listed in the VBP file. Just make sure you distribute the HTMLs with the final EXE and install them in the same folder (or at least to a subfolder of it)

    ------------------
    Rapmaster

  9. #9
    So Unbanned DiGiTaIErRoR's Avatar
    Join Date
    Apr 1999
    Location
    /dev/null
    Posts
    4,111

    Post

    It'ld probably be better just to use RTF format textbox!!!

    ------------------
    DiGiTaIErRoR
    VB, QBasic, Iptscrae, HTML
    Quote: There are no stupid questions, just stupid people.

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