|
pani68 wrote: Now it is working fine.
Excellent - that's the desired outcome
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
I am using unicode in my Program.i have stored a CString value into const void* variable.now i want to convert a const void* into CString where i am unable to convert .
|
|
|
|
|
Assuming the void pointer is called lpvoid, do this -
CString cstring(reinterpret_cast<wchar_t*>(lpvoid));
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Can you show us how you stored the CString into a const void* ?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Hello all.
I've a dialog box application and in that i'm taking 2 bitmaps which behaves like buttons.. Initially My OK Bitmap button is disable and CANCEL bitmap button is enabled, I've one field for password, when user gives right password OK bitmap button get enabled and i can click on that....Now my problem is that despite of clicking if user presses ENTER key it should behave like mouse click...
So intot i need to know how to capture Enter Key.. Small search gave me that i need to handle WM_KEYDOWN and VK_RETURN...
Thanks all
|
|
|
|
|
Assuming you are using MFC, simply override the OnOK() and OnCancel() in you dialog class.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Damn.. I always forgot to tell you guys it's NON-MFC..
Sorry ..
|
|
|
|
|
Hey!
On a side note: having a button that gets enabled when a correct password is entered makes it a bit easier to guess the password by bruteforce (or/and maybe other methods) because one only has to write a program that enters a password and then checks the state of the button, if it is disabled, it tries the next possible password and checks the button again until the button becomes enabled... althorough you can add a -let's say- 3 seconds pause if a wrong password is entered before the user is allowed to enter the next password, this makes it take much much more time to hack.
Aside of this, did you try handling WM_KEYDOWN? Did it work?
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Code-o-mat wrote: Hey!
On a side note: having a button that gets enabled when a correct password is entered makes it a bit easier to guess the password by bruteforce (or/and maybe other methods) because one only has to write a program that enters a password and then checks the state of the button, if it is disabled, it tries the next possible password and checks the button again until the button becomes enabled... althorough you can add a -let's say- 3 seconds pause if a wrong password is entered before the user is allowed to enter the next password, this makes it take much much more time to hack.
That's not the issue
Code-o-mat wrote: Aside of this, did you try handling WM_KEYDOWN? Did it work?
Yes i did.. But it's not working, i tried WM_CHAR also same result
case WM_CHAR :
{
switch(LOWORD(wParam))
{
case VK_RETURN:
MessageBox(hWnd, "Enter Pressed", NULL, NULL);
}
}
case WM_KEYDOWN :
{
switch(LOWORD(wParam))
{
case VK_RETURN:
MessageBox(hWnd, "Enter Pressed", NULL, NULL);
}
}
P.S
BTW the default focus is in password (Edit) box only, Does this create any problem?
|
|
|
|
|
Try catching WM_COMMAND with IDOK as command id.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Code-o-mat wrote: Try catching WM_COMMAND with IDOK as command id.
There's no button in my dialog box, I deleted all, I needed custom buttons so i'm using BITMAP's for that
I also don't want to create button as IDOK and make it invisible.. I hope you're getting my problem..
|
|
|
|
|
You don't need a button for that, if you are using MFC and override OnOK, it will be called when you hit enter EVEN if there is no IDOK or any other button for that matter on your dialog. I am not sure how it works without MFC but it might be worth a try. The keyhits go to the window that owns the input focus so that explains why WM_KEYDOWN in your dialog doesn't work...
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
Wow..Your last reply makes it real small problem .. Thanks a lot...
Problem solved
|
|
|
|
|
Great, yourwelcome.
> The problem with computers is that they do what you tell them to do and not what you want them to do. <
> Life: great graphics, but the gameplay sux. <
|
|
|
|
|
void CMainWindow::OnPaint ()
{
CPaintDC dc (this);
CBrush brush (RGB (255, 0, 0));
dc.SelectObject (&brush);
dc.Ellipse (0, 0, 200, 100);
}
Here's the problem. A CPaintDC object and a CBrush object are created on the stack. Since the CBrush is created second, its destructor gets called first. Consequently, the associated GDI brush is deleted before dc goes out of scope.
Please can u explain the concept of the above lines in detail....
|
|
|
|
|
You could always create the brush before the DC....
p_1960 wrote: Please can u explain the concept of the above lines in detail....
Which concept? That objects allocated on the stack are destructed strictly in the opposite order to which they were created?
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
p_1960 wrote: Please can u explain the concept of the above lines in detail....
Nope, Got better things to do! (Sun is shining...)
But you are right to be slightly concerned.
The brush returned from SelectObject should have been selected back in. You'd almost certainly get away with the code as it is, but "get away with" is hardly good programming.
Better:
void CMainWindow::OnPaint ()
{
CPaintDC dc (this);
CBrush brush (RGB (255, 0, 0));
CBrush *brOld = dc.SelectObject (&brush);
dc.Ellipse (0, 0, 200, 100);
dc.SelectObject (brOld);
}
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|
Hi,
I was wondering if there is a way to retrieve contents of a control(let's take list control) of another application? I think we can reach the control via FindWindowEx. But how we retrieve the contents?
Thanks a bunch!
Neil
|
|
|
|
|
If you have the window handle, you can send it messages. Like, for example, LVM_GETITEM[^], which you use to retrieve item details from a list control.
However, I'm unsure if it'll work cross-process. Try it and see!
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Stealing Program's Memory[^]
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
I am working in a company with a lot of FREE time. Newly we've got a desktop computer for our office, but with a LIMITED user. One of the most terrible limitation is that we are not able to install ANYthing. Is there a way to get around this problem. By the way! Is there any way to recover ADMINISTRATOR password?
Thank you masters!
|
|
|
|
|
You can ask somebody who knows the password for it.
If it was so easy to do it that you expect a reply for this, Windows would have been long gone.
I mean who would want to use an OS which can be very easily compromised.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Frankly speaking! I knew this! But I got a brother who doesn't trust me and still believes there must be a way to do that. I just wanted to prove my word !!! that's why I said STUPID question ...
Thank you masters!
|
|
|
|
|
Suuuuuure, it was your brother. I believe you. Really!
Iain.
In the process of moving to Sweden for love (awwww).
If you're in Scandinavia and want an MVP on the payroll (or happy with a remote worker), give me a job!
|
|
|
|
|