dcsimg
Results 1 to 8 of 8

Thread: How to embedd own font and external application to VB6 project?

  1. #1

    Thread Starter
    Lively Member
    Join Date
    Oct 2016
    Posts
    75

    How to embedd own font and external application to VB6 project?

    Hi!

    I need to help with embedding own font and application into VB6 project.

    I need to do it so, that font used in finished program will be not required installed on other computer.
    I need also embedd application - exactly single EXE file (written in C) and start it by code in project and of course will be not required external copy.
    Else one Q is if is possible to use Common Dialog Control in project and finished program will not require to have it in system - is it possible? I know to create own open/save dialogs, but this way can be easier and even better.

    Can anybody help me?

    Thank you for all.
    Miro

  2. #2
    PowerPoster
    Join Date
    Feb 2012
    Location
    West Virginia
    Posts
    12,380

    Re: How to embedd own font and external application to VB6 project?

    I would say do not try to embed either. Instead create a proper installer that installs your program, the font and the external exe as well as any other support files that may be needed.

    No you can not use a control that does not exist on the target system. It must be included as part of your install routine in order for it to work.
    You can however use API instead of the control and not need the control on the system.

  3. #3
    Fanatic Member
    Join Date
    Apr 2012
    Posts
    1,019

    Re: How to embedd own font and external application to VB6 project?

    In a module

    Code:
    Option Explicit
    Private Declare Function AddFontResourceEx Lib "gdi32" Alias "AddFontResourceExA" _
        (ByVal sFileName As String, ByVal lFlags As Long, ByVal lReserved As Long) As Long
    
    Private Const FR_PRIVATE As Long = &H10
    Public Sub InstallFonts()
       InstallFont "MyFont"
       InstallFont "MyFont Bold"
       InstallFont "MyFont Italic"
    End Sub
    Private Function InstallFont(pFontName As String)
    Dim lRet As Long
       lRet = AddFontResourceEx(App.Path & "\" & pFontName & ".ttf", FR_PRIVATE, 0&)
    End Function
    If you don't know where you're going, any road will take you there...

    My VB6 love-children: Vee-Hive and Vee-Launcher

  4. #4

    Thread Starter
    Lively Member
    Join Date
    Oct 2016
    Posts
    75

    Re: How to embedd own font and external application to VB6 project?

    I want to embedd external app and font to release it as standalone exe.

    Miro

  5. #5
    PowerPoster Elroy's Avatar
    Join Date
    Jun 2014
    Location
    Near Nashville TN
    Posts
    4,535

    Re: How to embedd own font and external application to VB6 project?

    I only have a second, but I use controls that aren't on a target computer all the time. That's precisely what the SxS technology is for, discussed here. Also, near the end of that tutorial, it talks about how to wrap these OCX files into your EXE file (using your resources).

    Furthermore, I have little doubt I could also put a font into my resources, unpack it, and temporarily "install" it for my own use. This doesn't seem like a huge deal to me, but I suppose it is of intermediate VB6 level. You wouldn't even need administrative rights (if it were a temporary install). I'd outline it, but I just don't have the time at the moment.

    Good Luck Though,
    Elroy
    Any software I post in these forums written by me is provided “AS IS” without warranty of any kind, expressed or implied, and permission is hereby granted, free of charge and without restriction, to any person obtaining a copy. Please understand that I’ve been programming since the mid-1970s and still have some of that code. My contemporary VB6 project is approaching 1,000 modules. In addition, I have a “VB6 random code folder” that is overflowing. I’ve been at this long enough to truly not know with absolute certainty from whence every single line of my code has come, with much of it coming from programmers under my employ who signed intellectual property transfers. I have not deliberately attempted to remove any licenses and/or attributions from any software. If someone finds that I have inadvertently done so, I sincerely apologize, and, upon notice and reasonable proof, will re-attach those licenses and/or attributions. To all, peace and happiness.

  6. #6
    Lively Member
    Join Date
    Aug 2017
    Posts
    114

    Re: How to embedd own font and external application to VB6 project?

    Quote Originally Posted by Bonnie West View Post
    The attached demo shows how to load (via AddFontMemResourceEx) a font embedded as a resource in the exe.


    Last edited by Victor Bravo VI; Apr 16th, 2018 at 12:46 PM.

  7. #7
    Frenzied Member
    Join Date
    Jun 2015
    Posts
    2,027

    Re: How to embedd own font and external application to VB6 project?

    Victor beat me to it, but I would also go with AddFontMemResourceEx, and just keep the Font embedded in the EXE
    Imagine what it would be like to set breakpoints in, or step through subclassing code;
    and then being able to hit stop/end/debug or continue, without crashing the IDE.

    VB6.tlb | Bulletproof Subclassing in the IDE (no thunks/assembly/DEP issues)

  8. #8

Posting Permissions

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



Featured


Click Here to Expand Forum to Full Width