Hello
How can I call a txt file by opening Notepad ?
I wanna use a txt file as help file in the program ... (After clicking help button)
is there any example about it?
thanks
Force
ShowFile proc pszFullFilePath: ptr TCHAR
LOCAL sei:SHELLEXECUTEINFO
fn RtlZeroMemory,&sei,SIZEOF sei
mov sei.cbSize,SIZEOF sei
mov sei.nShow,SW_NORMAL
mov sei.lpDirectory,WinDir$()
mov sei.lpFile,chr$("notepad.exe")
m2m sei.lpParameters,pszFullFilePath
fn ShellExecuteEx,&sei
ret
ShowFile endp
I mean like that C code Somebody can translate it?
HINSTANCE hInst = ShellExecute(0,
"open", // Operation to perform
"c:\\windows\\notepad.exe", // Application name
"c:\\example.txt", // Additional parameters
0, // Default directory
SW_SHOW);
Ok ok i translated it my self :toothy
.386
.model flat, stdcall
option casemap :none
; ###############################
include \masm32\include\windows.inc
include \masm32\include\kernel32.inc
include \masm32\include\user32.inc
include \masm32\include\shell32.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\shell32.lib
; ################################
.data
buffer db "test.txt",0
opn db "open",0
.data?
.code
start:
invoke ShellExecute,0,addr opn,addr buffer,NULL,NULL,SW_SHOWNORMAL
invoke ExitProcess,NULL
end start
Try this if you have included the masm32 macro file.
fn ShellExecute,0,"open","test.txt",NULL,NULL,SW_SHOWNORMAL
You can also use "fnx".
Thanks Hutch
using masm32rt.inc is simple way
in fact i dont use masm32rt.inc often not to be lazy in masm32 :toothy
.386
include \masm32\include\masm32rt.inc
.code
start:
fn ShellExecute,0,"open","test.txt",NULL,NULL,SW_SHOWNORMAL
invoke ExitProcess,NULL
end start