Change Notepad settings from VB 6.0
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 7 of 7

Thread: Change Notepad settings from VB 6.0

  1. #1
    Join Date
    Mar 2004
    Posts
    2

    Change Notepad settings from VB 6.0

    I have started Notepad with the Shell function.

    Is there a way to change the Page Orientation, Header & Footer
    Information, and the Font from within the VB program?

    Or:

    Can you create an instance of or object of Notepad as you can
    with MS Word? How about Wordpad?

    Greatful for any advice!
    Thanks

  2. #2
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    Notepad or Wordpad are not com compliant

    Thus you cannot instantiate them.
    But you should achieve your goal reading andd changing some registry keys.

    Modifying Notepad:
    http://www.codeguru.com/forum/showth...hlight=notepad

    Using WordPad:
    http://www.codeguru.com/forum/showth...hlight=notepad
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  3. #3
    Join Date
    Mar 2004
    Posts
    2
    Thanks Cimperiali,

    The Registry is the way to resolve my problems, now if I could just get it to work.

    I have written this in my program:

    SaveSetting "HKEY_CURRENT_USER\Software\Microsoft", "Notepad", "lfFaceName", "Arial Black"

    varSetting = GetSetting("HKEY_CURRENT_USER\Software\Microsoft", "Notepad", "lfFaceName")

    Debug.Print varSetting


    Debug-Print shows that I have saved the value for lfFaceName as Arial Black, but RegEdit still shows the Notepad lfFaceName as Courier New so Notepad still comes up with Courier New.

    Where did the change get saved?

    From my program, how can I:
    1.) Change the Page Orientation from Portrait to Landscape?
    2.) Remove the values stored in Page Header and Footer?
    3.) Change the Top and Left margins?

    Again, Thanks for getting me on the right track with the Registry,
    if you could help me resolve these problems I would greatly appreciate it, or point me to a resource which will guide me through this.

    Richard

  4. #4
    Join Date
    Jul 2000
    Location
    Milano, Italy
    Posts
    7,726

    savesettings...

    Savesettings is not the way to write where you need, as it adds keys and value under....\vba....
    take a look here


    ..... Links removed .... Domain redirects ....
    Last edited by GremlinSA; January 10th, 2013 at 01:45 AM.
    ...at present time, using mainly Net 4.0, Vs 2010



    Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
    all the other wonderful people who made and make Codeguru a great place.
    Come back soon, you Gurus.

  5. #5
    Join Date
    Jan 2013
    Posts
    1

    Re: savesettings...

    Quote Originally Posted by Cimperiali View Post
    Savesettings is not the way to write where you need, as it adds keys and value under....\vba....
    take a look here
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Just as an FYI, this web site takes you to a PORN SITE.
    Last edited by GremlinSA; January 10th, 2013 at 01:46 AM.

  6. #6
    Join Date
    Jun 2005
    Location
    JHB South Africa
    Posts
    3,772

    Re: savesettings...

    Quote Originally Posted by Twindad97 View Post
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

    Just as an FYI, this web site takes you to a PORN SITE.
    Thanks...

    Taken care of the links...
    Articles VB6 : Break the 2G limit - Animation 1, 2 VB.NET : 2005/8 : Moving Images , Animation 1 , 2 , 3 , User Controls
    WPF Articles : 3D Animation 1 , 2 , 3
    Code snips: VB6 Hex Edit, IP Chat, Copy Prot., Crop, Zoom : .NET IP Chat (V4), Adv. ContextMenus, click Hotspot, Scroll Controls
    Find me in ASP.NET., VB6., VB.NET , Writing Articles, My Genealogy, Forum
    All VS.NET: posts refer to VS.NET 2008 (Pro) unless otherwise stated.

  7. #7
    Join Date
    Jul 2001
    Location
    Sunny South Africa
    Posts
    11,100

    Re: Change Notepad settings from VB 6.0

    You'd need to use the RegSaveKey to save keys like these. Have a look here :

    http://allapi.mentalis.org/apilist/RegSaveKey.shtml

    Remember also changing system wide settings are usually frowned upon...

Posting Permissions

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


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center