1. Registry entries

How would you create and modify registry entries in Windows 95 and
Windows NT with Euphoria?

I'd like to make a program that associates *.EX with %EUDIR%\BIN\EX.EXE
with the %EUDIR%\EX.ICO (The floppy with EX on it, on the Recent
Contributions page) for icon, and when you right-click and choose Edit,
it pops up with ED, or whatever you want to use to edit your programs.
Similar things for *.EXW, *.E, *.EW, and *.PRO. (There needs to be a *.EW
icon, I noticed there isn't one....) This would make it easier to set
Euphoria up with Windows 95 (or NT). (I'm very new at Win32 programming,
so please give some clear examples, if possible.)


PS, there's been several distractions lately, so I haven't done much work
on the QBasic to Euphoria stuff (go re-read ABGTE2 again... :), or on
Vector (Still looking for a good control key setup, I don't like the
current setup....), and now I'm looking to learn a little Win32
programming...

_____________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]

new topic     » topic index » view message » categorize

2. Re: Registry entries

From:    Robert B Pilkington
>How would you create and modify registry entries in Windows 95 and
>Windows NT with Euphoria?

     smile  There's lotsa ways to do it.
     For what you want to do, I'd suggest making the file associations
yourself via Windows Explorer, rather than having a program do it.  If ya
don't know how, hit F1 while in Windows Explorer for Windows help and look
up the topic 'file associations', and 'create a new file type'.
     If you really want to mess with the registry directly, I can e-mail you
the procedure to enter the keys manually in Regedit, but that's long and
complicated to write so I won't take up space here.
     You can make an INF file that does it, but I don't really know how
those work.  Search your
hard drive for *.inf and look at some in Notepad to try to figure that
method out.
     You could use the Windows API dll calls to do it programmatically, but
why bother?
     Easier still, make a REG file, a plain text file with one key per line,
something like this:
-------------------------------------
REGEDIT
---command line to edit files of the filetype
HKEY_CLASSES_ROOT\efile\shell\edit\command = C:\EUPHORIA\BIN\ex.exe ed.ex %1
HKEY_CLASSES_ROOT\ewfile\shell\edit\command = C:\EUPHORIA\BIN\ex.exe ed.ex
%1

HKEY_CLASSES_ROOT\exfile\shell\edit\command = C:\EUPHORIA\BIN\ex.exe ed.ex
%1
HKEY_CLASSES_ROOT\exwfile\shell\edit\command = C:\EUPHORIA\BIN\ex.exe ed.ex
%1

---command line to run files of the filetype
HKEY_CLASSES_ROOT\exfile\shell\open\command = C:\EUPHORIA\BIN\ex.exe %1
HKEY_CLASSES_ROOT\exwfile\shell\open\command = C:\EUPHORIA\BIN\exw.exe %1

---icons
HKEY_CLASSES_ROOT\efile\DefaultIcon = C:\EUPHORIA\BIN\e.ico,0
HKEY_CLASSES_ROOT\ewfile\DefaultIcon = C:\EUPHORIA\BIN\ew.ico,0
HKEY_CLASSES_ROOT\exfile\DefaultIcon = C:\EUPHORIA\BIN\ex.ico,0
HKEY_CLASSES_ROOT\exwfile\DefaultIcon = C:\EUPHORIA\BIN\exw.ico,0

--- File extension must have filetype as its value
HKEY_CLASSES_ROOT\.e = efile
HKEY_CLASSES_ROOT\.ew = ewfile
HKEY_CLASSES_ROOT\.ex = exfile
HKEY_CLASSES_ROOT\.exw = exwfile
------------------------------

Edit the paths and command lines so that they're accurate
for your directory structure and the editor you want to use,
and change the icon paths/names to whatever they are on
your system.
You can also create other shell commands for the filetypes
if you want Print, New, or other commands on the menu.

Before you merge it, make sure that the first line is nothing
but the word REGEDIT, and every line with a key value starts
at the very beginning.  (No spaces before the word HKEY_...)
Also make sure you don't have any of the keys or values
wordwrapped.  A key and its value must be on the same line.

You should also make a backup of your registry just in case.
Once you've got the REG file the way you want it, save it,
right click on it and choose Merge, or pass it to Regedit as
a command-line parameter.

