hi
i am tring to get a autorun to open a *.*txt file
for example
[autorun]
open=text.txt
icon=star.ico
however it says invalid 32 app
do you know how i open a text file? do i have to use a shell?
thanks for your help
Printable View
hi
i am tring to get a autorun to open a *.*txt file
for example
[autorun]
open=text.txt
icon=star.ico
however it says invalid 32 app
do you know how i open a text file? do i have to use a shell?
thanks for your help
Hmm, i may well be wrong but i think autorun can only be used to run an application.
I would advise if you are sure you wanna run a txt file, just write a small exe to run the text file then close itself.
However there phraphs is a way to do it from an autorun file, but it would be pretty easy to make a small app to do it then just launch that from your cd.
TNT
thanks
thats what i did but i used a small 3rd party app to do it
this is what you want
[autorun]
open=start text.txt
icon=star.ico
you must add the start to start non-executable programs...
Start is ok for starting documents....but the downside is that it loads a console window for a few seconds.......To do this without the window you could make your own file opener like so....Quote:
Originally posted by dazed66
this is what you want
[autorun]
open=start text.txt
icon=star.ico
you must add the start to start non-executable programs...
Compile this as StartW.exe and add it on the CD with the text.txt. Now change theCode:#include <windows.h>
int WINAPI WinMain(HINSTANCE hThisInstance,
HINSTANCE hPrevInstance, LPSTR lpszArgument,
int nFunsterStil)
{
CHAR szDir[MAX_PATH +1]; //Name of directory
GetCurrentDirectory(MAX_PATH +1,szDir);//Where is this prog run?
if((int)ShellExecute(HWND_DESKTOP,"open",
lpszArgument,NULL,szDir,SW_SHOWNORMAL)<= 32){
MessageBox(HWND_DESKTOP,"Could not open file",//Error
"Error",MB_ICONEXCLAMATION | MB_OK);
}
return 0;
}
>>open=start text.txt
to
>>open=startw text.txt
and it should open without the annoying console window....
Another way I guess is to use
>>open=C:\windows\notepad.exe text.txt
This will open the notepad app with the document you specify...the big downside is that you dont know that notepad is where you specified (it is differet on NT, Win2k...) and also you dont know that the user likes to use notepad...they may like another text editor such as textpad (the program I did above will ask the system to open the file...therefore it will know the prefered text editor)