|
Look up SetWindowPos, you can tell it not to move or resize the window with something like SWP_NOMOVE | SWP_NOSIZE, then there are flags you can set for the position in the Z order.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Can you give me a example code?Thanks
|
|
|
|
|
Not off the top of my head, type SetWindowPos into google and you'll be right.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I use SetWindowPos(&wndBottom,0,0,0,0,SWP_NOSIZE | SWP_NOMOVE) in OnCreate(),
but I can't see any effect.
|
|
|
|
|
From memory, there is wndBottom and also wndBottomMost. I believe the difference is that one moves it to the bottom and the other causes it to stay there.
I've not done any MFC for a good 18 months, so this is pretty rusty sort of advice, sorry
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Never mind,My dear friend,Thanks for your warmhearted advice.
|
|
|
|
|
i've got my new you-beaut program ready to roll except for one thing, my program on the USB drive must autorun once it is connected..
I've been doing a bit of research on making my USB drive to autorun. Based on what i've gathered, "the device must not be marked as a removable media device" - <http: www.microsoft.com="" whdc="" hwdev="" bus="" usb="" usbfaq.mspx="">
would anybody know how to achieve this??
(i've considered writing a hook application to handle the autorun side of things. but i would consider this as the very last option)
thanx all
|
|
|
|
|
Hi,
I've just started to use the mfc CPropertySheet and CPropertyPage classes. I've created 2 dialog resources, linked them to CPropertyPage based classes, added them to a CPropertySheet and displayed them. The tabs come up correctly and the dialog content is displayed correctly...
*BUT* I have combo boxes in each of the dialogs. When the button on the combo box is pressed to view the combo options of the box, you can't click on any of the options. No clicks anywhere in the property sheet dialog do anything. You can press the esc key and the combo options box disappears, allowing you to click on the form again.
I really need these combo boxes to be working. Is it something easy to modify to fix, what could be the problem? Any help with the solution would be great!
Thanks,
Dave
|
|
|
|
|
Hi,
I am very curious as to what you did wrong. I just set up a very simple project in a few minutes with the same description as you gave here, i.e One property sheet and two proprty pages each with a ComboBox and the project builds and compiles and runs fine. I can select either combo box and then select a new item. Have you done something different like overiding the draw of the combo boxes or anything.
Check that the properties of the combo box are set as they would be for the default behaviour.
Mark.
|
|
|
|
|
Check that the height of the dropdown lists (in the resource editor) of the combo boxes is long enough.
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Yeah, that's ok, I can see all the items I put in the dropdown lists, but I just can't click on them.
My main app is modeless dialog based.
Thanks,
Dave
|
|
|
|
|
|
I remember this!! (But it was fixed in MFC 4.2)
/ravi
Let's put "civil" back in "civilization"
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
The problem still exists when a property page has an embedded property sheet - the focus gets all messed up and locks up the application (I'm using VC6).
Steve
|
|
|
|
|
Hi,
I tried opening a file in a edit box using the following code
CFile ComFile(triccomfilename,CFile::modeRead);
DWORD dwSize = ComFile.GetLength();
Buffer = new TCHAR[dwSize];
ComFile.Read(Buffer, dwSize);
ComFile.Close();
ccedit->SetWindowText(Buffer);
The code works perfectly, but the problem is that I get some extra characters in the edit box, for example if the file contains "HELLO" , then the edit box displays, "HELLO yyyyYYYYYYYYYYYYYYA". I dont know why it happens , can anyone help me out?.
Thanks,
Deepak Samuel
|
|
|
|
|
You're not initialising the buffer to be null, so your string includes any guff that was in that memory until it finds a null. Do this:
Buffer = new TCHAR[dwSize + 1];
::memset(Buffer, 0, dwSize + 1);
I *think* that the value to set comes in the middle, then the size. If this does not work, swap the last two parameters.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Thanks a lot..It worked..
Regards, Deepak Samuel.
|
|
|
|
|
I have kind of a strange problem which I hope someone here can offer some advice on. I have a kind of options dialog which is popped up from within another dialog.
In the 2nd dialog I get a couple of numbers and an option from the user and then return. The problem I ran into was how to get control long enough to do an UpdateData to move the screen data into my variables.
The only thing I could think of was to change the OK button from IDOK to ID_BEXIT and use this code;
void TimeGet::OnBnClickedBexit()
{
UpdateData(TRUE);
CDialog::OnOK();
}
This works ok but it does a strange thing. I have to click the OK button twice in order for the 2nd dialog to close and control return to the first.
Does anyone have any idea why I need to click OK twice? Or perhaps a better way of accomplishing the task.
Thanks!!
Karen
|
|
|
|
|
You don't need to change to ID, you just need to override the method that gets called when you click 'OK'.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Christian,
That was my first thought, but I can't find exactly what to override. There is no reference to IDOK anywhere in the diaog except the one I put threre. Any hints?
Karen
|
|
|
|
|
Are you using VC6 or VC7 ? If the former, hitting CTRL-W definately brings up the wizard and the OnOK is listed ( as a specific message, not as a button with the others, from memory ).
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I found where IDOK could be overridden and overrode it. Unfortunately, it still takes 2 clicks on the OK button to terminate the dialog.
|
|
|
|
|
Hmph. If you take out the call to UpdateData, is this still the case ( I know you need the call, just trying to figure out what's going on ) Do you have a cancel button ? Does it close the first time it's clicked ?
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Ths is the code I am using to call the 2nd dialog;
TimeGet TimeGetDlg;
TimeGetDlg.DoModal();
if(TimeGetDlg.DoModal() == IDOK ) {
TG_AlarmHH= TimeGetDlg.HH;
TG_AlarmMM= TimeGetDlg.MM;
TG_AlarmAMPM= TimeGetDlg.AMPM;
}
and in the 2nd dialog, this is the overriden OK code;
void TimeGet::OnBnClickedOk()
{
CWnd* pWnd;
pWnd=GetDlgItem(IDC_HH);
pWnd->GetWindowText(HH);
pWnd=GetDlgItem(IDC_MM);
pWnd->GetWindowText(MM);
CDialog::OnOK();
}
What is happening is that when OK is clicked the first time, control returns to the 1st dialog at the if statement. The if fails and the 2nd dialog pops up again. This time when OK is clicked, control again returns to the if statement in the first dialog but this time the if succeeds and everything proceeds normally.
I have to admit that at this point I am totally lost.
Karen
|
|
|
|
|
Oh, I almst forgot, the CANCEL button works fine.
|
|
|
|