|
Won't you have to add the WS_CHILD style?
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hello, a while ago I planned on programming with c/c++. The problem was the compiler. Now I have one but when I make just a simple program like: "hello world" the DOS screen will apear for just very short. Then it closes itself. I was thinking maybe it was logical because you just tell him to show "hello world" and then it quits by itself. So I made a program were you had to put 2 numbers in variables. I entered 2 numbers and pressed ENTER and the same thing happens. Does anyone know how to solve this?
Thomas
|
|
|
|
|
Hello!
Try to use getch() or _getch() at the end of the code.
This application quits, becuase there is no loop. So either solution is to create a loop.
|
|
|
|
|
Try using getch() after your final input
|
|
|
|
|
it's not a problem...
If you run your application from VC with Ctrl+F5 you will see the message, and then you must to press a button to close it.
When you run your application for example in debug mode, the VC creates the console and close it when the app finish.
If you like, you can run your app from command line, and you will see when the app finish the cursor returns to the prompt...
Carlos Antollini
Do you know piFive[^] ?
|
|
|
|
|
I like to use this (at the very end of your program, before the return of the main function):
system("pause");
Actual Linux Penguins were harmed in the creation of this message.
|
|
|
|
|
or you can add a cin>> at the end like I do
|
|
|
|
|
Is it possbile to add controls to a CDialog based class at runtime? It was easy enough in MC++ with the controls property of a form. Is there something similar for CDialog? Thanks.
- monrobot13
|
|
|
|
|
Hello!
Simply create required wnd class with parent set to the dialog and place it somewhere inside dialog (in order to see the control). See for example CEdit::Create(). Created window may have to be shown by CWnd::ShowWindow()
Tell me if you want more detailed description.
|
|
|
|
|
I sort of understand, but would appreciate a more detailed description, like how would I specify where in the dialog I want the control located (coordinates). Thanks again.
- monrobot13
|
|
|
|
|
// CtesttestDlg message handlers
CEdit *pEdit = NULL;
BOOL CtesttestDlg::OnInitDialog()
{
CDialog::OnInitDialog();
pEdit = new CEdit;
pEdit->Create(WS_CHILD | WS_VISIBLE | WS_TABSTOP | WS_BORDER, CRect(10, 10, 100, 100), this, 10005);
pEdit->ShowWindow(SW_SHOW);
...
and I know, I know...it should not be a global variable, and should be deleted somewhere, but this is only a sample :P
|
|
|
|
|
Makes sense, I'll give it a go. Thanks for the help.
- monrobot13
|
|
|
|
|
I've worked function pointers for years, mostly in C.
But I was wondering, since a reference is just a deference pointer, is there such a thing as funtion refernce in C++?
I do not remember reading about such a thing.
INTP
|
|
|
|
|
that's normal, functions references don't exist...
i'm sorry to announce to you that the function pointer is not dead !!!
remember that reference is not only a "dereferenced pointer"...
++ man
TOXCCT
|
|
|
|
|
toxcct wrote:
that's normal, functions references don't exist...
Ya, I did not think so.
toxcct wrote:
remember that reference is not only a "dereferenced pointer"...
Actualy they are, C++ just hides that fact (or has some thing changed?).
The first C++ complier was actualy a C complier with a C++ front end that converted the C++ code to C code before complation. Therefore, since C does not have direct references, all references where dereferenced pointers.;)
INTP
|
|
|
|
|
C++ defines references to functions, for instance:
typedef void (& fun_ref)(int);
...
void foo(int x)
{
...
}
...
fun_ref f=foo; Interestingly enough, there are no references to member functions. I don't know the exact reason, probably it is just an overlook.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Thank you very much! That makes logical since to me. Of cource I was hopping that you could specify references to member funtions.
When I think of how references are normaly assigned (as you showed), I can see why there are no references to member functions.
INTP
|
|
|
|
|
When I think of how references are normaly assigned (as you showed), I can see why there are no references to member functions.
Really? I do not see any fundamental reason why references to member functions cannot exist, they'd be used like this:
struct A
{
void foo(int);
void bar(int);
};
typedef void (A::& mem_fun_ref)(int);
...
mem_fun_ref f=A::foo;
A a;
a.f(5); But anyway the sad reality is that references to member functions do not exist in C++. I've googled a bit for a plausible explanation, and found none
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Have you asked Stroustrup or the ISO C++ Committee about it?
How did they say?
Maxwell Chen
|
|
|
|
|
I want to prevent "Screen Capture".
I tried to prevent the message "Print screen" Key.
But "Capture Software" and Original Destktop Capture Software could capture.
So,I noticed mouse cursor wasn't captured.
I tried to draw object like drawing mouse-pointer.
But failed....I couldn't predict mouse-pointer drawing process.
Do you think of the solution method ?
"mouse-pointer drawing process"
or other method ?
|
|
|
|
|
When terraserver.com was a free service and all the 1 meter images were available it used to have this feature. It would use an ActiveX control inside IE to draw the images, but if you tried to "PrintScreen" and paste in Paint you would get their logo!
They accomplished this by drawing directly to video memory perhaps using DirectX.
|
|
|
|
|
Thank you for the reply.
But I could paste.Am I wrong?
>They accomplished this by drawing directly to video memory perhaps using >DirectX.
Sure.I tried by using DirectX.
But I don't want to use as special a thing-"special API." as possible.
Can we draw object like drawing mouse pointer?
|
|
|
|
|
You do it using hooks - or at least thats how I usually do )
Add a low level keyboard hook (see SetWindowsHookEx in MSDN) and then swollow the print screen key when it comes along - there is an example in MSDN that explains it well for disabling CTRL-ALT-DEL - the principle is the same for print screen, except you are stuck with hooks and can't use things like policys to disable the key.
See here http://msdn.microsoft.com/msdnmag/issues/02/09/CQA/
|
|
|
|
|
Thank you for the reply.
But The capture softaware can capture.
For example,I can capture using software with timer.or I can copy desktop-view with timer.
I thought ,,,
Isn't there API what drawing the mouse cursor?
Is it impossible also by the method that using Assembly in C++?
|
|
|
|
|
Sorry, I'm struggeling to understand your English )
Are you saying you want to prevent ANY app capturing the screen, either by the "print screen" method or programmtically via something like GetDC(NULL)?
The preventing "print screen" method is easy - use a hook.
Preventing someone doing it programmtically (unless they do it programmtically by simulating a print screen key, which most don't) is MUCH more challengling. You are talking here about intercepting internal API calls and for the functions that capture the screen (killing off GetDC() will work for most of them, just make sure you only kill the call if the parameter is NULL ) ). For this, you'll need a driver - certianally on Win 9x.
For a start, go to www.sysinternals.com and download the code for RegMon - this intercepts the calls to Reg... functions and logs them - you need to do the same for functions that capture the screen and see if you can prevent the call from going any further.
Good luck, you'll need it.
|
|
|
|