locked
A question about developing a desktop application RRS feed

  • Question

  • I wrote a simple dialog based MFC application. and load ico and png files,show them on the dialog.
    the application runs well when I double click the exe file.

    Then I wrote a bat file to run the application when The windows system startup(in user's startup folder).
    then the ico and png would not show(occationally on different pc, but once it occured , it alway occurs, on the other way, double click would always run well).

    the bat file way would be ok, when I do logoff operate, but reboot will go bad.

    could any body explain the reason for me?

    Thanks a lot!!!!

    running system is windows 10 x64;
    dev system is windows 7 x64;
    IDE vs2017 community.

    Monday, July 13, 2020 5:13 AM

All replies

  • Hello,

    how do you load your files? You should check the work path. Normally, when you double click the exe, the working path is the directory of the exe. Maybe you must call "cd <exe file path>" to set the actual directory of the exe before you call the exe.

    Regards, Guido

    Monday, July 13, 2020 5:46 AM
  • Thank you for replying.

    I write cd commnad to the directory of my application.

    and I deploy the applications & bat file into about 20 PCs, but  2 of them apperred to run out with the problem, the others goes well .

    of course I'm sure about the ico and png file are existed too.

    I  doubt if there are some system setting differences, due to the automatically update function.

    the safty policies about running bat file.

    Monday, July 13, 2020 6:03 AM
  • and I deploy the applications & bat file into about 20 PCs, but  2 of them apperred to run out with the problem, the others goes well .

    of course I'm sure about the ico and png file are existed too.

    I  doubt if there are some system setting differences, due to the automatically update function.

    the safty policies about running bat file.

    So it is not a Visual C++ source code problem. It is probably no batch file problem too. IMO it is a Windows 10 settings problem which occurs (as you said) only on some PCs. You should ask in a Windows 10 or Scripting forum.

    For example:

    https://answers.microsoft.com/en-us/windows/forum/windows_10

    Regards, Guido

    Monday, July 13, 2020 6:12 AM
  • Thank you!

    I would try to post this question there.

    Monday, July 13, 2020 7:14 AM
  • [...]

    I write cd commnad to the directory of my application.

    [...]

    Did you specify the /D option: ‘cd /D path’?


    Monday, July 13, 2020 7:53 AM
  • cd D:\Monitor\
    start/min runMonitor.bat

    here the command is, the start bat file exists in d:\appbat\

    Wednesday, July 15, 2020 12:34 AM
  • Thank you!
    Wednesday, July 15, 2020 12:35 AM