Can anyone enlighten a poor, stupid soul how to make a Fortan executable (console application) run as a minimized icon in the taskbar?
Well, the simplest way to do it is from "outside". Simply, in the "Program" tab of "Properties" dialog for the shortcut to the app, set "Run Minimized".
If the application is started by another application, you could run it minimized using WinExec (in another application's code):
Finally, if it is a must to minimize it from within the application itself, you could try something like this:
INTEGER hModule, hWindow
iSt=GetModuleFileName(hModule, sExeName, 256)
(This works on Win2k, where title of Console window displays the full path of the .exe file. If this is different on Win9x/NT4, you could extract filename from full path:
sExeName=sExeName(SCAN(sExeName,'',.TRUE) : )
Test.... Ughhh. Why me, why, why, why, why, why,
Testing ... Is the problem because I'm putting a link?
Is the problem because I'm putting an external link?
Ok. Putting an HTML link to the URL below in my message posting is enough to make it not show up. Why, why, why, why, .... It worked before. I promised myself I wouldn't comment any further on the message board, but it's getting kinda hard to refrain.
After another failed posting, it seems you don't have to use anchor tags any more to post an HTML link. Is this the issue causing the problems. Does the forum have a Users Guide? Ughh.
[Later still] No, it's not just the anchor tags because this message still won't post. #$@#$#@
[Much later] I removed the #)(*$*# damn deja URL even as just text because this message won't post with it.
Thanks for the reply. The executable will be run from a Visual Basic application. Any comments other than the all the good ones you've already posted :)?
The gist of what I've been trying to post is that if your ultimate goal is to launch the console app with no window at all, this can be done easily using CreateProcess.
Steve L posted a CVF example recently on c.l.f. (feel free to search c.l.f. on deja for CreateProcess if you're interested).
If you want to call CreateProcess from VB, there are a number of MS KB articles you'd find useful. (Q129796 Q129797). To hide the console window, you'd want to do the equivalent of
StartupInfo.dwFlags = STARTF_USESHOWWINDOW StartupInfo.wShowWindow = SW_HIDE
PS - Sorry for the lack of links. It's certainly not for a lack of trying. :-/
I forgot to thank you for the assistance in few previous posts (the messages from the old Forum). You're trully a saint - not only for the helpfulness, but for the martyrdom you pass coping with the Compaq Message Forum beast. Well, finally, what one shouldn't do when posting a message here? (It's potentially stupid question - since if you write what shouldn't be done it would not occur here :-))
Just one warning: be careful when executing an exe from within another app. It depends on what you want exe to do, but my experience is that exes doing the calculations are dangerous in the following sense:
You know, Windows is multi-tasking OS. That means, if you want to execute an .exe, it would be run in a separate process, i.e. in parallel with the calling process. So, the calling app will not wait for the exe to finish and then pick up the results; it would simply go further its way. If that's the situation (call an exe and then display the results written in some files), you'd better convert the exe into a DLL and then call the DLL from VB. Also, you can apply the trick with pausing the VB caller for the time sufficient that the exe finishes, or, clearer, apply something like the following (you'll have to translate it into VB):
END SUBROUTINE ExecAppAndWait
Here is an elegant way to call an EXE from VB and wait for the end of execution.
If your ultimate goal is to start a console app programmatically without displaying the console window, you can do this easily using CreateProcess. Steve L. posted an example on c.l.f. not too long ago. You can see it on deja.com at, http://x69.deja.com/getdoc.xp?AN=688011871.
use dfwin implicit none type (T_STARTUPINFO) :: StartupInfo type (T_PROCESS_INFORMATION) :: ProcessInfo integer ret StartupInfo = T_STARTUPINFO( & SIZEOF(StartupInfo),0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0) ! Specify that newly created window is to start hidden StartupInfo%dwFlags = STARTF_USESHOWWINDOW StartupInfo%wShowWindow = SW_HIDE ret = CreateProcess (NULL_CHARACTER, & ! Application Name "SUBDIRFEM.EXE"C, & ! Command line NULL_SECURITY_ATTRIBUTES, & NULL_SECURITY_ATTRIBUTES, & FALSE, & ! InheritHandles CREATE_NEW_CONSOLE, & ! CreationFlags NULL, & ! Environment variables "SUBDIR"C, & ! Current directory StartupInfo, & ProcessInfo) end Send Visual Fortran support requests to firstname.lastname@example.org Steve Lionel (mailto:Steve.Lionel@compaq.com) Fortran Engineering Compaq Computer Corporation, Nashua NH
Send Visual Fortran support requests to email@example.com Steve Lionel (mailto:Steve.Lionel@compaq.com) Fortran Engineering Compaq Computer Corporation, Nashua NH
I'll try this once more.
I was trying to say, if your ultimate goal is to launch the console app with no window at all, this can be done easily using CreateProcess. Steve L posted a CVF example recently on c.l.f.
But if you want to call CreateProcess from VB instead, that example would be of minor help.
If you're interested in this option, there are a number of MS KB articles you'd find useful. (Q129796 Q129797). To hide the console window, you'd want to do the equivalent of
I discovered what the problem was with John's posting - it contained strings of digits which were interpreted as possible phone numbers, and for reasons unknown to me, the software is set up to cause messages with possible phone numbers to be held for review by a moderator.. but nothing ever told me such messages were there.
I THINK I have figured out a way to turn off the phone number filter for the Fortran forum - we shall see. Meanwhile I'll check the moderation queue every once in a while.
Learn something new every day...
Thanks. I don't suppose there's any way for a user to cancel/delete their own posting, is there? (I believe it was possible in the old forum) If not, feel free to prune my posts in this thread down to one.
I seem to have done something extraordinary to my postings to the invisible controls thread, that became visible after moderation. Any idea what's causing this?
John - I'll ask about deleting your own postings - you can ask me to do it if you need something deleted (or edited).
Walter, I discovered that many postings were being held for moderator approval - when I approved them, they appeared.
I discovered that you need to add the following lines to the end of my example code for running a program minimized:
ret = CloseHandle( ProcessInfo.hThread )
ret = CloseHandle( ProcessInfo.hProcess )
otherwise there might be a resource leak or the created process might not go away when done.