PDA

View Full Version : writing eula data away


limboo
02-07-2009, 07:20 PM
what's wrong with this code??

it has to try another methode if the previous methode failed

INIFile.SetValue(WindowsFolder.."\\"..Name.." Eula 1.0.0.dat", "Eula", "Accepted Eula? 1 means yes ", "1");
val = INIFile.GetValue(_WindowsFolder.."\\"..Name.." Eula 1.0.0.dat", "Eula", "Accepted Eula? 1 means yes ");

if (val == "") then
Registry.SetValue(HKEY_CURRENT_USER, "Software\\"..Name.." Eula 1.0.0", "Accepted Eula? 1 means yes", "1", REG_DWORD);
val1 = Registry.GetValue(HKEY_CURRENT_USER, "Software\\"..Name.." Eula 1.0.0", "Accepted Eula? 1 means yes", true);
elseif (val == "1") then
Page.Jump("Encrypt");


if (val1 == "") then
INIFile.SetValue(ProgramFolder.."\\"..Name.." Eula 1.0.0.dat", "Eula", "Accepted Eula? 1 means yes ", "1");
val2 = INIFile.GetValue(ProgramFolder.."\\"..Name.." Eula 1.0.0.dat", "Eula", "Accepted Eula? 1 means yes ");
elseif (val1 == "1") then
Page.Jump("Encrypt");


if (val2 == "") then
Dialog.Message("Error", "There was an error writing the eula data. Try it again with Administrator rights.\r\n\r\n The application will now terminate.", MB_OK, MB_ICONEXCLAMATION, MB_DEFBUTTON1)
Application.Exit(0);
elseif (val2 == "1") then
Page.Jump("Encrypt");
end
end
end

RizlaUK
02-07-2009, 07:34 PM
your if/else/end sturcture is wrong

it must be
if something then

elseif somethingelse then

elseif somethingelse2 then

end-- notice, only 1 end for the whole block

you have
if something then

elseif somethingelse then

if something then


end
end

see the problem ?, you have a block within a block

also, i would stay away from the registry for data like this, you are sure to run into problems, store the data in a common unprotected ares like application data folders and you will not have any problems, since iv had vista iv noticed a few bugs in some of my apps where im storeing data in the app folder or registry

limboo
02-07-2009, 07:36 PM
tried that one already but still no good

ShadowUK
02-08-2009, 12:10 AM
tried that one already but still no good

Well Gordon Freeman, I saw an example like this on amsuser.com, Check it out. It uses an INI as well.

limboo
02-08-2009, 05:15 AM
first it is gregory freeman :)
second what is the name of that project?