Application starts too soon

G

Guest

First off thanks for all the help that got me this far! Got EWF working with
CF, sized the image down to fit the CF, etc. I now have an XPE image that can
boot to a command prompt (dosn't sound like much, but it took a while to get
there).

Anyway, my hope is to have the application start up after the command prompt
appears. I used the RunOnce Resource (put a batch file under the Run
registry value). Problem is it seems to start up before the command prompt
appears, and it fails since, when the prompt arrives, no application is
running. I know it tries to start since I have a video frame grabber and it's
window pops up during the "Welcome" screen. I had a similar problem with
Embedded NT, and a short sleep command (5 secs) in the batch file worked.
Doesn't seem to help here - tried up to 60 seconds!

So what do I do? I would like to keep the command prompt shell (at least
for now) so I can exit my program and run some commands to copy files etc.

Thanks,

SteveS
 
K

KM

SteveS,

It sounded like your application is a batch file (or you call the application form a batch file)? How do you start the batch?
If it is the batch file that does not start, use "cmd.exe /C <your_batch.bat>" command style to launch it.
If it is the application (exe), then you would need to understand why the application fails to run (dependencies, etc.). Can you
launch the exe from the command prompt?
Since we don't know anything about your app, it is hard to advise.

--
Regards,
KM, BSquare Corp.

PS. I wouldn't use "sleep" patch. It is always unreliable solution and will fail time to time when things (OS, hardware, software)
change.
 
G

Guest

I'm a bit surprised a Run item is processed when you're not running an
explorer shell. Maybe I'm thinking about RunOnce... But as to your problem,
I had a similar one. The machine was booting into a custom shell that was
expecting a network connection to exist. What we had was a sort-of race
condition where the program was competing with network services, and when the
program won, it would exit because there wasn't any network available. What
we did was create a batch file (later replaced with an MFC program) that
would check for the network for a predetermined time. If the network was
found, it would continue and execute the shell. If not, it would handle the
situation more gracefully. You might want to see if you can figure out what
your program is not fiding (resources, services, whatever) and do the same
thing.
 
G

Guest

Evidently I will need to do something similiar. What I don't get is why is
there not a method in XPE to wait to run an application until the OS is
fully loaded and the command shell is up and running? I've searched around
Windows XPE site and looked thru the two XPE books and found nothing on this
topic. It seems like once they walk you thru the getting a shell up, they
figure the job is done. Oh oh, I'm starting to rant.....

I've got several third party add-ons in my software, it may be difficult to
tell which is hanging up, how it's hanging up, and what do do to fix it.

- SteveS
 
S

Slobodan Brcin \(eMVP\)

Steve,

Books, are ok but what you really need is to use google groups to search
through this NG.

You will find all that you need here:
http://groups-beta.google.com/group...edded&q=CMP_WaitNoPendingInstallEvents&qt_g=1


Few hints:
1. Do not start bat file but start you small launch exe.
2. Do PnP Wait + Sleep method that I have described.
3. When all is loaded start your application.


BTW there is no way for OS to know when shell is started, this is concern of
each shell internal implementation. You here should use launch application
as shell.

Regards,
Slobodan
 
G

Guest

Thanks Slobodan,

I didn't realize that you could access this group thru Google. I still
think it is poor that the documention (books, or MS web site) doesn't
address something so basic as how to get an application to run at the right
time.

I see how your method may work, but isn't that a bit of a work-around? So
does everyone basically have to do this? Or am I mssing something
fundamental?

Biggest problem right now is I don't have the header file, so evidently I
need to get the DDK, then go from there, and my project is alraedy way behind.

This has become very frustrating, well - it jsut proves my adage - "It's
the simple things that are hard".

- SteveS
 
S

Slobodan Brcin \(eMVP\)

Steve,

You don't need the DDK to use API functions.

You can either use LoadLibrary API to load dll and then GetProcAddress to
dynamicaly access any function documented or undocumented.
Or you can make your def file and compile it to get small lib file if you
use C/C++.

In case of Delphi you have integrated mechnaism for accessing DLL's and lib
and h files from DDK would not work anyway.

I see how your method may work, but isn't that a bit of a work-around?
With XPe and custom shells most things you could treat as wanted
work-arounds by default.

So does everyone basically have to do this? Or am I mssing something
fundamental?

You are missing fundamental thing such that applications/services, drivers
are started as soon as possible and in paralel unless othervise told.
You need to know what you application is depending on and to wait for these
resources to be available.

It would be nice that MS made some functionality that would ease things for
people that want their shell to be executed as last thing in the system, and
you might express your wish:

http://msdn.microsoft.com/embedded/community/community/feedback/feedxp/default.aspx

Regards,
Slobodan
 
K

KM

Also keep in mind that on NT (and especially on XP where it was made more clear) the system boot process is explicitly distributed
over boot time.
I mean that some drivers (e.g., network to get dhcp address) are started functioning later in the boot phase when some UI is ready
for end user (I am not referring to Install events).
So it is sometimes hard to measure where the exact point when system is fully loaded. It is hard to define what is "full load".

But talking about GUI based Shell application it may sometimes be wise to wait until user input idle is ready. (WaitForInputIdle
API)
 
G

Guest

Ok, I'm learning. True, I can see where each app must decide when it is safe
to run. I just had a hard time believing there wasn't a better supported way
to do it in comand shell. I will propose to MS that they make a more obvious
and easier to use method (like Startup items in explorer).

In any case, I ended up using KM's idea of adding my app onto the startup of
cmd.exe ( cmd.exe /C myapp.exe ). That seems to work. I actually run a batch
file and added a short sleep time in there just in case. I also use the /K
switch so that I can exit my app and run some command line items if I need to.

Thanks all, I may have a functional system yet!

- SteveS


I guess I jsut couln't eblieve
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

CF boot issue 0
About Ewf Question 1
Windows XP Embedded Cloning - 2 Partitions Display 0
.NET 2.0 not installing - can't run ngen? 8
EWF Failed 1
How to set nopagefile in XPE 1
Windows 7 Help with setting up HORM 0
boot with CF is slow 2

Top