SolvedOpenTextFile

Posts 1–9 of 9 · Page 1 of 1
OpenTextFile
Hey

I would like to know how to open txt file after the game is closed ?
I have tried to done it like this
Code:
if (dwReason == DLL_PROCESS_DETACH)
{
ShellExecute(NULL,"open","C:\test.txt",NULL,NULL,SW_SHOWNORMAL);
Beep(1000,1000);
}
I can hear beep when the game is closed but the test file doesn't open

anyhelp please ?

thx
From MSDN:
Quote Originally Posted by MSDN
Warning There are serious limits on what you can do in a DLL entry point.
Perhaps calling ShellExecute is one of those things you can't do. Also, it could be that user32.dll (the DLL which ShellExecute is located in) gets unloaded before that code is run so nothing happens. Beep exists in kernel32.dll and is normally the first to be loaded in a process and the last to be unloaded.
Quote Originally Posted by master131 View Post
From MSDN:


Perhaps calling ShellExecute is one of those things you can't do. Also, it could be that user32.dll (the DLL which ShellExecute is located in) gets unloaded before that code is run so nothing happens. Beep exists in kernel32.dll and is normally the first to be loaded in a process and the last to be unloaded.
I'd go with this aswell...

--
Test that shellexecute on a normal code and see if it works. From the looks of it, it should.
Quote Originally Posted by 'Bruno View Post


I'd go with this aswell...

--
Test that shellexecute on a normal code and see if it works. From the looks of it, it should.
worked as integer main ()
{bla bla bla}

but still doesn't work after process is detach

do you know any another way ?
You can use CreateProcess and use the lpCommandLine argument to specify a particluar argument to execute notepad.exe with. The first argument given to notepad is the name of the document you wish notepad to open.

i.e

"notepad lol.txt"
system("notepad C:\Test.txt"); should work...
Marked solved
Posts 1–9 of 9 · Page 1 of 1

Post a Reply

Tags for this Thread

None

Talk with us