Original Post
🔒 Locked
opening a program from inside another,need help
Advertisement
If you''re using windows, don''t use system (which is in stdlib.h btw), you should use ShellExecute or ShellExecuteEx.
http://www.gdarchive.net/druidgames/
http://www.gdarchive.net/druidgames/
correct me if I''m wrong, but I think you can use windows ShellExecute in your console, just don''t specify an HWND for error messages
HINSTANCE ShellExecute(
HWND hwnd,
LPCTSTR lpOperation,
LPCTSTR lpFile,
LPCTSTR lpParameters,
LPCTSTR lpDirectory,
INT nShowCmd
);
the problem would be ending this program when you want to. If you are shelling a windows application, I think you can use FindWindow() to get the main app window, if you know the window name
HWND FindWindow(
LPCTSTR lpClassName, // pointer to class name
LPCTSTR lpWindowName // pointer to window name
);
and call SendMessage(hwnd,WM_QUIT or WM_CLOSE,0,0).
Regards,
Alex.
HINSTANCE ShellExecute(
HWND hwnd,
LPCTSTR lpOperation,
LPCTSTR lpFile,
LPCTSTR lpParameters,
LPCTSTR lpDirectory,
INT nShowCmd
);
the problem would be ending this program when you want to. If you are shelling a windows application, I think you can use FindWindow() to get the main app window, if you know the window name
HWND FindWindow(
LPCTSTR lpClassName, // pointer to class name
LPCTSTR lpWindowName // pointer to window name
);
and call SendMessage(hwnd,WM_QUIT or WM_CLOSE,0,0).
Regards,
Alex.
Topic Locked
This topic has been locked by a moderator. New replies are not allowed.
Sign in to reply to this topic.
Advertisement