|
Oh, would that it were so easy!
I am spawning something like:
AcroRd32.exe /n /t "PSPrinter" "HP LaserJet 5000 Series PS" "filexyz.pdf" "filexyz.ps"
to print a PDF file to a Postscript file. Unfortunately, AcroRd32.exe doesn't exit after doing this. It just sits around, using up resources.
And removing the /n doesn't help. Sigh...
But thanks for the suggestion. Ordinarily that would be the clear winner.
|
|
|
|
|
Possibly there's a neater way using some functions from the Shell library, but the following hack should work: Keep trying to open filexyz.ps in non-create, write mode periodically until you succeed. Then you know AcroRd32.exe is done.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Sounds promising, assuming that AcroRd32.exe normally locks its output file (or the OS does this automatically). I'll give that a try and report back (tomorrow, probably).
Thanks!
|
|
|
|
|
Harold Bamford wrote:
Oh, would that it were so easy!
Yep.;)
I'd like to think AcroRd32.exe locked the file it was printing to. If it does then you could try opening it for write access from time to time and when the open succeeded you'd be away.
There is a Win API FindFirstChangeNotification() which would be worth looking at, but in this case I don't think it will help. See: http://www.codeproject.com/file/filewatch.asp[^]etc.
Also have a look at www.sysinternals.com (seems to be down at present). They have a program called called something like FileWatch which should provide a solution.
Neville Franks, Author of ED for Windows. www.getsoft.com
|
|
|
|
|
Well, I tried it and the method suggested by you and Joaquín M López Muñoz worked perfectly. On the off-chance that AcroRd32.exe creates an empty file before writing to it, I added a check for a non-zero length file, but basically the technique works.
Thanks to both of you!
|
|
|
|
|
Any ideas on how to cleanly check a temperature called temp and a
temperature delta called tempdelta without a gluge of numerous if then
statements?
In other words how clean can you make a piece of code that mointors a temp
at certain intervals (say 1 minute) and performs an action (say sends an e-mail) if that temp is reached. It then does not do anything again until the temp falls below the tempdelta value.
Any ideas here, any samples? Know of any exting on the net?
Thanks very much,
Doug
|
|
|
|
|
Some if s and then s are inevitable. Maintain a bool variable (let's call it trigger ) set to true when the temperature rises above (or equals) temp and to false when it goes below tempdelta . The sending of the email will only be done when trigger was not previously true .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Any ideas on how to cleanly check a temperature called temp and a
temperature delta called tempdelta without a gluge of numerous if then
statements?
In other words how clean can you make a piece of code that mointors a temp
at certain intervals (say 1 minute) and performs an action (say sends an e-mail) if that temp is reached. It then does not do anything again until the temp falls below the tempdelta value.
Any ideas here, any samples? Know of any exting on the net?
Thanks very much,
Doug
|
|
|
|
|
I know I need a boolean variable. Anything more specific on what this might look like.
Thanks,
Doug
|
|
|
|
|
Hello,
I am trying to custom draw my tree control.. I am having problems figuring out what item in the tree is currently being drawn each time the Custom draw function is called..
I want to match the text in the item being drawn agains a string inside a structure which is inside an array.. The only way I know of to do this is m_array.GetAt(iItem) if I do this I need to know what the number of the item i am drawing is..
any ideas?
|
|
|
|
|
I can do what I want if I could figure out a way to get a count of sub items... like
Friends
Joe
Jack
Tom
George
Employees
Doug
Sub items = 5
|
|
|
|
|
I am trying to launch a webpage when a user hits a special key to end the screen saver. The problem is when I use CreateProcess, ShellExecute, or ShellExecuteEx the newly created ie window opens, then closes because my screen saver exits. It doesn't do this when the saver is run by clicking on it in explorer though, or when debugging. It only closes the newly created process when it is activated by windows as a normal screen saver.
What special thing is windows doing to a .scr file when invoked by the system timeout that its not doing to it when you launch it by clicking on it?
Or is there some way I can defer the opening of the browser to another process, such as the desktop window? So then the system won't close it when my saver exits?
I think it may be because the saver is running under a system context when started via the timeout, but when I click on it directly it is run under my user logon context, so maybe I have to use CreateProcessWithLogonW?
Thanks for any help
|
|
|
|
|
mediamaster40 wrote:
I am trying to launch a webpage when a user hits a special key to end the screen saver. The problem is when I use CreateProcess, ShellExecute, or ShellExecuteEx the newly created ie window opens, then closes because my screen saver exits.
Are you 100% sure this is the case? Depending on OS and options it could very well be that IE is still running but on another desktop, namely the secured desktop that the screensaver used.
First I'd suggest you really verify with Task Manager that IE isn't running.
If it is, you must redirect it to the default desktop on the default Windows Station (WinSta0). This is sort-of documented in an MSDN article by Matt Pietrek (when he created the equivalent of RunAs for NT4).
If it isn't running, then something must have "killed" it, and about the only thing I can come to think of to see what's happening is that you create a dummy Windows app that logs just about everything that happens to a file (plain ol' printf debugging ).
|
|
|
|
|
Yes I am sure IE is not runnning, when the saver exits, the IE process is spawned and you see it in the task manager for a second, then you see the browser pop up and go to the page, then my saver cleans up and exits, then the system kills the IE process.
Thanks for the tip, but I have already tried using "winsta0\\default" and it didn't do anything.
Here is the code I am using:
PROCESS_INFORMATION ProcessInfo; //This is what we get as an [out] parameter
STARTUPINFO StartupInfo; //This is an [in] parameter
ZeroMemory(&StartupInfo, sizeof(StartupInfo));
StartupInfo.cb = sizeof StartupInfo ; //Only compulsory field
if(CreateProcess(NULL, cmdLine, NULL,NULL,FALSE,0,NULL,NULL,&StartupInfo,&ProcessInfo))
{
CloseHandle(ProcessInfo.hThread);
CloseHandle(ProcessInfo.hProcess);
return true;
}
else
{
MessageBox(NULL, errorString, "Error Opening Web Browser", MB_OK);
return false;
}
|
|
|
|
|
I have a program that I have been developing under VC++ 7.0. When I try to run the program on a machine that doesn't have Visual Studio.NET it says that it cannot find mfc70.dll. I have set the active configuration to Release but it still doesn't work. Is this just a bug on the the Beta 2 version or am I just doing something wrong. Any help appreciated.
Brad Jennings
|
|
|
|
|
Change the MFC linking mode to "Use MFC in a static library" (or something like that, can't recall the exact wording).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Do you happen to know where to change the linking mode? I'm new to Visual Studio.NET and cannot find it.
|
|
|
|
|
Nevermind I found it. Thanks.
Brad Jennings
|
|
|
|
|
Sorry, never used VS.NET. If it's similar to VS6.0, look around Project->Settings.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I send a two file. i must open a directory a send the files. Can i use CreateFile?
|
|
|
|
|
What do you mean by send file?
Mazy
"If I go crazy then will you still
Call me Superman
If I’m alive and well, will you be
There holding my hand
I’ll keep you by my side with
My superhuman might
Kryptonite"Kryptonite-3 Doors Down
|
|
|
|
|
Send file with socket. The problem is send two file. Send a single file is not problem but two?
|
|
|
|
|
Send the length of the files prior to the files themselves.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
My MDI application has a view and when that comes up i dont get the print File Menu item disabled. I want to print the contents of the view . I am specifically using a CTreeView Ctrl as the view . Please help
|
|
|
|
|
Well there is some unexpected thing i have encountered while programming in Visual C++ 6.0 under Windows XP. For example, windows standart looklike Button, is light oval shaped and it really differs from buttons in resource editor in visualc++. Even after compilation, the buttons (generally the controls) look like they are from win9x series of windows. Why? Can somebody help me to solve this as i think stupid problem? Example: Miranda compiled on VisualC++6.0 (XP os) has XP style Controls. Is there some definition or declaration that has to be done?
|
|
|
|