source: trunk/gsdl/src/checkis/checkis.cpp@ 3036

Last change on this file since 3036 was 1632, checked in by sjboddie, 24 years ago

* empty log message *

  • Property svn:keywords set to Author Date Id Revision
File size: 1.9 KB
RevLine 
[906]1#include <windows.h>
2#include <stdlib.h>
3#include <stdio.h>
4#include <string.h>
5#include <memory.h>
6#pragma hdrstop
7
[1632]8int __stdcall WinMain(HINSTANCE Instance, HINSTANCE /*PrevInstance*/, LPSTR CmdLineStr, int /*CmdShow*/) {
[906]9 HKEY hk1, hk2, hk3, hk4, hk5, lk;
10 char command[2048];
11 command[0] = '\0';
12
13 // try to find the command to start the library
14 if (RegOpenKey(HKEY_LOCAL_MACHINE, "SOFTWARE", &hk1) == ERROR_SUCCESS) {
15 if (RegOpenKey(hk1, "Waikato University", &hk2) == ERROR_SUCCESS) {
[1632]16 if (RegOpenKey(hk2, "sjnew", &hk3) == ERROR_SUCCESS) {
[906]17 if (RegOpenKey(hk3, "1", &hk4) == ERROR_SUCCESS) {
[1632]18 if (RegOpenKey(hk4, "2.26.000", &hk5) == ERROR_SUCCESS) {
[906]19
[1632]20 if (RegOpenKey(hk3, "2.26.000", &lk) == ERROR_SUCCESS) {
[906]21
22 // look for the command to start the browser
23 DWORD dwIndex = 0;
24 char key[256];
25 key[0] = '\0';
26 DWORD keysize = 256;
27 DWORD type;
28 DWORD comsize = 2048;
29 while (RegEnumValue(lk, dwIndex, key, &keysize, NULL, &type,
30 (unsigned char *)command, &comsize) == ERROR_SUCCESS) {
[1632]31 // see if this is the right key (yes, this should always be library, NOT
32 // the name of the executable
[906]33 if (strcmp (key, "library") == 0) break;
34 else command[0] = '\0';
35
36 // prepare for next iteration
37 dwIndex++;
38 keysize = 256;
39 comsize = 2048;
40 }
41 RegCloseKey(lk);
42 }
43 RegCloseKey(hk5);
44 }
45 RegCloseKey(hk4);
46 }
47 RegCloseKey(hk3);
48 }
49 RegCloseKey(hk2);
50 }
51 RegCloseKey(hk1);
52 }
53
54 if (strlen (command) == 0) {
55 // not installed, try to run the setup program
56 WinExec ("setup.exe", SW_SHOW);
57 } else {
58 // installed ask the user whether they want to run the library now
59 if (MessageBox (NULL,
[1632]60 "Would you like to view the School Journal Collection?",
[906]61 "Greenstone Digital Library",
62 MB_YESNO) == IDYES) {
63 WinExec (command, SW_SHOW);
64 }
65 }
66
67 return 0;
68}
Note: See TracBrowser for help on using the repository browser.