Recent

Author Topic: Quick question  (Read 6030 times)

StaticStupid

  • New Member
  • *
  • Posts: 31
Quick question
« on: February 19, 2011, 03:17:52 am »
Why when i run my program from [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run-] registry its bugged, for example it launches, but:

1. I have button which increases my form's width and height,
when i clicking it, nothing happens.
2. On form close i have my current form position to be saved in .ini file, it shows error.
3. I have some text files, which TStringList loading when program will start, it shows error again.

Problem is maybe the path, but how to fix it?


DirkS

  • Sr. Member
  • ****
  • Posts: 251
Re: Quick question
« Reply #1 on: February 19, 2011, 09:19:09 am »
Are you sure about that minus at the end of the key? Programs listed in that section should not start at all. I think it's used by msconfig (and other programs) to 'store' deactivated startup programs.

Gr.
Dirk.

StaticStupid

  • New Member
  • *
  • Posts: 31
Re: Quick question
« Reply #2 on: February 19, 2011, 02:16:58 pm »
ok i changed it to:

[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run]

same happens:

1. My code is:
Code: [Select]
with TStringlist.Create do
  begin
  Loadfromfile('DaySchedule\Monday');
  Form1.memo1.caption:=Text;

Its possible the .exe to not read his own folder?

marcov

  • Administrator
  • Hero Member
  • *
  • Posts: 12851
  • FPC developer.
Re: Quick question
« Reply #3 on: February 19, 2011, 02:36:13 pm »
Probably the way it is run doesn't set the current directory to the directory of the binary.

You can work around this on Windows by using extractfilepath(paramstr(0)) as base directory. This won't work on all platforms (e.g. OS X and FreeBSD don't, as well as some embedded Linux versions)

StaticStupid

  • New Member
  • *
  • Posts: 31
Re: Quick question
« Reply #4 on: February 21, 2011, 04:19:48 pm »
Ok it works, but can u write me now a example for how to create new registry which will add my program in that registry? (Yeah i need registry for Start up, i manually created it, but i want my program to do it)

StaticStupid

  • New Member
  • *
  • Posts: 31
Re: Quick question
« Reply #5 on: February 22, 2011, 03:51:55 pm »
bump


 

TinyPortal © 2005-2018