Hi,
I like to script using wscripthost and work with html applications. For computers without access to IE, I must stay away from making windows using .hta files.
The drab dialog boxes available to me using wscript.exe, drive me nuts. I have learned enough in C to make some nice dialog box windows with buttons. I was happy.
I want to be able to call these dialogbox.exe files either by double click or script. Buttons would give me choices as to which scripts to run. I can customize these dialog boxes, make them look nice putting my own icons in the title bar etc.
However I think I have run into a brick wall.
From a vbscript file, I can call another script be it a .cmd or others Without seeing the console window at all. I am able to execute the script in a minimized window. This looks good, and not weird with the console window jumping out at the user etc.
So from my c file compiled .exe file I want to be able to get the user's choice, then start the script and end the dialog box.
I have banged my head on the wall with the system() function, the Shellexecute, the ShellexecuteEx, and seeing the most potential ... with the CreateProcess function.
I have spent over 20 hrs searching and trying code. It seems that the leads I find that indicate the forum discussion is about eliminating the console window, the answers seem to be all about running the app itself in a hidden or minimized mode (which is NOT what I care about !).
Here is some code that runs notepad in a hidden process. It compiles in Pelles C without errors or warning. I have to compile first as a win32 Gui then recompile after setting the linker to subsystem console.
After scanning my code, does anyone have any suggestions for me or should I just give up my dream? If it cannot be done, for security or other limitations, I will give up. I just hate to give up, cause usually it is "my personal limitations" that obstruct me !!!!
Example Code that works:
#include <windows.h>
#include <stdio.h>
int main()
{
STARTUPINFO StartupInfo;
memset(&StartupInfo, 0, sizeof(StartupInfo));
// set the size of the structure
StartupInfo.cb = sizeof(STARTUPINFO);
// tell the application that we are setting the window display
// information within this structure
StartupInfo.dwFlags = STARTF_USESHOWWINDOW;
// set the window display to HIDE
StartupInfo.wShowWindow = SW_HIDE;
PROCESS_INFORMATION pi;
CreateProcess(NULL,
"notepad.exe",
NULL, NULL, 0, 0, NULL, NULL, &StartupInfo, &pi);
// // ~ Above works and notepad is a hidden process, but you see the console flash.
}
=======================================================================
I have tried many variations, using "C:\\Windows\\System32\\cmd.exe" for the first parameter .... and many others.
Would apppreciate all thoughts, leads, advice, and maybe sympathy.
Tx, Ed