|
That's because I didn't know nothing about this other method...
I'll try it...
And thank you very much!
|
|
|
|
|
Hello,
I have two dialog windows with edit boxes in C++ MFC (Multiple document interface). Through menu bar in my GUI interface I am opening one dialog window and entering set of data in edit boxes and closing that window to open another dialog box to enter another set of values in edit boxes. After closing second dialog box, there is Menu item called "execute" to run my code routine by using the values entered in previous edit boxes in Dialog windows. And the result should be displayed in Listbox control. Can somebody help me out with code example. I am a beginner and trying to learn for one of my assignment. I apprecaite any help.
|
|
|
|
|
How much have you alreaady done ? Where are you stuck ?
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Here are the steps I am trying to do.
1) I am opening 'Dialog A" which contains edit boxes from Menu item "Menu A". I am entering data in edit boxes and I am closing it. It doesn't have any buttons.
2) I am opeing "Dialog B" by using Menu Item "Menu B" to enter another set of data in edit boxes. Similarly no buttons on this dialog and I am closing this also after entering data.
3) I have to caputure the data entered in "Dialog A" and "Dialog B" edit boxes. When I click on another Menu Item called "execute" ,by using parameter values entered in "Dialog A" and "Dialog B" to perform my logic and the result should be diaplyed in Third Dialog window Called "Dialog C" which has List box Control. The "Diolog C" has only list box Control.
I am having problem in getting the data entered in "Dialog A" and "Dialog B" in a function which is called upon on Clicking 'Execute" Menu Item.
I hope this clarifies my problem.
Thanks.
|
|
|
|
|
The existence of the three dialogs sounds like bad design, although that might just be because I have no idea what they are for, or what other potential paths of execution exist.
When your dialog is closed, any data in edit boxes, etc. that you had in those dialogs is gone. There fore you must create variables of type CString or int, or whatever, and stuff your values into those in your dialog boxes closing method. When your dialog box instance goes out of scope ( i.e. the function that created it ends ) then it's contents are deleted, so you need to have a member variable of your Mainframe, or whatever class handles the menu items, and store the values from the dialog box there within the function that created the dialog. Since you have three menu items, you need to initialise these values to some known, but impossible to enter, value, so that you can check if someone chooses menu item 3 before entering data into the first two menu items.
Then when you call dialog three, you can make the default constructor private ( so it cannot be called ) and create instead a constructor which takes the values it needs, and pass them in from your member variables.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Hello,
I've created a .ico file contains the 16x16 256 color icon for tray icon and load the icon with LoadImage. When I load the icon from Windows ME/XP it looks fine, however, it doesn't look good in Win 98/2K. The color of the tray icon has changed. Do you have any idea what's going on?
Thanks,
Hiusing
|
|
|
|
|
Windows 2000 and windows 98 only support 16 bit color icons in the tray.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Hello folks,
I have a basic question in C programming:
BOOL a, b, c;
if(a && b, c)
{
/*do this*/
}
else
{
/*do that*/
}
What does the "," in the if condition signify?!?
Thanks!!
|
|
|
|
|
The comma operator performs the operation to it's left, and returns the result of the operation to it's right.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Does this mean that if, in my example, a and b are TRUE, then the comma operator will set the value of c to TRUE?
Thanks!!
|
|
|
|
|
Um.... no. It means if you had this:
if (a *= 7, a%2 == 0)
{
}
then a will be multiplied by 7, and if a if an even number ( a mod 2 = 0 ) then the if statement will succeed. Either way, a will be multiplied by 7.
Christian
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
The comma operator evaluates the left side, then the right side, and returns the value of the right side. So the value of the expression a && b, c is c .
--Mike--
"I'd rather you just give me a fish today, because even if you teach me how to fish, I won't do it. I'm lazy." -- Nish
Just released - 1ClickPicGrabber - Grab & organize pictures from your favorite web pages, with 1 click!
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
|
The what is already answered.
The why is: the left side expression is
evaluated purely for its side effect.
Your code must be a paraphrase that's omitting
details which would explain the intent. As it
stands there is no reason for the schmoo, but
the structure is a common one.
In this case "a" was probably, without side
effect, an expression that drove "b" to be
evaluated or not (the && operator evaluates
the right side only if the left side is true,
a conditional short-circuit. That's why the
statement "a && b;" is often used as shorthand
for "if (a) b;")
The author just wanted to scrunch up his code
and place what normally would have been a
preceding conditional statement "if (a) b;"
smack dab in the next conditional
"if (c) blark; else snarf;"
i.e.
"if (a) b; if (c) d; else e;" <-->
"a && b; if (c) d; else e;" <-->
"if (a && b, c) d; else e;"
|
|
|
|
|
What I want to do is make it so that when the user wants to open a file it only shows files of that specific type, that type is .TX0, .TX1, .TX2, ... , .TX9.
Here's my code for the Open Dialog:
<br />
CFileDialog fileDlg(TRUE, NULL, NULL,<br />
OFN_OVERWRITEPROMPT | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST,<br />
"My Files (*.TX*)|*.TX*|All Files (*.*)|*.*|",<br />
NULL );<br />
I have it so it will show all files of type .TX* but that means .txt files will show up as well as my file types. Is there a way to not show .txt files but still show my files?
There's always one more bug.
|
|
|
|
|
use
"My Files (*.TX*)|*.TX0;*.TX1;*.TX2;*.TX3;*.TX4;*.TX5;*.TX6;*.TX7;*.TX8;*.TX9;|All Files (*.*)|*.*|" <br />
<br />
<div style="padding-top: 12pt; float: left"><br />
<font color="blue">Shog<font color="green"><sup>9</sup></font></font><br />
------</div><br />
<div align="right" style="padding-right: 1em; margin-bottom: -2em; font-size: 8pt; font-family: "Sylfaen"; color: rgba(64, 103, 119, 1)" title="Social Distortion - "Down Here (W/ The Rest Of Us)"">No one's immune now, from a world of problems <br />
No one's exempt now, from a world of pain <br />
That's the way that it goes <br />
when you're down here with the rest of us...</div>
|
|
|
|
|
Thx a lot
There's always one more bug.
|
|
|
|
|
If process A creates shared memory via CreateFileMapping and then process B opens shared memory via OpenFileMapping does the shared memory become invalid when process A exits? If process B stays running and now process C opens shared memory via OpenFileMapping will the shared memory still be valid?
Todd Smith
|
|
|
|
|
Docs are not conclusive, but seems like things behave as you describe. This link[^] in MSDN reinforces this impression.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I believe that if the process that creates the name file mapping exits, the mapping no longer exists.
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Thomas George wrote:
I believe that if the process that creates the name file mapping exits, the mapping no longer exists.
So what happens when the other processes try to read/write the file mapping? KABOOM? Is it possible for the other processes to know when the main process has closed the file mapping? I guess you could create a mutex or something and check that before using the file mapping.
Todd Smith
|
|
|
|
|
Actually, docs say that you HAVE to use Structured Exception Handling because the system could produce access violations (even in situations, when both are active). You will certainly get an access violation when the second app tries to access the shared memory; but I am yet to find out how the second app can find out that the file mapping no longer exists. I am not aware of any events.
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
I believe that because the FileMapping object is a Kernel object, that the file mapping will continue to exist until all handles to it are released.
Here is an excerpt from the CreateFileMapping functions remarks section in MSDN:
To fully close a file mapping object, an application must unmap all mapped views of the file mapping object by calling UnmapViewOfFile, and close the file mapping object handle by calling CloseHandle. The order in which these functions are called does not matter. The call to UnmapViewOfFile is necessary because mapped views of a file mapping object maintain internal open handles to the object, and a file mapping object will not close until all open handles to it are closed.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Paul wrotes:
I believe that because the FileMapping object is a Kernel object, that the file mapping will continue to exist until all handles to it are released.
Paul is absolutely right here. A (named) file mapping is a kernel object and will exists, until the last handle to it has been closed. So in your scenarion the mapping will still be present and valid, because at every time there is at least one valid handle to it.
BTW: Using native NT Api it is even possible to make a kernel object "persistent", meaning that it would continue to exist after the last handle to it has been closed (persistent means until next reboot). Of course this makes sense only for named kernel objects. Even if sometimes fairly useful, this is undocumented and therefore "not recommended"
--
Daniel Lohmann
http://www.losoft.de
(Hey, this page is worth looking! You can find some free and handy NT tools there )
|
|
|
|
|
I was trying to build a code sample with UNICODE enabled and it was unable to find MFC42UD.LIB. I found out that the UNICODE libs (debug only maybe?) weren't installed as part of VC6. They are on the CD just not on my drive. I couldn't find any option in the VC6 installer that enables/disables UNICODE libs. Am I missing something or do I just manually copy the libs over?
Todd Smith
|
|
|
|