Look at some of the REG files on your hard drive for examples.
Note that a newer version of Regedit uses text files that
look more like:
REGEDIT4
[HKEY_CLASSES_ROOT\exfile\shell\open\command]
@="C:\EUPHORIA\BIN\ex.exe %1"
These work the same way, but I think you should use the
other style for compatibility with other versions of Regedit.

You could of course write a program to generate the reg file
based upon the user's directory structure and choice of editors,
etc, and then merge it via system().

Just remember to always make a backup before experimenting
on the registry.

In Win95, it's two files, SYSTEM.DAT and USER.DAT in
the Windows directory.

That's the only one I have experience with, the following
info I got from a text file on www.wotsit.org:

In Windows 3.1 there's only one file named REG.DAT.

In Windows NT there's a whole bunch of files,
SYSTEM32\CONFIG\SAM
SYSTEM32\CONFIG\SOFTWARE
SYSTEM32\CONFIG\SYSTEM
PROFILES\%USERNAME%\NTUSER.DAT
PROFILES\%USERNAME%\NTUSER.MAN
and Regedit is called Regedt32

new topic     » goto parent     » topic index » view message » categorize

3. Re: Registry entries

On Sun, 14 Jun 1998 22:49:30 -0400 Falkon <Falkn13 at IBM.NET> writes:
>From:    Robert B Pilkington
>>How would you create and modify registry entries in Windows 95 and
>>Windows NT with Euphoria?
>
>     smile  There's lotsa ways to do it.
>     For what you want to do, I'd suggest making the file associations
>yourself via Windows Explorer, rather than having a program do it.

(Various non-Euphoria ideas deleted to conserve space)

I already have the setup, but I thought it would be helpful to have a
program to do this, for a couple reasons:

1) New users don't need to go through the trouble of making the
associations, the program does it for them. (And to their preferences.)

2) I can make an .EW file out of the registry stuff that will allow other
programs to make their own associations (ie a filetype extention for a
program can be associated with a Euphoria program like 'professional'
software does), and their own registry keys (which is what most new
software, AFAIK, does now, instead of .INI files.)

3) A learning experience for me in Win32 programming.


PS, to David Cuny or anybody else who can help: In Win32lib, is there a
way to refresh just a part of the window? I'm making a stopwatch program
as my first Win32 program, and I just want to refresh the time, not
repaint the entire window, including the buttons.

_____________________________________________________________________
You don't need to buy Internet access to use free Internet e-mail.
Get completely free e-mail from Juno at http://www.juno.com
Or call Juno at (800) 654-JUNO [654-5866]

new topic     » goto parent     » topic index » view message » categorize

4. Re: Registry entries

Robert B Pilkington wrote:


> PS, to David Cuny or anybody else who can help: In Win32lib, is there a
> way to refresh just a part of the window? I'm making a stopwatch program
> as my first Win32 program, and I just want to refresh the time, not
> repaint the entire window, including the buttons.

Ooops. Sorry, not yet. The paint request actually sends coordinates of the
area to refresh, but as of right now, Win32Lib doesn't use it. The "refresh"
command just invalidates the whole window.

It shouldn't be too difficult to change the code to take the invalidated
region into account. I can't test it (I'm in Win3.1 land for the immediate
future), but you should be able to write your own routine to invalidate only
a section of the window, instead of the whole thing. The force an onPaint.
That should take care of it (I'd give more details, but I don't have the
Win32 help file available).

You might want to bug me in a week or so - when I (hopefully) have a new
drive, and Win95 on my machine again.

-- David Cuny

new topic     » goto parent     » topic index » view message » categorize

5. Re: Registry entries

From:    Robert B Pilkington

>I already have the setup, but I thought it would be helpful to have a
>program to do this, for a couple reasons:

    In that case, I would have a Euphoria program write the
keys and such as a text file, in the REG format, and pass
that to Regedit via the command-line.
   All the necessary info except the program paths could be
stored in a .ew file as text strings, and you could just stick
the paths in at the right places before you write the file.
Using EU's sequence slicing.

    And yes, you can associate files with Euphoria programs
that way.  smile  Maybe source would work better than words,
though, so I'll type out a few routines...

new topic     » goto parent     » topic index » view message » categorize

Search



Quick Links

User menu

Not signed in.

Misc Menu