in a computer;
I want to find the path for "wordpad.exe" into the DD
what are the steps to follow?
merci
Posted on 2002-06-09 09:52:30 by franlou
You will find it in this Registry Key

HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\App Paths\WORDPAD.EXE

hope this help.
Posted on 2002-06-09 11:14:24 by Sa6ry
ah, btw
you will always find it in short file format.

i don't know how to convert it :((

does anyone here know ?
Posted on 2002-06-09 11:19:08 by Sa6ry
well as for that i think you could do a search for the 8.3 formatted file via the findfile-apis.
in the find-data struct there should be a field to the files long name. just an idea though
Posted on 2002-06-09 12:26:04 by phueghy
You can't depend on the "app paths" registry value. Either look in
the windows folder (I believe that's where wordpad usually resides?),
or do a complete recursive file search... at least that ought to work.
If you need this to eg display program information in an installer
(or similar), I suggest you to just ShellExecute the .txt or rtf or
whatever, it's easier and the user gets the viewer of his choice.
Posted on 2002-06-09 13:49:12 by f0dder
to Sa6ry
thank's
is it always the same Registry Key?
Windows98 , WindowsXp,WindowsMe.....
Posted on 2002-06-10 10:42:57 by franlou
thank's fOdder
but I want wordpad.exe to put an text from the clipBoard
and not to open an existing file...
Posted on 2002-06-10 10:45:51 by franlou
okay let's simplify this, you want to

1. copy something in the clipboard
2. search word.exe
3. open word
4. insert the clipboard-data

1/2 = search this board, there are a couple of
working examples on how to search files or
how to read out registry keys. there are also
examples on how to read and write to the
clipboard.

3 = ShellExecute / WinExec or CreateProcess
4 = mh, don't know if word allows this from
commandline but if thats not the case you could
send the SHIFT-INS key-combo to the hwnd of
the word process. i think the keybd_event api
will do this job.
Posted on 2002-06-10 11:11:00 by mob
tried it out, it works for me...



.DATA
OP DB "open",0
FN DB "wordpad",0

.CODE
START: INVOKE ShellExecute,0,addr OP,addr FN,0,0,SW_SHOW
INVOKE Sleep,1000
INVOKE keybd_event,VK_CONTROL,0,0,0
INVOKE keybd_event,VK_V,0,0,0
INVOKE keybd_event,VK_CONTROL,0,KEYEVENTF_KEYUP,0


btw, using ShellExecute and Sleep is very dirty. word
doen't have regular loading-time rates, sometimes it
need 2 seconds, sometimes 30... :) ah and i forgot to
mention that word often wants to update so you have
to come up with something clever to go against this
terrible behaviour (or you just use wordPAD, in this
case you don't need to search word.exe because the
path is in the enviroment variables -> ShellExecute)

BTW, is this code right? isn't there a way to do combos
with ONE api call instead of calling keybd_event 3 times?

EDIT: ooops you actually wrote "wordPAD" so excuse
the first block of text :) just play around with the code.
Posted on 2002-06-10 11:45:28 by mob
Use DDE :tongue:
Posted on 2002-06-10 13:04:14 by bazik
franlou

The attached program is a variation on a program I submitted a while ago titled: Crude Wordpad Automation. In this version, I use the value in Registry key:

HKEY_CLASSES_ROOT\Wordpad.Document.1\Protocol\StdFileEditing\Server

which gives the command line for WordPad. It gives the short file name version, but it still works. This has been accurate on the 15 or so machines I've tested. Win95, 98, NT4, & 2K I would appreciate users of other platforms to at least check the existance of the registry key. Thanks!

I used keybd_event because I couldn't get anything else to work! keybd_event works only because the newly created Process has the focus.

The keystrokes set the page to landscape mode, all four margins to .25" and no wrap because of the long length of many lines. WordPad is left at this state for the user to review and print if necessary.

farrier
Posted on 2002-06-11 14:59:33 by farrier