How Do I Launch WordPad from Xojo App

I’d like to give the user the opportunity of opening MS WordPad from inside my Windows 7 desktop application with a button. After reading what I could find on the subject, I was able to launch Notepad OK with:

dim f as FolderItem f= SpecialFolder.Extensions.child("Notepad.exe") f.Launch

Like I said, this works fine but Notepad doesn’t do the things with formatting that I need … Wordpad does. So, I found this code that supposedly would open Wordpad:

dim f As FolderItem f = GetFolderItem("C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe")

And although the folder path is correct (I checked it on my Windows 7 system and that is where the Wordpad.exe file is located), executing this code does NOTopen Wordpad (or do anything for that matter … including no errors thrown).

Could someone please point me in the right direction of what I need to do to launch Wordpad successfully.

Thanks in advance for your help!

Have you checked whether f.exists is true after this code? I’m wondering if you need to supply the second “pathMode” parameter to GetFolderItem:

GetFolderItem("C:\\Program Files\\Windows NT\\Accessories\\wordpad.exe", FolderItem.PathTypeNative)

You still need f.launch after getting the folderitem.

Thanks to both of you, Peter and Wayne for your responses.

I thought I had read that using GetFolderItem negated the need for the additional f.Launch command … but I must’ve been mistaken or misunderstood it because Wayne is absolutely right … when I add the f.Launch, up comes my Wordpad!

My bad. I assumed that you just hadn’t included that bit…

Not at all, Peter … I’m the one who left the command out! ^^ You’re one of the ones that was kind enough to try and help based on what you saw … thanks again!