|
I'm creating a SDI application with the view derived from CFormview, and I want to change the window style so that it'll have a full screen view on it.
I'd changed the window style into WS_POPUP|WS_VISIBLE|WS_MAXIMIZE on the PreCreateWindow method of the CMainFrame but the result is my app always hiding.
It works for a SDI app with a base CView..
Does anyone know how to make/change my window style in a SDI app (especially using formview since in simple SDI it works)??
|
|
|
|
|
1) in ShowWindow change SW_SHOW with SW_MAXIMIZE.
2) in PreCreateWindow(CREATESTRUCT& cs)add lines:
cs.cx = GetSystemMetrics(SM_CXMAXIMIZED);
cs.cy = GetSystemMetrics(SM_CYMAXIMIZED);
cs.x = 0;
cs.y = 0;
one or both if you shall
|
|
|
|
|
in Your InitInstance()
m_pMainWnd->ShowWindow(SW_MAXIMIZE);
I want to change Myself..Can u help me?
|
|
|
|
|
Is it better to use nested functions:
<br />
ShowWindow(FindWindowEx(FindWindow("Shell_TrayWnd",0),0,"Button",0),SW_HIDE);<br />
or variables inside the functions:
<br />
HWND hWndOne = FindWindow("Shell_TrayWnd",0);<br />
HWND hWndTwo = FindWindowEx(hWndOne,0,"Button",0);<br />
ShowWindow(hWndTwo,SW_HIDE);<br />
and do they take up the same memory?
wWw.KruncherInc.cOm - My cool programs
|
|
|
|
|
Variables. It makes the code much easier to follow. The optimizer will optimize the variables away in the release version.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
|
Imho, it's not a good practice to use nested functions because it usually makes it harder to debug the code and handle errors. Consider doing:
HWND hWndOne = FindWindow("Shell_TrayWnd",0);
if (hWndOne != NULL) {
HWND hWndTwo = FindWindowEx(hWndOne,0,"Button",0);
if (hWndTwo != NULL)
ShowWindow(hWndTwo,SW_HIDE);
}
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
How are you going to do error-handling with this?
ShowWindow(FindWindowEx(FindWindow("Shell_TrayWnd",0),0,"Button",0),SW_HIDE);
That's right, you can't. There's your answer.
--Mike--
Personal stuff:: Ericahist | Homepage
Shareware stuff:: 1ClickPicGrabber | RightClick-Encrypt
CP stuff:: CP SearchBar v2.0.2 | C++ Forum FAQ
----
There is a saying in statistics that a million monkeys pounding on typewriters would eventually create a work of Shakespeare. Thanks to the Internet, we now know that this is not true.
|
|
|
|
|
I never said I was going to do error checking. I was using this as a simple example. I just wanted to know which one uses more memory or if they use the same.
Like if a function returns a value and you don't put it into a variable, does it take up memory?
wWw.KruncherInc.cOm - My cool programs
|
|
|
|
|
if you dont give a damn about ur software chrashes in front of your client then its perfectly legal
|
|
|
|
|
Actually, there is nothing there that will crash. It just won't do anything. Sometimes this is perfectly normal. In fact I have seen many program that did too much error checking that resulted in the program spamming the desktop with error message boxes.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Tim Smith wrote:
In fact I have seen many program that did too much error checking that resulted in the program spamming the desktop with error message boxes.
there is fine line which error should be notified to the user and errors that should be handled gracefully...
I have a simple moto, 75% of the code should be handling the errors. and 25% logic... The application should not crash or hang under any circumstances... if it does then the software looses the interest of the user.
|
|
|
|
|
no Doubt!
variables - by using variables you can check the validity of the data, which the fucntion returns, before calling another function.
My vote is for variables
I want to change Myself..Can u help me?
|
|
|
|
|
Personally, I would use the latter. A compiler will write the same code for both, (i.e. it will create temporary variables to hold the return values from the two FindWindow calls) so there's no performance disadvantage, but with the second, you can see (and therefore debug) the results a lot easier. For example, if the first call to FindWindow fails, it will be a lot easier to spot when stepping through the code.
|
|
|
|
|
Normaly it is better to do the second one: Because it is esier to read and esier to debug. The only time you might use nested function is if the value returned by a nested function, if invalid, will be rejected by the function that is using it as an argument. The problem with nested functions is that if one of them fails you do not kwon which one it was. If each function will reject invalid arguments, you can get away with just checking the result of the last function to see if something went wrong, but that will not tell precisely what went wrong. Generaly the only time you might use nested function is when you are sure that none of them will (or can) fail.
INTP
|
|
|
|
|
hey,
i have a question regarding pipes. i need to know how to check if a write/read on a pipe will block or not. basically i need something that check for pipes what select checks for sockets. can anyone help?
Thanks
mmm
|
|
|
|
|
humm, if i am not mistaken pipes are used using ReadFile and WriteFile rite,
these apis support overlapped reading/writing that will not block untill the data is available.
|
|
|
|
|
hey again,
i just read in msdn about ReadFile and it says:
"You cannot perform asynchronous read operations on mailslots, named pipes, or disk files". i guess there is a chance that what i want to do is just not possible. i'll describe what i wanted to do in the first place, maybe someone will have a feasible solution:
i have a main function MAIN and a thread T. T need to be listening to a socket S to know when its ready for read/write. also, T need to be listening to MAIN in some way (here is where i thought of bringing in the pipe). To listen to the socket S i use select. to listen to MAIN i can use an event that T will wait for (WaitForSingleObject) and MAIN will trigger but the problem is i can't make T wait on both select and WaitForSingleObject (or maybe i can and i just don't know how). the only solution that i can think of is have an "inside" socket (a socket that both of its side is in my localhost) that MAIN and T will communicate through. that way in T i can use select on my original socket and on this inside socket. i think this solution takes more resources than needed and there probably exists some simpler solution which i just can't think about (i'm only a student…). if anyone has an opinion or suggestion it will be welcomed.
Thanks again,
mmm
|
|
|
|
|
You are talking about thread communication or thread syncronization... for that you need to use kernel objects like mutex,events, etc...
and about waiting for more than one events...
use waitformultipleobject(...).
|
|
|
|
|
You can attach an event to a socket that will fire when data is ready for reading (etc...) You then 'WaitForMultipleEvents' in T for both your Main event and the socket.
Look at WSACreateEvent and WSAEventSelect in MSDN.
Paul
|
|
|
|
|
i've already done a server with pipes and socket...
if you want more details...
but one thing, this was under... linux
anyway, it wouldn't be very different (sockets are quite the same)
TOXCCT >>> GEII power
|
|
|
|
|
He already has a question about pipes and instead of giving out the solution you are reminding that you know about pipes. what are you ? expert culsultant who charges money?
|
|
|
|
|
i'm just Sone that try to help a guy who needed that help...
TOXCCT >>> GEII power
|
|
|
|
|
Helping is always helpfull, and you are most welcome to help
cheerup.
|
|
|
|
|
well, since no money is charged here i'm not complaining... thanks for everyone who finds time to write back to me (however, Mr.Prakash does have a point )
about pipes in linux - again, i'm no expert but i think that these things work differently in linux. i think in linux you can put pipe handles in select and it listens to them just fine. in windows i'm affraid it doesn't work (and in msdn it clearly states that select is for sockets).
about thread communication/synchronization - i think i know the different but i'm not quite sure under what king does my problem fall into. i'll restate my problem briefly:
1) i need thread T to always listen to a socket for read/write
2) i need MAIN to block somehow (pipe, event...) until it gets response from T
in other words i just need T to be able to listen both to a socket and to MAIN.
i'm open to ideas
(but if possible don't offer me linux/unix solutions cause i think the pipes/select issues differ in this matter)
|
|
|
|