|
I have currently converted an SDI MFC app to run non-interactively from the command line
to be used in a MakeFile. The problem is returning error messages and reports back
to the user. Does anyone know of a way to use printf (or any other output function) from
a windows app to the console that executed it?
Thanks for all your help.
Please drop me a line if you can help: JasonC@Codemasters.com
|
|
|
|
|
It's possible to open new console window and printf() into it (see KB article Q105305 for details). I think you can't use parent process console from a GUI program - the easiest way to solve your problem would be moving the non-interactive parts into console app. If you need to share this functionality with GUI app, create a DLL.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Look in the MSDN in Platform SDK/Base Services/Files and I/O/Consoles and Character Mode Support.
You will find a lot of functions like WriteConsole() etc.
Good Luck.
Carlos Antollini.
|
|
|
|
|
Hi,
I have a CFormView that contains a CTreeCtrl and a CHeaderCtrl. Everything works fine and the tree is divided in different columns but how do I find out what row and column a user has clicked on?
Cheers
|
|
|
|
|
Do you mean CTreeCtrl or CListCtrl? If you have a CTreeCtrl in columns, I would like to know how you did it.
|
|
|
|
|
I have a CTreeCtrl in columns, there is very good examples on this site to achieve that.
I have found out what column the user clicks in but I can't find the row of the click.
|
|
|
|
|
Hi All,
Is there any function or API to retreive the processor serial number.
Thanks
Moz
Tunis - Tunisia
|
|
|
|
|
I don't think there's an API function for that, but even if there was, I wouldn't tell you
Seriously, this is probably done with (inline) assembly. I suppose you emit an instruction to the CPU and you get the result in some registers. I don't know how though. I guess it's another extension of the CPUID instruction. If you use it, you should put the code inside try/catch blocks, because CPUs that don't support the instruction will produce an invalid opcode exception.
Btw, why would you do that?
|
|
|
|
|
I was also wondering the same thing. I remember seeing an example at www.codeguru.com for getting cpu properties using inline assembly but since i do not know assembly very well i could not understand it.
Orcun Colak
orcuncolak@yahoo.com
|
|
|
|
|
Did somebody used _declspec(property) attribute?
If yes, please tell me how!
I have such code:
[code]
class CSome{
inline long GetMicroSeconds() const
{
return m_nMicroSecs;
}
_declspec(property(put=SetMicroSeconds, get=GetMicroSeconds)) long m_nMicroSecs;
};
[/code]
And get an error "Stack Overflow". I understand why, but don't understand so how to use this attribute?
Well for now it's working with assembler inside, but i don't want to use assembler. So if somebody knows the right way, please tell me.
Thanx
Philip Patrick
|
|
|
|
|
You also have to declare a member variable to store the value, and then return the member variable!
But I recomend not to use _declspec(property), because the code is harder to maintain, and it also confuses people...
And I think in Visual Studio .NET you'll get a warning or an error!
maXallion "Look for bugs, I hate bugs!" - Warden, The Mummy www.maxallion.de - coded evil & more
|
|
|
|
|
First of all - Thanx.
Yeah you've right when say not to use it. I don't want! But i have to. It's a part of low-level modules of my company (where i work) and everybody uses this public member. But I have to keep it not bigger than 999999 (micro). So instead of doing this variable protected and changing all code, i do it "property". That's all.
Thanx again
Philip Patrick
|
|
|
|
|
You're getting into infinite resursion - any attempt to read m_nMicroSecs is redirected to GetMicroSeconds; that's what __declspec(property) does. You need to create separate data member to hold the microseconds. There's an article dealing with this on CodeProject.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
|
I have written us a colour picker to replace the scabby Windows one, and especially with GDI+, allow us to enter alpha as well. My managet wants to be able to select colours from anywhere on the screen by clicking on them. Rather than make the dialog modeless, I decided to be cunning, and call SetCapture and then just check if I have clicked outside the dialog. I call SetCapture in OnInitDialog, and then in OnLButtonDOwn I do this:
CRect rc;
GetWindowRect(&rc);
CPoint pt = point;
ClientToScreen(&pt);
if (!rc.PtInRect(pt))
{
CWindowDC window(NULL);
COLORREF rgb = window.GetPixel(pt);
UpdateData();
m_Red = GetRValue(rgb);
m_Green = GetGValue(rgb);
m_Blue = GetBValue(rgb);
UpdateData(false);
ReleaseCapture();
SetCapture();
Invalidate(false);
return;
}
I've added releasecapture and setcapture to try and solve my problem, which is this. This all works great the first time I do it, after that it won't work at all. Clicking in the dialog works, of course, but I did a debug with a breakpoint set, and OnLButton down is not called again after time if I click outside the dialog. How can I keep the Capture for as long as the dialog is running ? Do I need to run a timer ? Why doesn't it work in the function as I wrote it ? Where's that piece of rope when I need it ?
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
Where's that piece of rope when I need it ?
Here's the rope: "Mouse capture is also affected by the Windows 95 and Windows NT localized input queues.... If the mouse is captured while the mouse button is up, the window receives mouse input only as long as the mouse is over that window or another window created by the same thread."
".
From C++ QA by Paul Dilascia, MSJ, Dec'98.
Cheers,
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
Thanks.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
How do we remove a popup menu I'm unable to get its Menu Id
thanks in Advance
vijay
|
|
|
|
|
Have you tried the BY_POSITION property?
|
|
|
|
|
Sorry, should be "MF_BYPOSITION"
|
|
|
|
|
|
what are the valid colours RGB Values for a 256 colour mode in VC++ How would you traverse from BLUE to RED traversing All the remaining colours thanks
Vijay
|
|
|
|
|
In 256 color mode, each color is represented by an 8 bit value. That value is an index into the color palette. Whatever the palette is set to for that index will be the "valid" color for that index. If you want to traverse from blue to red, you can create the color palette with 256 colors RGB( 255,0,0) to RGB(0,0,255 ), and than display them. Be careful though!
|
|
|
|
|
I am trying to write a program that will backup/restore registry settings to/from a file. I have found that RegSaveKey and RegRestoreKey need administrative privileges in order to work. This is of no use to me as it needs to be used by everyone.
Firstly, does anybody know how to get round such a problem I have tampered with the security descriptor and Enabled backup and restore privileges but despite my efforts I keep getting the WinError - "1314 A required privilege is not held by the client."
Secondly, does anybody know how to manually iterate though a desired regkey and all its subkeys (e.g. HKEY_CURRENT_USER/Software) and then load or save each subkey from/to a file to/from the registry. Such a scenerio I think will get round this privilege problem
Thanks in advance. Any contribution welcome.
|
|
|
|
|