|
Hello,
I was hoping someone could provide an explanation on how to open a new dialog window and close the old dialog window with a click of a button. I can create a new dialog window using:
SecondDlg myDialog;
myDialog.DoModal();
However, I have two windows on the monitor when all I want is the recently opened window. I've tried EndDialog(IDCANCEL) and DestroyWindow(), but this just seems to close both window when the OK or CANCEL button is selected.
void CVetDent_11Dlg::OnBnClickedButton1()
{
// TODO: Add your control notification handler code here
SecondDlg myDialog;
myDialog.DoModal();
EndDialog(IDCANCEL);
Thanks
|
|
|
|
|
Why not hide the first dialog (using...errrm...ShowWindow[^]) before the second dialog's DoModal ? That way, you'll only have one dialog on the screen at once, so it looks like the first dialog's been destroyed
As you've found, you can't just have DoModal then EndDialog , or vice versa, as a) DoModal blocks, and b) EndDialog terminates the current message handler.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Thanks Stuart,
That seem to do the trick. Solution code:
ShowWindow(SW_HIDE);
SecondDlg myDialog;
myDialog.DoModal();
EndDialog(IDCANCEL);
|
|
|
|
|
Reece Peterson wrote: I was hoping someone could provide an explanation on how to open a new dialog window and close the old dialog window with a click of a button.
In the button-click handler of SecondDlg, call EndDialog() with an argument that denotes what button was clicked. Back in the main window, do something like:
SecondDlg myDialog;
int nResult = myDialog.DoModal();
if (nResult == 1)
{
ThirdDlg myDialog;
myDialog.DoModal();
}
else if (nResult == 2)
{
FourthDlg myDialog;
myDialog.DoModal();
} By chance are you trying to implement some sort of "wizard?"
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
|
I have a simple ascii text file on a particular path. So
its at www.website.com/temp/notepad.txt
And the file has a few lines of data. Is there a sample
project anywhere that shows me how to access that file and
read it and make changes to it and close it on the server
side? I can download the file, do what I want to do and
reupload it with changes, but Im trying to find a way to be
efficient and just make the changes on the server side.
Is this possible?
Any response any one can give me will be greatly appreciated.
Sincerely,
Danielle Brina
|
|
|
|
|
Mmm - not without some help on the server side, I suspect. HTTP's not really targeted at opening a file, updating it and closing it again.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|
|
Do you have access to the file via a UNC path rather than HTTP? If not, then FTPing the file back and forth is likely going to be your only recourse.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
I use a ListBox to show actions performed by the program. While running, the contents becomes greater than the frame of the ListBox . I don't know how to make the ListBox to show its last lines, in order to show the user the last actions performed by the program.
In VC++6, please...
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
Use the message LB_SETTOPINDEX...
Hope thie helps!
|
|
|
|
|
Thank you!
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
Use the LB_SETTOPINDEX message (or the ListBox_SetTopIndex macro), or the LB_SETCURSEL message (or the ListBox_SetCurSel macro) if you want to select the item (LB_SETSEL to select multiple items) that has been added to the end of the list.
Regards,
--Perspx
"A refund for defective software might be nice, except it would bankrupt the entire software industry in the first year." -Andrew Tanenbaum
"Einstein argued that there must be simplified explanations of nature, because God is not capricious or arbitrary. No such faith comforts the software engineer." -Fred Brooks
|
|
|
|
|
Thanks!
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
Another option, although slightly less appealing, is to send the listbox a LB_INSERTSTRING message with 0 as the index.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
This will reverse the order of the messages?
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
RomTibi wrote: This will reverse the order of the messages?
Of course it will, hence my opening remark.
"Old age is like a bank account. You withdraw later in life what you have deposited along the way." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Thanks! I finally used your advice.
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
Hi all,
I have a struct a bit like this, which is the header to a file on disk:-
struct Header
{
short a;
short b;
short c;
float floatvalue;
}
I read the header from the disk like this:-
ReadFile(hFile,&header,sizeof(Header),&bytesRead,NULL);
Once I'd done that, the values in a,b,c are as expected, but the floatvalue is not.
However, if I adjust the struct so that instead of float, I have BYTE[4] as follows:-
struct Header
{
short a;
short b;
short c;
BYTE floatvalue[4];
}
And then after reading the header as before, I do:-
float f;
memcpy(&f,header.floatvalue,sizeof(float));
Then f contains the value expected.
I don't understand why the first version didn't work. Can anyone enlighten me please?
Thanks
Jon
|
|
|
|
|
Maybe take a look at this[^], i hope it explains what you need explained.
> 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. <
|
|
|
|
|
Thank for that, it's clear now.
Looks like a can get around the issue with #pragma pack (2)
|
|
|
|
|
I think that a
#pragma pack (1) or
#pragma pack (2) declaration before the structure's definition would help. Think so?
36. When you surround an army, leave an outlet free.
...
Do not press a desperate foe too hard.
SUN-TZU - Art of War
|
|
|
|
|
Hello Team,
I have written a C++ program, which will fetch the MAC address using the GetAdaptersInfo, and this program is compiled using gcc of mingw. when i run this program in my PC, this has return valid MAC. Everything fine.
But When I run same program , where I had a wifi card and a LAN card, this program returend both the MAC address. In my program i am chacking for MIB_IF_TYPE_ETHERNET, still it is giving both the MAC.
How do i get only MAC of LAN card ? not wifi / bluetooth card?
Thank you
glamakid
|
|
|
|
|
You could try using WMI[^] and retrieving <a href="http://msdn.microsoft.com/en-us/library/aa394216%28VS.85%29.aspx" rel="nofollow">Win32_NetworkAdapter</a> [^] instances whose AdapterType is Ethernet 802.3 ?
WMI at least separates out wireless adapters.
|
|
|
|
|
Hello
Thank you . Cant I use the GetAdapter...API itself? I am not good at usign WMI program
glamakid
|
|
|
|
|
The documentation and your experience indicate that you can't. I'm guessing that at that level of abstraction, WiFi is close enough to ethernet that they can be treated the same.
Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p
|
|
|
|