source: main/tags/2.31/gsdl/src/checkis/checkis.cpp@ 25382

Last change on this file since 25382 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
Line 
1#include <windows.h>
2#include <stdlib.h>
3#include <stdio.h>
4#include <string.h>
5#include <memory.h>
6#pragma hdrstop
7
8int __stdcall WinMain(HINSTANCE Instance, HINSTANCE /*PrevInstance*/, LPSTR CmdLineStr, int /*CmdShow*/) {
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) {
16 if (RegOpenKey(hk2, "sjnew", &hk3) == ERROR_SUCCESS) {
17 if (RegOpenKey(hk3, "1", &hk4) == ERROR_SUCCESS) {
18 if (RegOpenKey(hk4, "2.26.000", &hk5) == ERROR_SUCCESS) {
19
20 if (RegOpenKey(hk3, "2.26.000", &lk) == ERROR_SUCCESS) {
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) {
31 // see if this is the right key (yes, this should always be library, NOT
32 // the name of the executable
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,
60 "Would you like to view the School Journal Collection?",
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.