|
I have several buttons in a dialog based program. I want to be able to click or press enter on one button and have the focus move to another button. I have gotten the focus to move using:
GetDlgItem(BUTTON_NAME)->SetFocus();
However when I press enter the nothing happens because the button isn't highlighted.
How can I fix this?
Could I fix the problem by setting the default button instead of changing the focus. If so, how would I do that?
|
|
|
|
|
SendDlgItemMessage(hDlg, <ID of current default push button>,
BM_SETSTYLE, BS_PUSHBUTTON, (LONG)TRUE);
SendMessage(hDlg, DM_SETDEFID, <ID of new default push button>,0L);
SendDlgItemMessage(hDlg, <ID of new default push button>,
BM_SETSTYLE, BS_DEFPUSHBUTTON, (LONG)TRUE);
Try this code. DEFPUSHBUTTON is what you need to change, no the focus.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Your suggestion worked with the following changes.
1) The functions do not take the hDlg parameter.
2) SetFocus() is needed to point the keyboard to the default button.
The revised code follows:
SendDlgItemMessage(<ID of current default pushbutton>, BM_SETSTYLE, BS_PUSHBUTTON, (LONG)TRUE);<br />
SendMessage(DM_SETDEFID, (<ID of new default pushbutton>, 0L); <br />
SendDlgItemMessage(<ID of new default pushbutton>, BM_SETSTYLE, BS_DEFPUSHBUTTON, (LONG)TRUE);<br />
GetDlgItem(<ID of new default pushbutton>)->SetFocus();
|
|
|
|
|
Excuse me is there any ActiveX for Control the Bitmaps or Images and Draw them or it can change the position of images ???
something for managing images.
if u want to know what i am going to do plz See this AVL tree :
http://www.seanet.com/users/arsen/avltree.html[^]
regards
|
|
|
|
|
hi everyone,
i tried to create a installer for my application using visual studio .net's 'setup and deployment project'/'setup wizard'/'create windows installer'. my project name is 'setup'. i create the installer after i choose all the files that i wanted to be included in the installer and 5 files are created. they are: setup.msi(88kb), setup.ini(23b), setup.exe(65kb), instmsiw.exe(1.8mb) are instmsia.exe(1.7mb). btw, i'm running winxp pro.
my questions:
1) how do you create an executable installer with just 1 file(that will install the application) instead of 5 files?
2) what are the uses of instmsia.exe and instmsiw.exe? i've tried to install the application with these 2 files removed(instmsia.exe and instmsiw.exe).. my application is still installable without these 2 files.. can i just distribute my application without these 2 files? since my application is small in size and these 2 files are taking up alots of space..
|
|
|
|
|
Hello,
Q1: I dont think its possible using VS.Net
Q2: the files that you have mentioned are requied to install the windows installer service if the same is not present on the target machine. The service in available by default in W2K and above. if the service s not found then setup.exe installs the installer service using these files, and then proceeds to the installation of your package.
For more information check out the windows installer documentation / SDK available on MSDN.( Sorry i dont remember the exact link)
regards,
M$
|
|
|
|
|
i have a problem.
i want to Drag-n-Drop some bitmaps in the main window.
for this job i can use CImageList that do this job, but it can only Drag one BITMAP per each Drag-n-Drop Opearation.
i can Draw Bitmaps on Main window and capture Mouse movement and when i want to drag a bitmap fisrt Clean the Previous Bitmap and then Draw the new one. but if i do this the Sence will flicker badly.
i can use some CWnd Object in the main Window and then Draw the Bitmaps in them and then Control the position of Windows by Capturing the mouse movement. i don't like this one i dunno why.
So if there are any other Technique plzz tell mee. i realyy need itt
|
|
|
|
|
-=Ehsan-de-Burge=- wrote:
i don't like this one i dunno why
I dunno why either, because it's the nice way to do it.
Draw in OnEraseBackground to eliminate flicker. Double buffering is also nice. Check out some CP articles on flicker to help here.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
thanks mr Christian. i think in Visual Section u r the Mastership of this Site.
best Regards.
|
|
|
|
|
When I build a UNICODE project, it always result the error below:
LINK : fatal error LNK1104: cannot open file "c.lib"
but I did not use the c.lib library at all,
who can please tell me the reason?Thanks.
|
|
|
|
|
1. search your include files for something like(might not be exact) :
#pragma comment( lib, "c.lib" )
2. recheck your linker settings for additional dependancies
|
|
|
|
|
thank you for your reply.
Sure,I have check all of above,but find nothing
It puzzle me too much
|
|
|
|
|
How could I get if a user have "administrative privileges" ??
[]'s
Cris.
|
|
|
|
|
check out MSDN's "Windows NT Security in Theory and Practice". AccessCheck is one of the API names you should probably use.
|
|
|
|
|
Hi:
Does anyone know how to disable a button that has a bitmap on it? I'm trying with EnableWindow(TRUE/FALSE) and it disables the button but the bitmap it's gone. Any ideas? One more thing, the buttons are in a dialog. Any answer is more than welcome.
Have a good day,
Luis E. Cuadrado
)
|
|
|
|
|
What kind of button is this? I mean, it's not your plain-vanilla CButton, right? Could it be that it's expecting a bitmap for the "Disabled" state, which you haven't provided?
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
plain-vanilla CButton...that was a good one
Well, I think is a CButton because I added a member varialbe using Class Wizzard, and the button has an object ID. To be honest, I didn't wrote the code to make the button enabled and working. Someone else did it and is not with us anymore. I worked with the regular buttons before, but not with those that have bitmaps on it. I was looking arround the code and this is what I think the other person did:
m_autoBitmap.LoadBitmap(IDB_AUTO);<br />
::SendMessage(::GetDlgItem(m_hWnd, ID_AUTO_BTN), BM_SETIMAGE, IMAGE_BITMAP, (long)m_autoBitmap.operator HBITMAP());
Does this helps? If you need anything else let me know.
Thanks again Alvaro,
Luis E. Cuadrado
)
|
|
|
|
|
Check the properties for ID_AUTO_BTN (in the resource editor). Make sure it has "Bitmap" checked.
I'm not familiar with regular buttons with bitmaps, using the CButton class. You may want to consider using the CBitmapButton class instead which handles 4 different images for the different states. I don't know if CButton handles the Disabled state properly.
Regards,
Alvaro
Well done is better than well said. -- Benjamin Franklin
(I actually prefer medium-well.)
|
|
|
|
|
I am attempting to use a boolean variable to terminate the calculation loop of my program early in case overflow will occur. I would like for my program to continue normally displaying the partially calculated factorial value and processing additional input. Right now it displays an error message and then shows the overflow value and terminates. Please help.
const int MAXCOUNT = 4;
int main()
{
unsigned long product = 1;
unsigned int n, counter = 0;
int i=0;
bool overflow=false;
while (counter <= MAXCOUNT && !overflow)
{
cout << "Enter a non-negative integer:";
cin >> n;
do //calculate n!
{
i++;
if (product > (ULONG_MAX/i)){
overflow = true;
if (overflow = true){
break;
cout << "Error! Value beyond limits. " << endl;
}
break;
}
product = product * i;
} while (i < n);
i=0;
cout << "The value of " << n << "! is " << product << endl;
cout << counter << endl;
counter++;
product=1;
cout << counter << endl;
|
|
|
|
|
if (overflow = true)
you could try changing that line to
if (overflow == true)
and it might help a bit. Can't spot anything just now other than that though, hope you can get it fixed up.
|
|
|
|
|
One way to eliminate hard to see syntax errors like this one is to always put the constant on the left hand side.
if( true == overflow )
You will get a compile error if you try to put
if( true = overflow )
when you wont with
if( overflow = true )
Just my $0.02
Bret
|
|
|
|
|
I test a dialog base program about CEdit subclass. I have Subclass My CEdit, when I input some characters then press enter key, the cursor only move one character. I add muti line with TRUE (Design), when I press enter key, my program exit. This why? How I do?
|
|
|
|
|
Richard White wrote:
I add muti line with TRUE (Design)
And I think you must add the flag "want return" in the same tab where you've found "multi line"
I think...
Hello World!!!
from Raphaël
|
|
|
|
|
Moreover, If you want add some line text with your code you must use a carriage return + line feed caracters (that's: "\015\012" ) for a new line...
Hello World!!!
from Raphaël
|
|
|
|
|
The Enter probably presses the default button (OK). New line in edit is inserted by Ctrl+Enter. You need to set the "Want return" style for the edit box in resource editor.
Pavel
Sonork 100.15206
|
|
|
|