3 Questions: 2 Easy and one hard
-
- Enthusiast
- Posts: 168
- Joined: Wed Jun 04, 2003 8:44 am
- Location: Switzerland
-
- Enthusiast
- Posts: 168
- Joined: Wed Jun 04, 2003 8:44 am
- Location: Switzerland
-
- Enthusiast
- Posts: 781
- Joined: Fri Apr 25, 2003 6:51 pm
- Location: NC, USA
- Contact:
@PB
I think your keybd_event code would work, but it would have to be passed
to the message box created by the Windows DOS Box. It would be like
passing a keystroke to another running app from the PB job. And it may
have to be Alt-Y to activate the Yes button.
Thanks for your interest and help
Terry
Sure, try EDIT TEXTFILE.TXT from the MS-DOS prompt.PB wrote:Is there a DOS app that comes native with Win98 that I can run and test?Code: Select all
keybd_event_(#VK_Y,0,0,0) : keybd_event_(#VK_Y,0,#KEYEVENTF_KEYUP,0)
I'll find a way for you to do it, but I need a DOS app to run under Win98.
I think your keybd_event code would work, but it would have to be passed
to the message box created by the Windows DOS Box. It would be like
passing a keystroke to another running app from the PB job. And it may
have to be Alt-Y to activate the Yes button.
Thanks for your interest and help
Terry
> try EDIT TEXTFILE.TXT from the MS-DOS prompt.
Hmm, this closes the DOS window just fine, with no prompt on Win98:
> I think your keybd_event code would work
It does, I tried it with the "ping" command... and it doesn't need ALT either.
Hmm, this closes the DOS window just fine, with no prompt on Win98:
Code: Select all
If OpenWindow(1,300,400,400,100,#PB_Window_SystemMenu,"test")
CreateGadgetList(WindowID())
ButtonGadget(0,10,10,100,25,"Close DOS window")
RunProgram("edit","c:\testfile.txt","c:\")
Repeat
ev=WaitWindowEvent()
If ev=#PB_Event_Gadget
PostMessage_(FindWindow_(0,"MS-DOS Editor"),#WM_CLOSE,0,0)
EndIf
Until ev=#PB_Event_CloseWindow
EndIf
It does, I tried it with the "ping" command... and it doesn't need ALT either.
I compile using 5.31 (x86) on Win 7 Ultimate (64-bit).
"PureBasic won't be object oriented, period" - Fred.
"PureBasic won't be object oriented, period" - Fred.
-
- Enthusiast
- Posts: 781
- Joined: Fri Apr 25, 2003 6:51 pm
- Location: NC, USA
- Contact:
@PB
Your code does actually work... but, the situation is not the same.
You are starting the DOS Edit program from a PB RunProgram command.
That is much different under Win98 than starting it from a MS-DOS
prompt.
Go to the MS-DOS prompt. At the C:> prompt enter EDIT TEXTFILE.TXT
and press Enter. Then try to kill that from the PB program. That is the
situation I am faced with. For some reason it is much different.
In that situation, the job label will be "MS-DOS Prompt - Edit" and the
attempt to close it down will result in the message box pictured in my
message.
However, your recent code does make me think. If I can find a way to
start the DOS program using a PB RunProgram command, maybe I can
also close it at will. I will experiment a bit more....
Terry
Your code does actually work... but, the situation is not the same.
You are starting the DOS Edit program from a PB RunProgram command.
That is much different under Win98 than starting it from a MS-DOS
prompt.
Go to the MS-DOS prompt. At the C:> prompt enter EDIT TEXTFILE.TXT
and press Enter. Then try to kill that from the PB program. That is the
situation I am faced with. For some reason it is much different.
In that situation, the job label will be "MS-DOS Prompt - Edit" and the
attempt to close it down will result in the message box pictured in my
message.
However, your recent code does make me think. If I can find a way to
start the DOS program using a PB RunProgram command, maybe I can
also close it at will. I will experiment a bit more....
Terry
-
- Enthusiast
- Posts: 168
- Joined: Wed Jun 04, 2003 8:44 am
- Location: Switzerland
OK, i use the code from PB:
However when i close the dos prompt, i am getting no message. DOS window closes as expected, with no message.
??
Cecil
Dos Window opens with the file to be edited opens.If OpenWindow(1,300,400,400,100,#PB_Window_SystemMenu,"test")
CreateGadgetList(WindowID())
ButtonGadget(0,10,10,100,25,"Close DOS window")
RunProgram("edit","c:\testfile.txt","c:\")
Repeat
ev=WaitWindowEvent()
If ev=#PB_Event_Gadget
PostMessage_(FindWindow_(0,"MS-DOS Editor"),#WM_CLOSE,0,0)
EndIf
Until ev=#PB_Event_CloseWindow
EndIf
However when i close the dos prompt, i am getting no message. DOS window closes as expected, with no message.
??
Cecil
-
- Enthusiast
- Posts: 781
- Joined: Fri Apr 25, 2003 6:51 pm
- Location: NC, USA
- Contact:
Cecil,
You may have missed my explanation in my most recent post just above
your message.
PB's code can close a DOS program started by PureBasic's RunProgram
command. That is not the situation I must deal with.
I have to close a DOS program running in a "DOS Box" started
externally to my PB program, not by my PB program. For how to test
this, reread the post.
Thanks for your interest.
Terry
You may have missed my explanation in my most recent post just above
your message.
PB's code can close a DOS program started by PureBasic's RunProgram
command. That is not the situation I must deal with.
I have to close a DOS program running in a "DOS Box" started
externally to my PB program, not by my PB program. For how to test
this, reread the post.
Thanks for your interest.
Terry
-
- Enthusiast
- Posts: 168
- Joined: Wed Jun 04, 2003 8:44 am
- Location: Switzerland
OK. I am getting very stupid here.
PB Code opens MS DOS from inside PureBasic. My code earlier opens MS Dos Window externally but no programme running inside the DOS Window.
So i try this now:
From Start -- Run, i type the following:
So a Dos Window is now opens and running the testfile.txt.
In PureBasic, i have the following code:
The code to open DOS Window is commented out.
I then click the button. Dos Window closes without any prompt.
Am i still doing something wrong?
I am testing this in Win98, not Windows 98SE
----
Wait, you are right, when i start editing the file, and try to close the window, it will prompt me, now i see your problem. I will see what i can do.
Cecil
PB Code opens MS DOS from inside PureBasic. My code earlier opens MS Dos Window externally but no programme running inside the DOS Window.
So i try this now:
From Start -- Run, i type the following:
Code: Select all
edit "c:\testfile.txt"
In PureBasic, i have the following code:
Code: Select all
If OpenWindow(1,300,400,400,100,#PB_Window_SystemMenu,"test")
CreateGadgetList(WindowID())
ButtonGadget(0,10,10,100,25,"Close DOS window")
;RunProgram("edit","c:\testfile.txt","c:\")
Repeat
ev=WaitWindowEvent()
If ev=#PB_Event_Gadget
PostMessage_(FindWindow_(0,"MS-DOS Editor"),#WM_CLOSE,0,0)
EndIf
Until ev=#PB_Event_CloseWindow
EndIf
I then click the button. Dos Window closes without any prompt.
Am i still doing something wrong?
I am testing this in Win98, not Windows 98SE
----
Wait, you are right, when i start editing the file, and try to close the window, it will prompt me, now i see your problem. I will see what i can do.
Cecil
-
- Enthusiast
- Posts: 781
- Joined: Fri Apr 25, 2003 6:51 pm
- Location: NC, USA
- Contact:
Solved it!
A properties setting in .PIF file for DOS jobs is set on under Win98 by
default. Removing this setting allows the job to be closed as discussed
above with this code
Here is the Properties seting | Misc tab. See the Termination box and the
Warn if still active check box. It is set by default when the properties are
created for DOS jobs. Uncheck it and everything works as expected and
as it does on WinXP

Thanks for everyone's help.
Terry
A properties setting in .PIF file for DOS jobs is set on under Win98 by
default. Removing this setting allows the job to be closed as discussed
above with this code
Code: Select all
If OpenWindow(1,300,400,400,100,#PB_Window_SystemMenu,"test")
CreateGadgetList(WindowID())
ButtonGadget(0,10,10,100,25,"Close DOS window")
Repeat
ev=WaitWindowEvent()
If ev=#PB_Event_Gadget
PostMessage_(FindWindow_(0,"DOSJOB"),#WM_CLOSE,0,0)
EndIf
Until ev=#PB_Event_CloseWindow
EndIf
Warn if still active check box. It is set by default when the properties are
created for DOS jobs. Uncheck it and everything works as expected and
as it does on WinXP

Thanks for everyone's help.
Terry