Recent

Author Topic: Run app with windows starup error.  (Read 4920 times)

nocuttree

  • New Member
  • *
  • Posts: 36
Run app with windows starup error.
« on: October 13, 2014, 08:42:42 am »
Hello all! I have run an app with windows starup, it has showed a message error "File not found" (My app work with a text file) but no error when I run app manual by mouse click.
Thanks all!
Sorry my English, Windows xp, Lazarus 1.2.2!

CM630

  • Hero Member
  • *****
  • Posts: 1082
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Run app with windows starup error.
« Reply #1 on: October 13, 2014, 09:23:55 am »
I would recommend you not to use the debugger section of the forum for all your threads, especially for those, which are not related to the debugger.
Posting some of your code would be useful, I would say it's must.
May the reason for the "File not found" error is that you are not supplying the full path to it. When you run the app by a mouse click, it probably searches the file in its own directory, while the properties of the shortcut in your start menu do not point to the same folder.
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

nocuttree

  • New Member
  • *
  • Posts: 36
Re: Run app with windows starup error.
« Reply #2 on: October 13, 2014, 01:26:32 pm »
I would recommend you not to use the debugger section of the forum for all your threads, especially for those, which are not related to the debugger.
Posting some of your code would be useful, I would say it's must.
May the reason for the "File not found" error is that you are not supplying the full path to it. When you run the app by a mouse click, it probably searches the file in its own directory, while the properties of the shortcut in your start menu do not point to the same folder.
I am sorry! but i can't know where to post my threads  :(
How can I remove my threats?
My code is very simple.
Code: [Select]
assignfile(st, 'settings');           
Sorry my English, Windows xp, Lazarus 1.2.2!

minesadorada

  • Sr. Member
  • ****
  • Posts: 452
  • Retired
Re: Run app with windows starup error.
« Reply #3 on: October 13, 2014, 02:18:04 pm »

My code is very simple.
Code: [Select]
assignfile(st, 'settings');           
Is this code in a Form.Create() of your main form?  If so, move it to Form.Show()

If it is a console app, it could be that your app is starting up before Windows is 'ready' to read/write the file.

Putting the code in a Try..Except block and running in debugging mode may help to find the problem.

No other insights, I'm afraid..
GPL Apps: Health MonitorRetro Ski Run
OnlinePackageManager Components: LazAutoUpdate, LongTimer, PoweredBy, ScrollText, PlaySound, CryptINI

User137

  • Hero Member
  • *****
  • Posts: 1791
    • Nxpascal home
Re: Run app with windows starup error.
« Reply #4 on: October 13, 2014, 06:12:20 pm »
Right click on the shortcut that launches your app, open properties and set its working directory to location of the executable.

CM630

  • Hero Member
  • *****
  • Posts: 1082
  • Не съм сигурен, че те разбирам.
    • http://sourceforge.net/u/cm630/profile/
Re: Run app with windows starup error.
« Reply #5 on: October 14, 2014, 08:54:40 am »
I am sorry! but i can't know where to post my threads  :(

 

So if you cannot determine the right section for your post, use General.
Better positioning of the section is likely to provide a faster answer.
 

How can I remove my threats?
 

AFAIK, you can delete it, but only moderators and admins can move it.
 


My code is very simple.
Code: [Select]
assignfile(st, 'settings');           
And still that is not all your code. What is the value of st? You should use the full file path for the st variable (i.e. c:\myfile\alabala.txt). You might experience some troubles when using non-basic Latin characters. In that case assignfile(utf8tosys(st), 'settings'); might solve your problem.
Лазар 3,2 32 bit (sometimes 64 bit); FPC3,2,2; rev: Lazarus_3_0 on Win10 64bit.

nocuttree

  • New Member
  • *
  • Posts: 36
Re: Run app with windows starup error.
« Reply #6 on: October 14, 2014, 02:39:13 pm »
I am sorry! but i can't know where to post my threads  :(

 

So if you cannot determine the right section for your post, use General.
Better positioning of the section is likely to provide a faster answer.
 

How can I remove my threats?
 

AFAIK, you can delete it, but only moderators and admins can move it.
 


My code is very simple.
Code: [Select]
assignfile(st, 'settings');           
And still that is not all your code. What is the value of st? You should use the full file path for the st variable (i.e. c:\myfile\alabala.txt). You might experience some troubles when using non-basic Latin characters. In that case assignfile(utf8tosys(st), 'settings'); might solve your problem.
Right click on the shortcut that launches your app, open properties and set its working directory to location of the executable.

My code is very simple.
Code: [Select]
assignfile(st, 'settings');           
Is this code in a Form.Create() of your main form?  If so, move it to Form.Show()

If it is a console app, it could be that your app is starting up before Windows is 'ready' to read/write the file.

Putting the code in a Try..Except block and running in debugging mode may help to find the problem.

No other insights, I'm afraid..
Thanks you very much!
Sorry my English, Windows xp, Lazarus 1.2.2!

 

TinyPortal © 2005-2018