473,796 Members | 2,464 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to add a DWORD value to the Registry

CMG
I am writing a little code to associate an extention with
my program. And as far as i can see, i need to do the
following:
Public Function associatefile(B yVal
FILE_EXTENTION_ TO_ASSOCIATE As String, ByVal
FILE_EXTENTION_ DESCRIPTION As String, ByVal EXE_NAME As
String, ByVal DEFAULT_OPEN_CO MMAND As String, ByVal
DEFAULT_ICON As String, ByVal ACTION_NAME As String)
Dim RegKey As RegistryKey
RegKey = Registry.Classe sRoot.CreateSub Key
("CMG.ASSOCIATI ON\")
RegKey.SetValue ("", FILE_EXTENTION_ DESCRIPTION)
RegKey.SetValue ("EditFlags" , 0)
RegKey.SetValue ("AlwaysShowExt ", "")
RegKey.SetValue ("BrowserFlags" , 8)
RegKey = Registry.Classe sRoot.CreateSub Key
("CMG.ASSOCIATI ON\DefaultIcon\ ")
RegKey.SetValue ("", DEFAULT_ICON)
RegKey = Registry.Classe sRoot.CreateSub Key
("CMG.ASSOCIATI ON\shell\")
RegKey.SetValue ("", ACTION_NAME)
RegKey = Registry.Classe sRoot.CreateSub Key
("CMG.ASSOCIATI ON\shell\" & ACTION_NAME & "\command\" )
RegKey.SetValue ("", DEFAULT_OPEN_CO MMAND)
RegKey = Registry.Classe sRoot.CreateSub Key
("CMG.ASSOCIATI ON\shell\" & ACTION_NAME
& "\ddeexec\Appli cation\")
RegKey.SetValue ("", ACTION_NAME)
RegKey = Registry.Classe sRoot.CreateSub Key
("CMG.ASSOCIATI ON\shell\" & ACTION_NAME
& "\ddeexec\Topic \")
RegKey.SetValue ("", "system")
RegKey = Registry.Classe sRoot.CreateSub Key
("Applications\ " & EXE_NAME & "\shell\open\co mmand\")
RegKey.SetValue ("", DEFAULT_OPEN_CO MMAND)
RegKey = Registry.Classe sRoot.CreateSub Key
(FILE_EXTENTION _TO_ASSOCIATE)
RegKey.SetValue ("", "CMG.ASSOCIATIO N")
End Function

Example how to call it:

CMG.associatefi le(".CMGCHECK" , "CMG CHECKING
FILE", "CMGCHECK.E XE", """C:\CMGCHECK. EXE"" ""%
1""", "shell32.dll,44 ", "CHECK CMG DATABASE")

the values 0 and 8 should be dwords, but i just dnno how
to add it as dword... i searched on google and MSDN
without luck. The Object browser also has no data for
DWORD.

Thanx in advance.

N.B.

If the things i do above are not correct, plz tell me
what i am missing...
Nov 20 '05 #1
6 16816
"CMG" <vb****@divx-warez.nl> schrieb
RegKey.SetValue ("EditFlags" , 0)


This line added a DWORD here, so I don't see the problem.
--
Armin

Nov 20 '05 #2
CMG
No it doesn't, it just set's a normal string value, try it, and check ur
registry ;) The registry does not say DWORD, it just says normal value
"Armin Zingler" <az*******@free net.de> schreef in bericht
news:%2******** ********@TK2MSF TNGP09.phx.gbl. ..
"CMG" <vb****@divx-warez.nl> schrieb
RegKey.SetValue ("EditFlags" , 0)


This line added a DWORD here, so I don't see the problem.
--
Armin

Nov 20 '05 #3
* "CMG" <vb****@divx-warez.nl> scripsit:
RegKey.SetValue ("EditFlags" , 0)
RegKey.SetValue ("BrowserFlags" , 8)


The lines above should save the value as DWORD in the registry...

There is a bug which causes the method to save a large number as string
(<http://weblogs.asp.net/tmeston/archive/2003/07/13/10021.aspx>), but I
think that's not the problem.

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #4
"CMG" <vb****@divx-warez.nl> schrieb
No it doesn't, it just set's a normal string value, try it, and
check ur registry ;) The registry does not say DWORD, it just says
normal value

No, it says DWORD. Really, I checked it. To be exact, the type column says
"REG_DWORD" .

Here's a screenshot:
EditFlags REG_DWORD 0x00000000 (0)

;-)
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #5
CMG
U were right. I dnno what the fuck went wrong, but when i did it, there were
no dword values, now i fine-tuned my little script, and it works as it
should... For the ppl that might like this (dnno if this is of anny use to
you ppl, but hey, here it is annyway...)

CODE:::

Public Function associatefile(B yVal FILE_EXTENTION_ TO_ASSOCIATE As String,
ByVal FILE_EXTENTION_ DESCRIPTION As String, ByVal EXE_NAME As String, ByVal
EXE_FILE As String, ByVal DEFAULT_OPEN_CO MMAND As String, ByVal DEFAULT_ICON
As String, ByVal ACTION_NAME As String)

Dim RegKey As RegistryKey

RegKey = Registry.Classe sRoot.CreateSub Key(EXE_NAME & "_auto_file \")

RegKey.SetValue ("", FILE_EXTENTION_ DESCRIPTION)

RegKey.SetValue ("EditFlags" , 0)

RegKey.SetValue ("BrowserFlags" , 8)

RegKey = Registry.Classe sRoot.CreateSub Key(EXE_NAME &
"_auto_file\Def aultIcon\")

RegKey.SetValue ("", DEFAULT_ICON)

RegKey = Registry.Classe sRoot.CreateSub Key(EXE_NAME & "_auto_file\she ll\")

RegKey.SetValue ("", "open")

RegKey = Registry.Classe sRoot.CreateSub Key(EXE_NAME &
"_auto_file\she ll\open\")

RegKey.SetValue ("", ACTION_NAME)

RegKey = Registry.Classe sRoot.CreateSub Key(EXE_NAME &
"_auto_file\she ll\open\command \")

RegKey.SetValue ("", DEFAULT_OPEN_CO MMAND)

RegKey = Registry.Classe sRoot.CreateSub Key(EXE_NAME &
"_auto_file\she ll\open\ddeexec \Application\")

RegKey.SetValue ("", EXE_NAME)

RegKey = Registry.Classe sRoot.CreateSub Key(EXE_NAME &
"_auto_file\she ll\open\ddeexec \Topic\")

RegKey.SetValue ("", "system")

RegKey = Registry.Classe sRoot.CreateSub Key("Applicatio ns\" & EXE_FILE &
"\shell\open\co mmand\")

RegKey.SetValue ("", DEFAULT_OPEN_CO MMAND)

RegKey = Registry.Classe sRoot.CreateSub Key(FILE_EXTENT ION_TO_ASSOCIAT E)

RegKey.SetValue ("", EXE_NAME & "_auto_file ")

End Function

Example:::

CMG.associatefi le(".CMGCHECK" , "CMG CHECKING FILE", "CMGGHECK",
"CMGCHECK.E XE", """" & System.Windows. Forms.Applicati on.ExecutablePa th & """
""%1""", "shell32.dll,44 ", "CHECK CMG DATABASE")
"Armin Zingler" <az*******@free net.de> schreef in bericht
news:%2******** ********@TK2MSF TNGP10.phx.gbl. ..
"CMG" <vb****@divx-warez.nl> schrieb
No it doesn't, it just set's a normal string value, try it, and
check ur registry ;) The registry does not say DWORD, it just says
normal value

No, it says DWORD. Really, I checked it. To be exact, the type column says
"REG_DWORD" .

Here's a screenshot:
EditFlags REG_DWORD 0x00000000 (0)

;-)
--
Armin

http://www.plig.net/nnq/nquote.html
http://www.netmeister.org/news/learn2quote.html

Nov 20 '05 #6
* "Armin Zingler" <az*******@free net.de> scripsit:
Here's a screenshot:
EditFlags REG_DWORD 0x00000000 (0)


;-)))

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>
Nov 20 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

6
22315
by: Lee K | last post by:
This is not strictly a C++ issue but if anyone will know the answer its you guys! I am trying to figure out a date format stored in the registry by a piece of software (I am trying to write something to enable me to script a configuration). The program stores a createdate for a set of registry keys held in a DWORD value. I assumed it would be the number of seconds since epoch (1/1/1970 00:00:00) - but its not. Here is a couple of ...
1
5749
by: ChuckD_Duncan | last post by:
using Microsoft.Win32; RegistryKey key = Registry.LocalMachine; key = key.OpenSubKey("....."); ... key = key.OpenSubKey("PCF", true); double aDoubleValue = 0.25; key.SetValue("testkey", aDoubleValue); testkey pre-existed as a DWORD value and after the setvalue becomes a REG_SZ type. Even tried casting the aDoubleValue, but no change.
1
16328
by: rdavis7408 | last post by:
I have a database that has a form that opens a report using date parameters. I have been using it for six months and last week I began to get the following Error Message: "File sharing lock count exceeded. Increase MaxLocksPerFile registry entry." I checked in the Tools - Options - Advance. I have the database shared with no locks selected and record level locking selected.
1
1289
by: Dixie | last post by:
Are there any MVPs out there who can produce a registry patch for this. 1. Click Start, click Run, type regedit, and then click OK. 2. Locate and then click the following subkey: HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\HTMLHelp\1.x\ItssRestrictions If this registry subkey does not exist, create it. 3. Right-click the ItssRestrictions subkey, point to New, and then click DWORD Value. 4. Type MaxAllowedZone, and then press Enter. 5....
3
4620
by: Steve Montgomery | last post by:
Does anyone have a sample block of code they can share for checking a DWORD value on a remote network machine's registry? For example, to validate a patch deployment. MSDN has a great sample for access the local registry bur I'd like to mount several remote registry to check a specific key for a DWORD value. Thanks, Steve
3
1314
by: Joe Delphi | last post by:
Hi, I want to store non-string values in the registry. I have a few Boolean flags and some integer numbers that I want to store. It appears that the SaveSettings command only handles the saving of string values to the registry. Is there some other command that I should use to save Boolean or Integer values to the registry?
3
10111
by: Bomber | last post by:
Hi all, I have this code Option Explicit Private Declare Function RegOpenKey Lib "advapi32.dll" Alias "RegOpenKeyA" (ByVal hkey As Long, ByVal lpSubKey As String, phkResult As Long) As Long Private Declare Function RegCloseKey Lib "advapi32.dll" (ByVal hkey As Long) As Long Private Declare Function RegSetValueEx Lib "advapi32.dll" Alias "RegSetValueExA" (ByVal hkey As Long, ByVal lpValueName As String, ByVal Reserved As Long, ByVal...
0
1802
by: chaitanya15 | last post by:
How can i create a new DWORD value in windows registry using java. Can any one post a sample syntax and explain? I would like to modify the registry values.
0
9528
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10456
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10174
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
7548
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6788
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5575
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4118
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3731
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2926
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.