|
// 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.
|
|
|
|
|
I am sorry that a reply is overdue.
The your explanation is filtering driver?
I don't want to install dll file in system directory.
I want to realize using exe file as much as possible.
It cannot but give up, if impossible.
But Thank you very much,Diddy!
|
|
|
|
|
You're welcome It is a tricky one to do, essentially you are trying to disable a Windows API call, not trival by any means.
You might want to look at http://research.microsoft.com/sn/detours if you don't fancy doing a driver.
You don't strictly need to use a driver, if you only wan't to run on NT/XP or 2k. Look at the code for RegMon as suggested.
Running on the other platforms (95, 98 and ME) is more tricky, but still possiable without using a driver.
I have only ever written things to intercept API calls - never to complete disable them - though you may be able to do it like that - when you have a call to GetDC(NULL) come through (which would give you a device context to the "desktop window" - IE the complete screen - it's how most sceen capture programs work) you could simply return a DC that has a dummy bitmap in it - it's quite easy to do.
Good luck
|
|
|
|
|
Hi,
I would like to delete all the characters after ".pvd" in a CString variable.
How can I keep all the characters before and including ".pvd" and delete all the characters after it???????
Ehsan Behboudi
|
|
|
|
|
CString str = "test.pvd sth"
int index = str.Find(".pvd");
if(index == -1)
return;
str = str.Left(index + 4);
It should work, though I did not compile it
See CString class header for all possible methods
:P
|
|
|
|
|
You use the combination of Find and Delete member functions. An example:
CString csText = "I am .pvd and I rock the world !";<DIV>
csText.Delete( csText.Find(".pvd") + strlen(".pvd"), 4000 ); This code fragment would look for the starting point of the ".pvd", then move forward based on the length of the search string, and delete from this point forwards until 4000 characters are removed or the end of the string is reached (more likely).
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Antti Keskinen wrote:
csText.Delete( csText.Find(".pvd") + strlen(".pvd"), 4000 );
I think that this doesn't work
Carlos Antollini
Do you know piFive[^] ?
|
|
|
|
|
A quick Win32 console application supporting MFC on the .Net 2003: The code issued for the compiler:
CString csText = "I rock the .pdv world !";<DIV>
csText.Delete( csText.Find( ".pdv" ) + (int)strlen(".pdv"), 4000 );<DIV>
AfxMessageBox( (LPCTSTR) csText, MB_OK ); This code fragment, when run, displays the console window and pops up a message box reading: "I rock the .pdv". Logical conclusion: the code works, and your assumption of it's non-functionality was misplaced.
I know your reply comment was meant humorous, but please.. I am tired of fixing things that aren't broken just because there are people in the wide world who think they know better. I don't mean anything malicious with this nor do I want to make you feel bad in any way, but I just don't find it funny. If you believe that you have more accurate information over a matter, present it, and perhaps point out the things that are incorrect in the earlier postings.
It's just that this time, I was correct, you were wrong, and the code worked flawlessly and did precise what it was supposed to do. Perhaps next time, the situation will be reversed, and I'll be the one in need of learning new stuff
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
Hello, I'm new to this forum/website/ and C++!
The problem I'm having is that my loop repeats even when I enter a value of 'Y', 'y', 'N', or 'n'. I want it to break after one of these values have been entered and return it. Please advise.
Even if I enter Y, N, y, or n it still does the while loop. I'm trying to get it to repeat the loop ONLY if the value of the variable isn't one of the above. Please advise.
char searchAgain()
{
char rSearch;
do
{
cout << "Search again? (Y/N): ";
cin >> rSearch;
}while (rSearch != 'Y' || rSearch != 'y' || rSearch != 'N' || rSearch != 'n');
return rSearch;
}
"Criticism comes easier than craftsmanship" - Zeuxis
|
|
|
|
|
CarteBlanche wrote:
(rSearch != 'Y' || rSearch != 'y' || rSearch != 'N' || rSearch != 'n');
Change the || to && and it should do what you want.
right now you're saying if it's not Y or y or N or n, then continue looping... but, if you switch it to "if it's not Y and y and N and n", it'll exit the loop. or, it should at least.
|
|
|
|
|
Ahh, ok. That makes sense now. Thank you kindly
|
|
|
|