|
Background.
I have an App. written by me, that is a win32 console App.
It does some processing and produces some console output, as they usually do.
Now, I am quite happy with the output, as its simply a dump of some data. But, I have developed a GUI which ShellExeceuteEx's the console App as the user requires. So, I can have many instances of the console App running at the same time.
I would like to know if it is possible, that when the user presses the keyboard pause key, only the console window with the focus is paused. At the moment thay all get paused, which of course is expected.
I have looked around and I can not find any general solution. My only idea is to create a keyboard hook DLL, test if the main window focus is on one of the spawned console Apps and to issue a pause/suspend against that thread.
If anyone knows of a better or any other elegant solution I would be interested to know.
Oh, and one more question. Does anyone know how to specify which font is used for Stdout for a console application.
Thanks.
James.
|
|
|
|
|
Hi,
The CHINESE CHARACTERS that I entered for the COMBOBOX control by its property tab(DATA) under chinese OS could not be displayed correctly under English OS. Even though I compile the source code with UNICODE. Does anyone know?
Robert
|
|
|
|
|
Does the PC with the English OS have any Chinese fonts installed?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Yes. The Chinese fonts have been installed. Because I can input the chinese characrer under English OS. Especially, the other controls such as static and button with chinese characters can be displayed properly under English OS.
Futhermore, If I inser or add items using the source code instead of using combobox property TAB(DATA), they can be well displayed.
I don't know why it does not work with the property TAB(DATA.
Robert
|
|
|
|
|
Hi.
I got one dimensional array with integer numbers in it. I want to reverse the numbers. The fisrt number should be last and last should be first e.g. [1,2,3,4,5,6,7,8,9] reverse to [9,8,7,6,5,4,3,2,1]. How can I do it fast?
Regards.
|
|
|
|
|
With STL it's simple:
#include <algorithm>
...
int array[]={1,2,3,4,5,6,7,8,9};
...
std::reverse(array,array+9);
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi.
The fastest way to 'reverse' the array, would be to traverse it backwards. This requires no copying.
James.
|
|
|
|
|
|
Hello I was wondering if there was a simple way of getting the difference between two times for example
using Ctime, get the current time and 5 hours later get the current time and see what the difference in hours and minutes is, for example
Tuesday September 12 2004 10:42 AM
Tuesday September 12 2004 2:21 PM
One more question is there a way of displayhing text on a dialog box, i have a login box, and i would like to display a greeting message to the employee, right now i display a message box with an ok button, but i was wondering if i could skip the message box and just add text.
|
|
|
|
|
Take a look at CTimespan - it should do what you need.
Adding text to a dialog is very easy. What version of VC are you using? In VC6, (and probably most earlier versions) you just place a static control on the dialog template and change it's text. If you need to do it from within the program, you can use SetDlgItemText(...) or use a member variable.
|
|
|
|
|
I have a couple of CControlBar derived classes floating control bars.
when the application starts, I create them , and load their state, either visible or docked, or floating; but when I try setting the text on the floating frame ( CMiniDockFrameWnd ) but it does not really work well.
I had a peek at Cristi Posea's CSizingControlBar , and in one method, there's :
if (IsFloating() && GetParentFrame()->IsKindOf(RUNTIME_CLASS(CMiniDockFrameWnd)))
{
m_pDockBar->SetWindowText((LPCTSTR) lParam);
GetParentFrame()->DelayRecalcLayout();
}
but if I call a method with this in the OnCreate of my MainFrame ( where the CControlBar are created ), they are not yet floating; but they actually are floating.
if I call the same code from an test menu command, it works like it should and change the caption of the floating frames.
Is there a "Post Create" handler that I can use when creating the mainframe ?
Thanks.
Max.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Hey Max
Im a newbe and maybe this may help but again you may already know this.
CControlBar is an abstract base class for the control bar classes found in MFC.
A control bar is a window that is usually docked to one of the side os a fames window.
These windows can also float inside of the frame window. The control bar provided by MFC include CStatusBar, CToolBar, CDialogBar, CReBar, and COLeResizeBar.
The IsFloating Method
Bool IsFoating();
Returns True if the control bar is floating
book: Sams Teach Yourself Visual C++ in 21 Days
If not, Im sorry
|
|
|
|
|
I know about IsFloating() and it didn't return the good value ... it returned false even if the control bars were floating ...
Thanks anyway ..
M.
Maximilien Lincourt
Your Head A Splode - Strong Bad
|
|
|
|
|
Hi there.
I have this class, derived from CFormView. It contains a CTabCtrl. I'm trying that, when a tab is clicked, to change the dialog resource id. Now, as you might remember, the constructor for CFormView includes the resource id. I've been trying many solutions (such as changing the m_lpszTemplateName member name and calling CreateDialog and CreateDialogIndirect), but I cannot find a solution.
I hope you can help me with this. Thanks a lot.
Kith.
Fools say "I know, you don't know", silence like a cancer grows...
Hear my words that I might teach you, take my arms that I might reach you...
but my words like silent raindrops fell... no one dare...
to disturb the sound of silence.
|
|
|
|
|
Hello,
If I understand correctly, you want to change a dialog when you click a tab on a tab control. This tab control is on the dialog you want to change.
If the above assumption is correct, read further, if not skip the next paragraph.
I don't think that you should change the resource ID of the class. I don't know what will happen, but it sure is something that you don't want!
If you want to display another dialog, you can make the dialog you want to change invisible (or destroy it if you want) and create another dialog with the resource ID that you want.
If you really need to reuse the class with another ID (I don't see the benefit in that) you can destroy the window (and the class) and create another one (the same class derived from CFormView) except with another ID.
Hope this information is of any help.
Multiply it by infinity and take it beyond eternity and you'll still have no idea about what I'm talking about.
|
|
|
|
|
Sounds like you need to embed a porpertysheet or a tab control into your form. that way it can handle the page changing for you.
There are several articles on that subject
If you vote me down, my score will only get lower
|
|
|
|
|
Hello,
How can I know the path of a running app without recurring to neither registry entries nor to an .INI file ?
I have been checking CWinApp for a function or variable member but was unable to find one...
Any suggestions?
David
BTW, m_pszExeName/m_pszAppName in CWinApp do not retrieve the path...
|
|
|
|
|
|
There is this Windows API function: GetCurrentDirectory. GetModuleFileName will only give you the file name, like "module.dll" instead of "C:\Program Files\Your Company\Your Product\bin\module.dll", the complete path. The prototype is as follows:
DWORD GetCurrentDirectory(DWORD nBufferLength, LPTSTR lpBuffer);
Greetings.
I know there's something so dear to me, beyond words,
beautiful feelings in my soul,
sounds I've heard like humming birds in a dream.
That mystical one I knew is returned,
lulling me with those raincloud eyes,
taking me and melting my heart away.
|
|
|
|
|
Wrong. GetCurrentDirectory will not always return the directory that the executable is in. You can not assume that it does as an a shortcut could change the working directory, the program can change the working directory or the user could launch the program from a command window using the full path. In each case GetCurrentDirectory will not be the directory that the program resides.
GetModuleFileName returns the correct result. Here is the doc:
GetModuleFileName
The GetModuleFileName function retrieves the full path and file name for the file containing the specified module.
John
|
|
|
|
|
I use GetModuleFileName() and it returns the whole path for me. In the app I wrote I use this to append a "\\temp" to the end of it for a call to CreateDirectory to create a temp folder in the same folder where the app resides. So as far as I know GetModuleFileName returns the whole path. I have a call to it like this in my app:
::GetModuleFileName(NULL,szPath,512);
where 'szPath' is declared
char szPath[512];
[insert witty comment here]
bdiamond
|
|
|
|
|
bdiamond wrote:
::GetModuleFileName(NULL,szPath,512);
It's not a good idea to use constants like this. If the size of your variable ever changed, you could easily miss one. Use the sizeof operator instead.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
sorry, but you know from experience that I'm not the brightest guy around Is this what you're saying I should do?
char szPath[512];<br />
<br />
::GetModuleFileName(NULL,szPath,sizeof(szPath));
[insert witty comment here]
bdiamond
|
|
|
|
|
bdiamond wrote:
Is this what you're saying I should do?
Correct.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
cool. Thanks
[insert witty comment here]
bdiamond
|
|
|
|
|