News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

tabbed windows and forcing child windows

Started by Slugsnack, July 14, 2009, 08:21:30 PM

Previous topic - Next topic

Slugsnack

hi,

i wanna make something that will force a window ( in my case a console window ) to be the child window of my program. what i wanna do at the end of the day is have something where i can force multiple console windows to be in the same parent window. then i can switch between them with tabs. like on internet browsers

my first thought.. was sort of stupid XD i was gonna make a client area which was big enough to hold a console. then move them all the consoles i wanna make tabbed into there. then i would have a button which when pressed puts each one on foreground. stupid idea.. but not sure how else to do it right now : |

dedndave

doesn't sound stupid to me - lol
that would be great for a debugger !  :U

ramguru

With tabs it's usually like this:
Initially all but 1 tab_contents are hidden
& when a certain tab is selected:
 Hide 1 window (invoke ShowWindow,win1handle,SW_HIDE)
 Show 1 window (invoke ShowWindow,win2handle,SW_SHOW)

Slugsnack

dedndave : i don't think they do though cause if you properly force it to be a part of the window.. then the top window bar would disappear or at least that's how i want it. using setwindowpos wouldn't get rid of that window bar. unless you painted over it LOL

ramguru : yeah with the tabbing i've decided to use tab controls but first i wanna work out how i can bind a window's position to within another window, i'm sure there is a way

edit : i'm thinking of using setwindowlong to change the console windows so they are child windows. then using set window to make my dialog own the child windows. not sure if that will work though. will try that tomorrow unless you guys have got other suggestions

night night  :U

donkey

Hi,

There are many examples of using tab controls with child windows, generally I use a dialog editor for tab controls, its just easier that way. To set the position below the tab bar you only have to set the startup position of the window. Help2 Viewer, available with source from my website, uses this method to manipulate the tab control. To look at the window switching see the handler for the TCN_SELCHANGE message in WM_NOTIFY.
"Ahhh, what an awful dream. Ones and zeroes everywhere...[shudder] and I thought I saw a two." -- Bender
"It was just a dream, Bender. There's no such thing as two". -- Fry
-- Futurama

Donkey's Stable

Slugsnack

yeah i didn't realise there was a 'tab control' so i think with msdn's help that part will be fine. the hard part which i'm not sure on is the capture and binding of the console windows to my main window. i'll try the method i gave in my last post but i don't hold high hopes right now..

ramguru

I'm kinda confused at this part :}
You are talking about console application & tab control window application
How do you expect to connect these two :} ?
..well, there are Console Functions..

Slugsnack

my application is a window application. now from my other thread say i opened up 2 instances of 'cmd.exe', one with ping and one with tracert running. i wanna force those to be INSIDE my window and then be able to tab between the two. does that make more sense ?

illustration :


Slugsnack

lameeee realised i can't just make a window a child window with setwindowlong lol. get access denied. gonna have to think of another way.. mmmmmm. even making the handle inherited in createprocess call doesn't seem to work : | still access_denied

dedndave

about that time, i think i might consider disassembling cmd.exe - lol
i always do it the hard way

Slugsnack

i'm considering injecting a dll and having the dll do the setwindowlong + setparent ( or am i not supposed to talk about injections ? )

i'm out of ideas after that : [

otherwise yeah.. final resort would be to disassemble ping/tracert.exe and rip their functions but that will not be easy i suspect

dedndave

not too bad
on mine:
ping    18 Kb
tracert 12 Kb
i can send you listings from my quicky disassembler, if you like

Slugsnack

listings ?

ps. injecting a dll seems to get error_access_denied still.. let me try and figure this out : |

omg i'm such a damn noob. i just tried setparent() without setwindowlong and it works.. WOW NOOB !!! okay after dinner gonna try and make it display it within a tab since right now it just disappears

dedndave

i would like to see it if you get it working
that would be cool for many things

Slugsnack

i'm close now.. very close. next step is trying to remove the WS_CAPTION style from the console which i can't do.. since setwindowlong() fails with error_access_denied. and then need to move it inside of the tab. once those 2 are done, the rest is easy. just a matter of detecting tab changes and showwindow() calls. right now i'm trying to use TCM_GETITEMRECT and setwindowpos() to put the child window into the tab. unfortunately the coordinates of top left returned by TCM_GETITEMRECT is for the actual tab button instead of just the window contents part.. thought of hardcoding in and adding a 'y' offset but i'm sure there is a better way. gonna try a bit more tonight but i doubt i'll have it done by the time i sleep..

i think the direction i should go in now is investigate why setwindowlong is failing and how to stop it doing so. it's incredibly weird since even when i injected a dll the function still failed. whereas getwindowlong works fine.. mmmm

weird.. the same code works on other windows. just not on console windows : |

okay.. so i guess console windows are not just like regular windows. time to try a new approach.......