|
Hello All,
I want to send cmds to previously opened console application
for instance ,sending dir cmd to already opened cmd prompt.
I got console window handle like below ,
HWND hwnd = ::FindWindow("ConsoleWindowClass","cmd.exe");
then how to write dir cmd to console?
how to retrieve console handle for input and output ?
|
|
|
|
|
is it important that is stays visible or do you only want to get the dir command's result ?
|
|
|
|
|
not only to get cmd result , i also want to keep it visible.
|
|
|
|
|
not only to get cmd result , i also want to keep it visible.
|
|
|
|
|
I found some samples in the net,where they create their own process and create pipe.
my problem is i want to write cmd to previously created console window and i dont know how to create pipe to this console
|
|
|
|
|
Bilge Kaan,
ur post is very interesting.
may I ask:
(1)what OS do u use for the App?
(2)is the console executed (run) by your App?
acturally I want to find already opened console window also, but as I tested, the function FindWindow() doesn't work.
A special image tool for C++ programmers, don't miss it!
The world unique Software Label Maker is here for you and me ...
A nice hyper tool for optimizing your MS html-help contents.
|
|
|
|
|
1 ) I am using Win2000.
2 ) Console is not executed by my application.I want to write cmds to console created by another appli or manually started
it is working proper for me , it is want you need
HWND hwnd = ::FindWindow("ConsoleWindowClass","console_title");
|
|
|
|
|
My OS is win98 (develop PCs are using win98 for us).
I loaded a dos window, whose title is "MS-DOS Prompt"
I tested
HWND hwnd = ::FindWindow("ConsoleWindowClass","MS-DOS Prompt");
but return value (hwnd) is zero.
what is wrong?
did u test your code on win98 or other OS (your users may use different OSs)?
A special image tool for C++ programmers, don't miss it!
The world unique Software Label Maker is here for you and me ...
A nice hyper tool for optimizing your MS html-help contents.
|
|
|
|
|
Not sure if it will work, but you might try AttachConsole() , followed by one of the Writexxx() functions.
You could easily do this if your program also created the console window.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
but i can only retrieve consolewindow handle ,how I can utilize handle to attachconsole
|
|
|
|
|
Use GetWindowThreadProcessId() .
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
attachconsole is only available for XP and Vista.
|
|
|
|
|
Bilge Kaan wrote: attachconsole is only available for XP and Vista.
It helps to specify those requirements up front.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I have over 2000 shortcuts distributed among tens of subdirectories. Their paths are correct but the drive they point to is off. I assumed they would resolve themselves when moving from the USB to the HD, but they haven't.
Is there a batch program that I can run that would modify the drive they point to? If not, anyone has any idea how to start to write a small utility that would accomplish such a thing?
Would really really appreciate any pointers. Thank you all.
|
|
|
|
|
For each one, use the IShellLink::GetPath() /IShellLink::SetPath() pair. Here is a very loosely-related sample.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
I thought I had no choice left but to modify the binaries directly.
Thank you very much.
|
|
|
|
|
I have some code that uses a CPaintDC object to paint rectangles on the screen and then have some text painted inside. If its possible, i would like to be able to display tooltips when the mouse hovers over one of the rectangles. Does anyone have any suggestions? Thanks.
|
|
|
|
|
Hi All,
I'm looking for a method of querying the performance of my projects. Is there a common method for timing functions? Possibly with the aid of adding macros to certain parts of the code?
|
|
|
|
|
waldermort wrote: I'm looking for a method of querying the performance of my projects.
See here.
waldermort wrote: Is there a common method for timing functions?
You could use GetTickCount() , multimedia timer, QueryPerformanceCounter() , profiler. All of these come with pros and cons.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
|
Thanks for the ideas. I have thrown together a bit of code using QueryPerformanceCounter() and created a macro which I can drop into the code. It's not brilliant but it should help me find out where all those slow functions are.
|
|
|
|
|
If you can do it in the development environment (and if you can get it to work) the profiler is easy to use and gives more reliable results than GetTickCount().
|
|
|
|
|
I have heard of this profiler before, but I never did find out how to use it.
|
|
|
|
|
Sorry for the slow response - I don't have Visual studio installed on any available PC at the moment!
First - according to MSDN, the profiler is only available in the Visual C++ professional and Enterprise editions, not standard edition.
Still interested? Then have a look at the following article on MSDN - http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/tmp/_core_run_the_profiler_from_the_development_environment.asp[^]
Note - I have only used the profiler with Visual C++ 6 (with straight C code), and I found that it sometimes was not available (menu option greyed), even though no project settings had been changed.
Good luck - it is worth the effort to get this going.
|
|
|
|
|
Hello, I’m Giorgio. I’d like to know creating graphics object in my interface with Microsoft Visual C++. They must be ellipse or rectangle I can modify them after by clicking mouse. This is a feature of most desinging and painting program like PowerPoint and Paint.Can I use CWnd class for it?
Who can aid me, write me please at Stassi1@virgilio.it
|
|
|
|