|
I started to design the visual shell for my application, that is I have made several dialog windows and populated them with the required list, combo, button and labels etc...
I now have to code this application and am having trouble getting the buttons to open up the dialog windows that I made earlier. *See thread below (buttons)*
1. void CSkydiveDlg::OnCarear()
2. {
3. CMyDialog MyDialog(); // this is the 2nd dialog
4. MyDialog.Create(..parameters if needed); // create it
5. MyDialog.ShowWindow(true); // then show it
6. }
As I understand it on line 1. it's saying that when the Carear button is activated do whats in the braces. (what exactly does CSkydiveDlg:: do?)
Could someone explain line 3 to me. Where do I get the CMyDialog from, or should it be CDialog.... and is MyDialog(); any name I can make up to suit my purpose ?
On line 4. MyDialog (name created on earlier line ??) is then telling the machine to create something ?? What is it creating ?? Another Dialog window ?
Line 5. I hope I understand... It's just saying that MyDialog should now actually show it's window on the screen.
What have I screwed up that won't let my code work the button ?
Pleaseeeeeee some one heeeeeelp........
Would be really good if someone could send a tiny working program with two dialog windows, a button in the first which opens the second and closes the first.
blairstent@hotmail.com
Cheers.
P.S. If you're not living life on the edge you're taking up too much room.
From Crazy Skydiver.
|
|
|
|
|
if this is a plain old, everyday modal dialog (one that takes over the app until the dialog is closed), you don't need to use Create. just create it (line 3) and call MyDialog.DoModal(); .
if you're creating a modeless dialog then the process is much different, and you should probably check out any of the modeless dialog articles on this site.
WWJD? JWRTFM. found on /.
|
|
|
|
|
In a CP article I'm folowing, he has in the dbImages.h file (a class derived from CRecordSet)
the following:
class CdbImages : public CRecordset
{
public:
CdbImages(CDatabase* pDatabase = NULL);
DECLARE_DYNAMIC(CdbImages)
CString m_BLOBName;
CLongBinary m_BLOBImage;
What do I need to do to get the wizard to automatically put the entries in the afx_field above? Or is this put in by hand?
The article I'm referring to is at http://www.codeproject.com/database/usingblob.asp
Thanks,
ns
|
|
|
|
|
NE1 know how to get CButtonST to display muli lines on a button? I would also like to display other chars like the right arrow.
Thanks!
|
|
|
|
|
you might get a better response if you ask this question on the CButtonST page.
but, as a starting point for multi-line text, you might try finding the place where the text is drawn and add the DT_MULTILINE style to the DrawText command - just to see what happens.
-c
WWJD? JWRTFM. found on /.
|
|
|
|
|
can anyone tell me how can i disable the
combination of alt+f4 on another window
which i have its window handle (without hooking
to its window procedure)?
thanks
|
|
|
|
|
You can't do that.
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
but why?
when i create a new form in vb and
set the controlbox to false, then
alt f4 won't work. but if i copy
its window style and extended style
to another window, then in the other
window the alt f4 does work!
why does it happen?
|
|
|
|
|
Anonymous wrote:
why does it happen?
Probably VB is changing the window procedure to ignore WM_SYSCOMMAND/SC_CLOSE when controlbox property is set to false.
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
|
Anonymous wrote:
r u sure?
WTF are you trying to say? Keyboard is destroyed??
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
|
Do you have any problems with the following letters on your keyboard: 'y', 'o', 'a', 'e' ??
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
no!
i have problems writing at these late hours.
however you can't judge me Mr. WTF, can't you?
10x
|
|
|
|
|
Anonymous wrote:
however you can't judge me Mr. WTF, can't you?
I can't, but even if I could, I wouldn't want to.
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
so i see that you can't help me
with my question, can you?
|
|
|
|
|
I have told you all I know in earlier posts.
Tomasz Sowinski -- http://www.shooltz.com
What is "scratch" and why can everything be made from it?
|
|
|
|
|
You must remember three things:
- Windows doesn't make sense a lot of the time.
- VB makes sense even less of the time.
- Some styles are only taken into account when a window is created.
Don't waste your time worrying about it; just handle WM_CLOSE and rest easy.
---
Shog9
If I could sleep forever, I could forget about everything...
|
|
|
|
|
ok, but how can i handle WM_CLOSE from
a different application?
|
|
|
|
|
You could probably install a global hook, or subclass the window or something; i've never had the need, so i can't really give you anything concrete. I'm starting to get curious; what's the requirement for strange task? (if you don't mind sharing)
---
Shog9
If I could sleep forever, I could forget about everything...
|
|
|
|
|
Why can't you hook...???
I must say what a strange thread for VC++ forum...
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hockey wrote:
what a strange thread for VC++ forum
you should hang out here more often! people are constantly asking stuff like this. how can i intercept all keystrokes/mouse actions? how can i prevent windows from moving? how can i intercept file I/O from other processes? how can i select menu items/click buttons/enter text/etc in other processes? how can i change text on windows in other processes?
i'm totally afraid of the kinds of apps they must be making.
WWJD? JWRTFM. found on /.
|
|
|
|
|
Actually I was referring to the exchange of words Anonymous and Tomasz had...it was kinda amuzing in this forum...considering most threads here are strictly technical. I thought it was funny...
Something for the lounge almost...
Cheers
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Is there any template class in STL that I can use to see if there are duplicates of a type? And, if so how many? I mean will any of these containers at least give you an error so that you know it is already in there?
Let's say I use an array or map or multimap, when I add a object of the same value, it notifies me so that I can keep track of how many duplicates I have. Would be nice if it did it automatically.
Example: I have a container of shorts. I add the values 1204, 1033, 1422, and then 1204 again. I don't really need 1204 added again, I just want some counter for 1204 to increment to 2. Later, I only want to print out containers that have duplicates and add the count of all the duplicates together? Actually, for now I don't even need the containers, I just need the count of duplicates.
Oh yeah, I guess I should say speed is sort of an issue here. I have to add up to 500 of these 4 digit octal code values within 4.6 secs mininmum. I don't want it to take long to find duplicates. Meaning, I don't want to have to do a for loop to find a duplicate, I'm hoping STL will do it for me via a hash or something. And everytime I add one of these values, I want to update the duplicate count immediately.
|
|
|
|
|
Set and map will both contain only one value the same, map will overwrite the old one if you put one in the same. You can check yourself if a value is there with any container by checking like this:
mycont::iterator it = find(mycont.begin(), mycont.end(), value);
if (it != mycont.end()) // then the value is there
If a container has a member find function ( such as list does, from memory ) you should use that instead
I believe the STL also has algorithms to count duplicate values. You could certainly write a functor to use with accumulate to count the value of adding duplicates. If you want something more specialised in how it handles duplicate values, that impliments reference counting, you may need to write it yourself. I have never used a hash_map ( which is a non-std container, but present in .NET and also in stpport ), but it's concievable that a good hash algorithm will fill each bucket with only entries of the same value.
Christian
We're just observing the seasonal migration from VB to VC. Most of these birds will be killed by predators or will die of hunger. Only the best will survive - Tomasz Sowinski 29-07-2002 ( on the number of newbie posters in the VC forum )
Cats, and most other animals apart from mad cows can write fully functional vb code. - Simon Walton - 6-Aug-2002
|
|
|
|