| View previous topic :: View next topic |
| Author |
Message |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Thu Apr 29, 2010 6:32 am Post subject: |
|
|
the parent is supposed to stay always visible. in your case hMIDialog should always be visible. inside hMIDialog is a tab control. inside that tab control, are all of your children dialogs of hMIDialog.
on initialisation, only the child dialog corresponding to the first tab should be visible. when you click the second tab, the currently displayed child dialog should be hidden and the child dialog for the second tab shown. as you can see nothing ever happens to the parent window, hMIDialog. because the hTabs are children of the hMIDialog, there should also only ever be one entry on the windows taskbar which should not disappear since you are never hiding hMIDialog.
your parent is not one of the tabs, it is hMIDialog. if you still can't get it working zip up the whole project and upload it
|
|
| Back to top |
|
 |
zile Advanced Cheater
Reputation: 0
Joined: 11 Jul 2009 Posts: 75
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Thu Apr 29, 2010 7:39 am Post subject: |
|
|
okay i see the problem, it's because it's making a tonne of extra windows. it is most likely to do with your dialog creation code. i'll look into it now
http://img188.imageshack.us/img188/7371/63530522.png
btw, i got 1 problem so far. i'm guessing you made your resource file in resedit or something because vc++ is having trouble loading it, which has always happened to me with resource files created in resedit.
changes i've made so far :
1 ) anyway, the first problem i see is you assigning hEnd and then using that in all your other dialogprocs. the main window should only be closable from that main window itself. none of the children should even have a wm_close.
so first thing i'm doing is getting rid of those, and moving the wm_close handler into MIDialog
2 ) call dialogboxparam instead of dialogbox so i can pass hModule without the use of a global constant. this is better code organisation since you have less dependencies
3 ) the code for handling tab changes should be in MIDialog, the children dialog procs are only for handling messages that occur within the tab content itself
4 ) you are only hiding specific windows in your handling of the TCN_SELCHANGE. it is not a specific one you need to hide, just the last one that was 'active', ie. the one corresponding to the last active tab
5 ) your code for handling TCN_SELCHANGE should be if/else if not if.. if.. if..
6 ) code for inserting tab items should be in the main hMIDialog procedure, not the children ones
7 ) changed your insertions to be done via the TabCtrl_InsertItem macro
8 ) LPTSTR does not just mean typecasting a constant string to LPTSTR...... may fix this later
9 ) you made the tab control in all the children procs and not the main dialog.. also your children dialogs do not have the child flag set..
10 ) children dialogs should not have sysmenus or captions
11 ) oh i meant to say the children dialog should be created with the parent as the handle to the tab.. not the handle to the dialog holding tab
12 ) you have duplicate definitions for a lot of your resource controls
Last edited by Slugsnack on Thu Apr 29, 2010 8:29 am; edited 2 times in total |
|
| Back to top |
|
 |
zile Advanced Cheater
Reputation: 0
Joined: 11 Jul 2009 Posts: 75
|
Posted: Thu Apr 29, 2010 8:12 am Post subject: |
|
|
i just made the main dialog before i uploaded the code, so i didnt do much to it, and i removed the child becuz the window didnt show up before in the old code
thanks alot
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Thu Apr 29, 2010 8:43 am Post subject: |
|
|
okay i've changed quite a lot, here are the updated files for :
- Memory Infiltrator.cpp
- resource.h
- Window.rc
the code is almost workable but i have to go revise for an exam tomorrow now. whatever there is left to change, it is something really small.
btw for the time being, i made it so when you change tabs, it hides all other tab contents and only displays the right one. to improve efficiency, you should have a global or static which keeps track of the last tab that was active so you only hide those contents.
for some reason, at the moment, only the 'scan' tab is working properly and it's not even being created as a child properly. nevertheless, the main changes have all been made and i'm sure to get it fully working you only need to fiddle some small parts. also if you read my code, you should be able to understand how the tab control works, etc.
i'll take another look tomorrow if you're still stuck by then. also you should probably get rid of the stdafx.h crap, it's not needed for a small project like yours.
if you're not sure where to go from here, try to figure out why the scan tab can be shown. after you make all the other tabs show properly, then worry about positioning and making them proper children ( not having a border and clipping properly ). i have a feeling the cpp code itself is fine now and you just need to fiddle with the resource file, but i'll leave it up to you
download new version here
|
|
| Back to top |
|
 |
zile Advanced Cheater
Reputation: 0
Joined: 11 Jul 2009 Posts: 75
|
Posted: Thu Apr 29, 2010 9:48 am Post subject: |
|
|
| ok... i tried it, and it shows me the result tab instead of scan tab? , and when i try to use my resource ( fixed it ) no tabs can be seen, i think i got how it works down, so im gonna start from scratch again
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Thu Apr 29, 2010 11:54 am Post subject: |
|
|
| oh btw you might want to call initcommoncontrolsex
|
|
| Back to top |
|
 |
zile Advanced Cheater
Reputation: 0
Joined: 11 Jul 2009 Posts: 75
|
Posted: Fri Apr 30, 2010 6:33 am Post subject: |
|
|
| Uhh, how do you make the child window to be under the parent window? Its currently blocking my parent window tab so i cant click it..
|
|
| Back to top |
|
 |
Slugsnack Grandmaster Cheater Supreme
Reputation: 71
Joined: 24 Jan 2007 Posts: 1857
|
Posted: Fri Apr 30, 2010 9:44 am Post subject: |
|
|
| oh, for that i changed the initial coordinates of the children controls via the code in the resource file
|
|
| Back to top |
|
 |
zile Advanced Cheater
Reputation: 0
Joined: 11 Jul 2009 Posts: 75
|
Posted: Fri Apr 30, 2010 11:46 am Post subject: |
|
|
| alright im finally done with this, thanks
|
|
| Back to top |
|
 |
|