Jump to content



Welcome to KnowledgeSutra - Dear Guest , Please Register here to get Your own website. - Ask a Question / Express Opinion / Reply w/o Sign-Up!
* * * * * 1 votes

Msgbox Question.


8 replies to this topic

#1 Aeon

    Member [Level 1]

  • Kontributors
  • PipPipPipPip
  • 65 posts
  • Gender:Male
  • Location:Binary space.

Posted 27 March 2009 - 07:49 PM

Hey,
I was wondering that the appropriate syntax would be to have VB run an application when you hit 'okay' -- Meaning when you hit okay, it opens up notepad.exe or whatever.

My current code is
msgbox "Some message here", 0
I've tried adding Open="notepad.exe" on the next line, but it does not work.

Any feedback would be greatly appreciated.

-AE.

Edited by Aeon, 27 March 2009 - 07:51 PM.


#2 iXeta

    Member [Level 2]

  • Kontributors
  • PipPipPipPipPip
  • 82 posts
  • Gender:Male
  • Location:The pixels of your computer....
  • myCENT:31.19

Posted 27 March 2009 - 08:32 PM

It depends on what version of VB you're using. If your using VB.NET, use the line of code:

Process.Start("Notepad.exe")

That line of code, without giving the drive letter or folder information, will open a windows exe located in your system32 folder.
To run a program other than a system32 application, use code similar to this:

Process.Start("c:\folder\myapp.exe")

These lines of code won't work if your using VB6.

#3 Aeon

    Member [Level 1]

  • Kontributors
  • PipPipPipPip
  • 65 posts
  • Gender:Male
  • Location:Binary space.

Posted 27 March 2009 - 09:23 PM

View PostiXeta, on Mar 27 2009, 01:32 PM, said:

It depends on what version of VB you're using. If your using VB.NET, use the line of code:

Process.Start("Notepad.exe")

That line of code, without giving the drive letter or folder information, will open a windows exe located in your system32 folder.
To run a program other than a system32 application, use code similar to this:

Process.Start("c:\folder\myapp.exe")

These lines of code won't work if your using VB6.

Thank you.

I am using VB6 though, so the code does not work. Would it be better to upgrade to .net?

#4 iXeta

    Member [Level 2]

  • Kontributors
  • PipPipPipPipPip
  • 82 posts
  • Gender:Male
  • Location:The pixels of your computer....
  • myCENT:31.19

Posted 28 March 2009 - 01:18 AM

View PostAeon, on Mar 27 2009, 05:23 PM, said:

Thank you.

I am using VB6 though, so the code does not work. Would it be better to upgrade to .net?

If you're using VB6, use this code instead.


Dim ReturnVal

ReturnVal = Shell("C:\WINDOWS\System32\notepad.exe", 1)


With VB6, you need the entire URL to the EXE even with system32 processes. I've forgotten some of my version 6 knowledge, but I do believe the 1 after the exe name is for when your handling multiple processes, you change the number incrementally. I may be wrong on that though.

#5 Aeon

    Member [Level 1]

  • Kontributors
  • PipPipPipPip
  • 65 posts
  • Gender:Male
  • Location:Binary space.

Posted 28 March 2009 - 01:31 AM

View PostiXeta, on Mar 27 2009, 06:18 PM, said:

If you're using VB6, use this code instead.


Dim ReturnVal

ReturnVal = Shell("C:\WINDOWS\System32\notepad.exe", 1)


With VB6, you need the entire URL to the EXE even with system32 processes. I've forgotten some of my version 6 knowledge, but I do believe the 1 after the exe name is for when your handling multiple processes, you change the number incrementally. I may be wrong on that though.

Hmm---
It's giving me an error with that code--


msgbox "Messagehere", 0
Dim ReturnVal

ReturnVal = Shell("C:\WINDOWS\System32\notepad.exe", 1)

Error Information:

Line 4
Char 1
Error: Type mismatch: 'Shell'
Code: 800A000D
Source: Microsoft VBScript runtime error.

I should note that I'm coding this with notepad.

#6 iXeta

    Member [Level 2]

  • Kontributors
  • PipPipPipPipPip
  • 82 posts
  • Gender:Male
  • Location:The pixels of your computer....
  • myCENT:31.19

Posted 28 March 2009 - 02:15 PM

Are you using VB6 or VBScript? There is a difference.
If your coding this in notepad, im assuming your using VBScript? In that case im not sure how to Shell an application =/ sorry.

#7 Aeon

    Member [Level 1]

  • Kontributors
  • PipPipPipPip
  • 65 posts
  • Gender:Male
  • Location:Binary space.

Posted 28 March 2009 - 09:21 PM

Yes, I am using VBScript.

When I save the note pad file, I save it as 'file.vbs.'

#8 darasen

    Newbie [Level 2]

  • Kontributors
  • PipPip
  • 38 posts

Posted 14 April 2009 - 05:08 PM

I am not sure if this has been resolved yet or not. But for the sake of anyone searching the topic here is a resolution. This is VB Script.

Set objShell = CreateObject("WScript.Shell")
objShell.Run "%windir%\Notepad.exe"

If you are using the option explicit you have to add the line :

dim objShell

first to declare the variable.

Hope this helps someone.

Edited by darasen, 14 April 2009 - 05:12 PM.


#9 iGuest

    Hail Caesar!

  • Kontributors
  • PipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPipPip
  • 5,876 posts
  • Interests:Trap17 Free Web Hosting, No Ads

Posted 12 October 2009 - 10:56 PM

retrieve msgbox textMsgbox Question.

I was wondering if anyone knows how to retrieve the text from a msgbox from another process?Is there a "Get" statement that I can use?

-reply by mark






Reply to this topic


This post will need approval from a moderator before this post is shown.

  


1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users