3 Questions: 2 Easy and one hard

Just starting out? Need help? Post your questions and find answers here.
User avatar
GedB
Addict
Addict
Posts: 1313
Joined: Fri May 16, 2003 3:47 pm
Location: England
Contact:

Post by GedB »

Cecil,

It really does look like your compiler is screwed up.

Try using SmartUpdater to refresh your installation, it always works for me.
cecilcheah
Enthusiast
Enthusiast
Posts: 168
Joined: Wed Jun 04, 2003 8:44 am
Location: Switzerland

Post by cecilcheah »

Code: Select all

Smart Updater Tool not found in the Pure Basic Directory
What shall i do?

Cecil
cecilcheah
Enthusiast
Enthusiast
Posts: 168
Joined: Wed Jun 04, 2003 8:44 am
Location: Switzerland

Post by cecilcheah »

I have now sent an email to support, see what they can do to help me.

Now my problem is forgot my password. And my login is my work email, not private email, so i have also asked them to send me a new password and changed my login.

Hope this will work now, let's see

Cecil
TerryHough
Enthusiast
Enthusiast
Posts: 781
Joined: Fri Apr 25, 2003 6:51 pm
Location: NC, USA
Contact:

Post by TerryHough »

@PB
PB wrote:

Code: Select all

keybd_event_(#VK_Y,0,0,0) : keybd_event_(#VK_Y,0,#KEYEVENTF_KEYUP,0)
Is there a DOS app that comes native with Win98 that I can run and test?
I'll find a way for you to do it, but I need a DOS app to run under Win98.
Sure, try EDIT TEXTFILE.TXT from the MS-DOS prompt.

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
PB
PureBasic Expert
PureBasic Expert
Posts: 7581
Joined: Fri Apr 25, 2003 5:24 pm

Post by PB »

> try EDIT TEXTFILE.TXT from the MS-DOS prompt.

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
> I think your keybd_event code would work

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.
TerryHough
Enthusiast
Enthusiast
Posts: 781
Joined: Fri Apr 25, 2003 6:51 pm
Location: NC, USA
Contact:

Post by TerryHough »

@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
cecilcheah
Enthusiast
Enthusiast
Posts: 168
Joined: Wed Jun 04, 2003 8:44 am
Location: Switzerland

Post by cecilcheah »

OK, i use the code from PB:
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
Dos Window opens with the file to be edited opens.

However when i close the dos prompt, i am getting no message. DOS window closes as expected, with no message.

??

Cecil
TerryHough
Enthusiast
Enthusiast
Posts: 781
Joined: Fri Apr 25, 2003 6:51 pm
Location: NC, USA
Contact:

Post by TerryHough »

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
cecilcheah
Enthusiast
Enthusiast
Posts: 168
Joined: Wed Jun 04, 2003 8:44 am
Location: Switzerland

Post by cecilcheah »

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:

Code: Select all

edit "c:\testfile.txt"
So a Dos Window is now opens and running the 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 
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
TerryHough
Enthusiast
Enthusiast
Posts: 781
Joined: Fri Apr 25, 2003 6:51 pm
Location: NC, USA
Contact:

Post by TerryHough »

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

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 
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
Image

Thanks for everyone's help.

Terry
Post Reply