Thread: [Dev-C++] More Version checking
Open Source C & C++ IDE for Windows
Brought to you by:
claplace
From: <ti...@ne...> - 2001-06-18 10:06:14
|
thanks Derek for the reply. I imagined it would probably have something = to do with the registry, but i checked through everything in the = regedit.exe program but acrobat reader doesn't seem to have a version = value. Can you or anybody else think of another technic? And do you = know how to get values from the registry thanks for you time everyone tim |
From: Steve D. P. <ste...@ho...> - 2001-06-18 17:09:29
|
I don't have first-hand experience with using any library that = provides for Windows registry manipulation... but I do have Acrobat = Reader installed on my hard drive, and immediately found the registry = key: \\HKEY_LOCAL_MACHINE\SOFTWARE\Adobe\Acrobat Reader Cheers, Steve ----- Original Message -----=20 From: tim@netfactoriel=20 To: devcpp=20 Sent: Monday, June 18, 2001 5:57 AM Subject: [Dev-C++] More Version checking thanks Derek for the reply. I imagined it would probably have = something to do with the registry, but i checked through everything in = the regedit.exe program but acrobat reader doesn't seem to have a = version value. Can you or anybody else think of another technic? And do = you know how to get values from the registry thanks for you time everyone tim |
From: Bruno B. <bbe...@cl...> - 2001-06-18 20:58:47
|
Hi ! Here is a sample code for version checking: #include <stdio.h> #include <windows.h> #include <winreg.h> #define BufferSize 255 void NoAR() { printf("Acrobat Reader is not installed\n"); exit(); } int main(int argc, char *argv[]) { PHKEY hKey, hKeyAdobe,hKeyAcrobatR; LONG Result; WORD iSubKey=0; char Buffer[BufferSize]; /* check for the key "software" */ Result=RegOpenKeyEx(HKEY_LOCAL_MACHINE,"software",0,KEY_READ,&hKey); /* all right then look for the "Adobe" subkey */ if (Result==ERROR_SUCCESS) { Result=RegOpenKeyEx(hKey,"Adobe",0,KEY_READ,&hKeyAdobe); if (Result!=ERROR_SUCCESS) NoAR(); Result=RegOpenKeyEx(hKeyAdobe,"Acrobat Reader",0,KEY_READ,&hKeyAcrobatR); if (Result!=ERROR_SUCCESS) NoAR(); /*print all the subkeys */ while(Result!=ERROR_NO_MORE_ITEMS) { Result=RegEnumKey(hKeyAcrobatR,iSubKey, Buffer, BufferSize); printf("%s\n", Buffer); iSubKey++; }; } else printf("No Software key\n"); return 0; } |
From: <ti...@ne...> - 2001-06-19 07:32:53
|
Thank you very much for all your help on version checking. Specially Steve Perkins and Bruno Berteau Cheers Folks tim |
From: Wendel <we...@ha...> - 2001-06-20 13:05:29
|
Hi all, I'm trying learn how to access the registry. I saw a document with a fast explanation that work for win9x and NT. But don't give examples. What i need to access the registry ?? example to read keys, list keys, subkeys, create keys, delete keys, ... ?? Can somebody give me a example ?? I need use dll of windows ? API ?? How to use it in dev-c++ ? thkz [ ]'s |
From: <ti...@ne...> - 2001-06-20 13:40:57
|
Try this link: http://msdn.microsoft.com/library/psdk/winbase/regapi_59mb.htm Tim ----- Original Message ----- From: "Wendel" <we...@ha...> To: <dev...@li...> Sent: Wednesday, June 20, 2001 3:07 PM Subject: [Dev-C++] Access Registry. > Hi all, > > I'm trying learn how to access the registry. I saw a document with a fast > explanation that work for win9x and NT. But don't give examples. What i need > to access the registry ?? example to read keys, list keys, subkeys, create > keys, delete keys, ... ?? > > Can somebody give me a example ?? > > I need use dll of windows ? API ?? How to use it in dev-c++ ? > > thkz > > [ ]'s > > > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > http://lists.sourceforge.net/lists/listinfo/dev-cpp-users |
From: Wendel <we...@ha...> - 2001-06-20 15:45:46
|
Hello Tim, > Try this link: > http://msdn.microsoft.com/library/psdk/winbase/regapi_59mb.htm > I tryed ... it!! and have some explanations/examples! Then i tryed it in my dev-c++ and...! look: This structure of program work very well. compiled! #include <stdio.h> int main() { return(0); } But if i try put the code prom open a key in registry.... #include <stdio.h> #include <Winreg.h> //Header: Declared in Winreg.h; include Windows.h. #include <Windows.h> // i put this 2 headers as is needed in the text. int main() { LONG RegCreateKeyEx( HKEY HKEY_USERS\wendel_test return(0); } When i try compile i recive: 2 f:\dev-c_~1\untitl~1.cpp F:\DEV-C_~1\Include\Winreg.h:35: syntax error before `;' 37 f:\dev-c_~1\include\winreg.h syntax error before `;' 38 f:\dev-c_~1\include\winreg.h syntax error before `;' 39 f:\dev-c_~1\include\winreg.h syntax error before `;' 40 f:\dev-c_~1\include\winreg.h syntax error before `;' 43 f:\dev-c_~1\include\winreg.h syntax error before `;' 44 f:\dev-c_~1\include\winreg.h syntax error before `;' 45 f:\dev-c_~1\include\winreg.h syntax error before `;' 46 f:\dev-c_~1\include\winreg.h syntax error before `;' 48 f:\dev-c_~1\include\winreg.h syntax error before `AbortSystemShutdownA' 49 f:\dev-c_~1\include\winreg.h syntax error before `AbortSystemShutdownW' 50 f:\dev-c_~1\include\winreg.h syntax error before `InitiateSystemShutdownA' 51 f:\dev-c_~1\include\winreg.h syntax error before `InitiateSystemShutdownW' 52 f:\dev-c_~1\include\winreg.h syntax error before `RegCloseKey' 53 f:\dev-c_~1\include\winreg.h syntax error before `RegConnectRegistryA' 54 f:\dev-c_~1\include\winreg.h syntax error before `RegConnectRegistryW' 55 f:\dev-c_~1\include\winreg.h syntax error before `RegCreateKeyA' 56 f:\dev-c_~1\include\winreg.h syntax error before `RegCreateKeyExA' 57 f:\dev-c_~1\include\winreg.h syntax error before `RegCreateKeyExW' 58 f:\dev-c_~1\include\winreg.h syntax error before `RegCreateKeyW' 59 f:\dev-c_~1\include\winreg.h syntax error before `RegDeleteKeyA' 60 f:\dev-c_~1\include\winreg.h syntax error before `RegDeleteKeyW' 61 f:\dev-c_~1\include\winreg.h syntax error before `RegDeleteValueA' 62 f:\dev-c_~1\include\winreg.h syntax error before `RegDeleteValueW' 63 f:\dev-c_~1\include\winreg.h syntax error before `RegEnumKeyA' 64 f:\dev-c_~1\include\winreg.h syntax error before `RegEnumKeyW' 65 f:\dev-c_~1\include\winreg.h syntax error before `RegEnumKeyExA' 66 f:\dev-c_~1\include\winreg.h syntax error before `RegEnumKeyExW' 67 f:\dev-c_~1\include\winreg.h syntax error before `RegEnumValueA' 68 f:\dev-c_~1\include\winreg.h syntax error before `RegEnumValueW' 69 f:\dev-c_~1\include\winreg.h syntax error before `RegFlushKey' I saw too in the End of text the warning: Library: Use Advapi32.lib. Need i of this to my prog work ?? How to use it Advapi32.lib ?? For what i use it ?? It is a API ? What i'm doing wrong ?? Help me please! Sorry for my poor english. Best Regards. [ ]'s > > Tim > |
From: Elias P. <eli...@ao...> - 2001-06-20 16:10:43
|
> > Try this link: > > http://msdn.microsoft.com/library/psdk/winbase/regapi_59mb.htm > > ... > > But if i try put the code prom open a key in registry.... > > #include <stdio.h> > #include <Winreg.h> //Header: Declared in Winreg.h; include Windows.h. > #include <Windows.h> // i put this 2 headers as is needed in the text. > > int main() > { > LONG RegCreateKeyEx( > HKEY HKEY_USERS\wendel_test > return(0); > } > > When i try compile i recive: ... You can't use #include <Winreg.h> with Dev-C++. Just delete that line. For the use of RegCreateKeyEx, at the link in the beginning of this message, you will find links to some examples. |
From: <we...@ha...> - 2002-07-23 21:01:45
|
Hi, I want to flush (delete) a string value from registry. I tryed to set it to 0 of this mode: #include <windows.h> int main(int argc, char *argv[]) { HKEY hKey; DWORD dwDisposition; unsigned char *szBuf = (unsigned char *)strdup("0"); if (RegSetValueEx(HKEY_CURRENT_USER, "\\Software\\Microsoft\\Security\\say\\", 0, REG_SZ, szBuf, strlen((char*)szBuf)) != ERROR_SUCCESS) return 1; RegCloseKey(hKey); return 0; } But it didn't set the value of: \\HKEY_CURRENT_USER\\Software\\Microsoft\\Security\\say to "0". It crate a key \\Software\\Microsoft\\Security\\say in \\HKEY_CURRENT_USER . :P How to do to is set this value ?? And how to for example delete a key \\Software\\Microsoft\\Security\\say\\ ?? Can someone gave examples ?? :) Thkz and Best Regards. [ ]'s |
From: <we...@ha...> - 2002-07-24 14:58:39
|
Hi, I want to flush (delete) a string value from registry. I tryed to set it to 0 of this mode: #include <windows.h> int main(int argc, char *argv[]) { HKEY hKey; DWORD dwDisposition; unsigned char *szBuf = (unsigned char *)strdup("0"); if (RegSetValueEx(HKEY_CURRENT_USER, "\\Software\\Microsoft\\Security\\say\\", 0, REG_SZ, szBuf, strlen((char*)szBuf)) != ERROR_SUCCESS) return 1; RegCloseKey(hKey); return 0; } But it didn't set the value of: \\HKEY_CURRENT_USER\\Software\\Microsoft\\Security\\say to "0". It crate a key \\Software\\Microsoft\\Security\\say in \\HKEY_CURRENT_USER . :P How to do to is set this value ?? And how to for example delete a key \\Software\\Microsoft\\Security\\say\\ ?? Can someone gave examples ?? :) Thkz and Best Regards. [ ]'s |
From: Bruno B. <bbe...@cl...> - 2001-06-20 16:25:24
|
Hello, You only have to include windows.h before winreg.h. #include <stdio.h> #include <windows.h> #include <winreg.h> Bruno Berteau |
From: Wendel <we...@ha...> - 2001-09-10 19:54:35
|
Hi, I have and use DEV-C++ with last snap-shot. But i tryed compile this program in .C that i recive and i recived this errors: When i tryed compile it here with Dev-c++ compiler it return me the errors: 17 c:\mf\release\reghide.c c:\mf\release\reghide.h:9: redefinition of `ULONG' 29 f:\dev-c_~1\include\winnt.h `ULONG' previously declared here 10 c:\mf\release\reghide.h redefinition of `USHORT' 28 f:\dev-c_~1\include\winnt.h `USHORT' previously declared here But, who sent me ... spoken that it compile very well in Visual C++ 6.0!! Why ??? VC++ 6.0 have some support best that Dev-C++ ?? Or is more complete ?? thkz [ ]'s |
From: Ioannis V. <no...@ya...> - 2001-09-10 20:43:47
|
The opposite happens. Dev-C++'s MINGW compiler is more ANSI compliant than VC++ (which is 4 years old). Send us the code so as to understand what is wrong. Ioannis * Ioannis Vranos * Programming pages: http://www.noicys.f2s.com * Alternative URL: http://run.to/noicys > -----Original Message----- > From: dev...@li...=20 > [mailto:dev...@li...] On Behalf Of Wendel > Sent: Monday, September 10, 2001 9:57 PM > To: dev...@li... > Subject: [Dev-C++] Dev-C++ and VC++ 6.0 >=20 >=20 > Hi, >=20 > I have and use DEV-C++ with last snap-shot. >=20 > But i tryed compile this program in .C that i recive and i=20 > recived this > errors: >=20 > When i tryed compile it here with Dev-c++ compiler it return=20 > me the errors: >=20 > 17 c:\mf\release\reghide.c > c:\mf\release\reghide.h:9: redefinition of `ULONG' >=20 > 29 f:\dev-c_~1\include\winnt.h > `ULONG' previously declared here >=20 > 10 c:\mf\release\reghide.h > redefinition of `USHORT' >=20 > 28 f:\dev-c_~1\include\winnt.h > `USHORT' previously declared here >=20 >=20 > But, who sent me ... spoken that it compile very well in=20 > Visual C++ 6.0!! Why ??? >=20 > VC++ 6.0 have some support best that Dev-C++ ?? Or is more complete ?? >=20 > thkz >=20 > [ ]'s >=20 >=20 > _______________________________________________ > Dev-cpp-users mailing list > Dev...@li... > https://lists.sourceforge.net/lists/listinfo/dev-cpp-users >=20 |
From: <We...@ha...> - 2001-10-02 12:42:25
|
Hi, I'm with a stupid problem! ;) When i open the Dev-C++ in my Win2k, i create a new project or open a project it show me the error: Could not create Code Cinoketion list file What is it ?? How to fix ?? Why it happends?? Thkz. Best Regards. [ ]'s |
From: <We...@ha...> - 2001-10-03 12:00:57
|
Hi, I'm with a stupid problem! ;) When i open the Dev-C++ in my Win2k, i create a new project or open a project it show me the error: Could not create Code Cinoketion list file What is it ?? How to fix ?? Why it happends?? Thkz. Best Regards. [ ]'s |
From: Bruno B. <bbe...@cl...> - 2001-06-20 16:40:12
|
Hello again, The line ' HKEY HKEY_USERS\wendel_test ' is wrong. You can't do that. HKEY is a registry key handle not the key's name. Bruno Berteau |
From: Wendel <we...@ha...> - 2001-06-21 02:51:01
|
Hello Guy, I recived 4 messages ... and the answers are very different .... answers: 2) > The line ' HKEY HKEY_USERS\wendel_test ' is wrong. You can't do that. HKEY is a > registry key handle not the key's name. 3) You can't use #include <Winreg.h> with Dev-C++. Just delete that line. For the use of RegCreateKeyEx, at the link in the beginning of this message, you will find links to some examples. 4) It work very well here. Then i try do the changes in my program ... the nunbem of erros is low ... but don't work yet ... :-/ In the second case, spoken that handle isn't the key name. But i translate to my lenguague and handle is a work that don't do sense for me, unhappyly! :-/ What is the handle ?? Can you show me a correct value that must i use to i work, in the contrary of the ' HKEY HKEY_USERS\wendel_test ' ?? In the first case, it is a good help for me ... my errors down only for two erros: #include <stdio.h> #include <windows.h> //Header: Declared in Winreg.h; include Windows.h. #include <winreg.h> // i put this 2 headers as is needed in the text. int main() { LONG RegCreateKeyEx( HKEY HKEY_USERS\wendel_test return(0); } 8 f:\dev-c_~1\untitl~1.cpp parse error before `0x80000003' 8 f:\dev-c_~1\untitl~1.cpp stray '\' in program What is the error stray '\' in program ?? is it when i used "return(0);" ?? Why ? In the trirth case, i comment the line "#include <winreg.h>" and it up 4 errors and don't show me a link to examples. And in the 4 case, it don't work here!! hehehe =] ps.: Thkz again for all help. [ ]'s Best Regards. |
From: Lorenzo <co...@in...> - 2001-06-21 09:28:01
|
This is an example for set key in registry: #include <windows.h> int main(int argc, char *argv[]) { HKEY hKey; DWORD dwDisposition; unsigned char *szBuf = (unsigned char *)strdup("lorenzo"); if (RegCreateKeyEx(HKEY_CURRENT_USER, "test", 0, "REG_SZ", REG_OPTION_NON_VOLATILE, KEY_ALL_ACCESS, 0, &hKey, &dwDisposition) != ERROR_SUCCESS) return 1; if (RegSetValueEx(hKey, "string", 0, REG_SZ, szBuf, strlen((char*)szBuf)) != ERROR_SUCCESS) return 1; RegCloseKey(hKey); return 0; } This program open or create if not exist the key "test" in key HKEY_CURRENT_USER and create string value "string" with value "lorenzo". This is an example for get key in registry: #include <windows.h> int main(int argc, char *argv[]) { HKEY hKey; DWORD dwType; DWORD dwLen; unsigned char szBuf[255] = {0}; if (RegOpenKeyEx(HKEY_CURRENT_USER, "test", 0, KEY_ALL_ACCESS, &hKey) != ERROR_SUCCESS) return 1; if (RegQueryValueEx(hKey, "string", 0, &dwType, szBuf, &dwLen) != ERROR_SUCCESS) return 1; RegCloseKey(hKey); return 0; } This program open the existing key "test" and read value from string value "string", copy it into szBuf, the size of string is stored into dwLen and the type of value key is stored into dwType. I hope this can help you. ---------------------------------------------------------------------------- --- If debugging is the process of removing bugs, then programming must be the process of putting them in. ---------------------------------------------------------------------------- --- |
From: Wendel <we...@ha...> - 2001-06-21 13:40:22
|
Hello Guy, Thkz for all people!! :) Best Regards, [ ]'s |
From: Wendel <we...@ha...> - 2001-07-17 17:19:45
|
Hi, I'm trying to use the system() function in dev-c++ ... but it don't work .... I was trying of this mode: #include <stdio.h> #include <conio.h> int main() { char var[15]; printf("\nType the environment that u want see the value: "); scanf("%s",&var); system("echo %s",var); return(0); } Then when i try compile this program i get the error: 16 f:\dev-c_~1\untitl~1.cpp implicit declaration of function `int system(...)' Why ?? The system() is a function of stdio.h ?? why it don't work ... please show me the correct mode ... if i'm making something wrong ... thkz Cheers [ ]'s |
From: Luigi S. <gi...@li...> - 2001-07-17 18:09:16
|
First: when you need the function "system" you should include <stdlib.h>. then the prototype of "system" says: int system(const char *s); this means that you are allowed to pass only one string to "system", in other words: "system" resembles "puts" and not "printf". Try the following: --- #include <stdio.h> #include <stdlib.h> #include <string.h> #define MAX_BUF 50 /* "echo " and var will surely fit in it */ int main() { char var[15]; char buf[MAX_BUF]; printf("\nType the environment that u want see the value: "); scanf("%s",&var); strcpy(buf, "echo "); strcat(buf, var); system(buf); return(0); } At 14.21 17/07/01 -0300, you wrote: >Hi, > >I'm trying to use the system() function in dev-c++ ... but it don't work >.... > >I was trying of this mode: > >#include <stdio.h> >#include <conio.h> > >int main() >{ > char var[15]; > > printf("\nType the environment that u want see the value: "); > scanf("%s",&var); > > system("echo %s",var); > > return(0); >} > >Then when i try compile this program i get the error: > >16 f:\dev-c_~1\untitl~1.cpp > implicit declaration of function `int system(...)' > > >Why ?? The system() is a function of stdio.h ?? why it don't work ... please >show me the correct mode ... if i'm making something wrong ... > >thkz > >Cheers > >[ ]'s > > >_______________________________________________ >Dev-cpp-users mailing list >Dev...@li... >http://lists.sourceforge.net/lists/listinfo/dev-cpp-users --- gisan |
From: Nurhidayat <dh...@ma...> - 2001-07-18 05:45:56
|
>I'm trying to use the system() function in dev-c++ ... but it don't work >.... >Why ?? The system() is a function of stdio.h ?? why it don't work ... please >show me the correct mode ... if i'm making something wrong ... system() is a function of stdlib.h ___Nurhidayat___ |