|
Thanks a lot Roger
Regards,
Sunil Kumar
|
|
|
|
|
|
Stingray Studio is used to create a SECCustomStatusBar to display a toolbar in my application. The code is written in C++ using MFC, but I want to prevent the user from having the ability to resize the toolbar. The toolbar is to automatically resize when the application is not maximized and the user sets the application's window size to his/her preference.
Can this toolbar remove the ability for the operator to click, hold, and drag the bottom right corner of this toolbar to resize it?
|
|
|
|
|
Handle WM_MINMAXINFO. I think you should give the same number for min and for max, so there is no range for the user to change size.
There is sufficient light for those who desire to see, and there is sufficient darkness for those of a contrary disposition.
Blaise Pascal
|
|
|
|
|
Ive managed to read a whole text file into a string. The text file has 200 lines. I wanna read a specific line from the string, how can i do it? I tried getline(); but the problem is that it reads a line rite from the starting position of the string but not from a specific point.
nOmI
|
|
|
|
|
Well, you may read a line at time or may move a pointer inside the buffer.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
kindly would u like to elaborate ur reply bcoz im a bit new in C++ programming.
nOmI
|
|
|
|
|
Instead of reading the whole file at once, read it one line at a time until you get to the desired line. Otherwise, you'll need to parse the buffer (a line will by separated by a \r\n pair).
"Love people and use things, not love things and use people." - Unknown
"The brick walls are there for a reason...to stop the people who don't want it badly enough." - Randy Pausch
|
|
|
|
|
Thank you for elaborating my lazy answer.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
CPallini wrote: Well, you may read a line at time or may move a pointer inside the buffer.
And you got 1 vote at time but now you get a pointer of 5.
|
|
|
|
|
Thank you, pal.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Did you try with CFile::Read ?
|
|
|
|
|
This function takes two parameters
1. first one is the path of file to be read.
2. second parametrs is the line number you want to get from the file.
CString GetLine(CString sFileName, int nLineNumber)
{
CStdioFile Inputfile;
CString sLine = _T("");
CFileException FileExc;
UINT nOpenFlags = CFile::modeRead;
if (!Inputfile.Open(sFileName, nOpenFlags, &FileExc)) {
FileExc.ReportError();
return "Error";
}
while(Inputfile.ReadString(sLine) && nCount < nLineNumber){
nCount++;
}
Inputfile.Close();
return sLine;
}
|
|
|
|
|
You may open the text file using "CStdioFile",
the read each line using ReadString().
Actually ReadString () reads each line at a time !!
|
|
|
|
|
Hi,
I have Parent and child windows, when i create new child windows it adds them,
but when i move them or bring one from the back it doesnt redraw properly,
i was wondering if there was a way i could redraw those windows properly,
and if that doesnt work im assuming that its probably cause each child is
sharing the same WndProc, is there a way to make the WndProc and array...
|
|
|
|
|
Are you returning the correct value when processing WM_PAINT messages?
|
|
|
|
|
well as im fairly new to child forms I dont know what value i should be returning
ive tried
UpdateWindow(hWnd) in case WM_ACTIVATE:
but that didnt really do anything,
its when i put another child window infront of another and click on the one behind it doesnt redraw and half the window is missing
i really dont ahve a clue how to sort that
|
|
|
|
|
|
well before that i found a semi way of sorting my problem but it caused tremendous flickering
case WM_PAINT:
{
HDC hdc;
PAINTSTRUCT ps;
hdc = BeginPaint( hWnd, &ps );
InvalidateRect(hWnd, NULL, TRUE);
UpdateWindow(hWnd);
EndPaint( hWnd, &ps );
}
return 0;
break;
i even tried
but im still having no luck
|
|
|
|
|
No no no!
The call to InvalidateRect() triggers the generation of a WM_PAINT message so that definately needs to come out.
UpdateWindows() does the same but the window procedure is called rather than letting the message run through the normal message queue so that call also needs removing.
The code you've shown doesn't actually do anything so I'm not surprised the window doesn't change on screen. Is that it or have you removed the painting code to make things clearer?
|
|
|
|
|
I wish i could paste a picture in here lol
I removed those lines and im aware that the paint method i have set doesnt do anything
but even without the WM_PAINT and using the updatewindow etc it still causes overlapping and no redrawing
|
|
|
|
|
|
no, i tried that at one point and all the windows when they gained focus just passes under the background of the other child windows, its very weird
|
|
|
|
|
What Steve meant to say was NO NO NO!!
You're causing infinite recursive WM_PAINT messages there.
Sarriss wrote: but even without the WM_PAINT and using the updatewindow etc it still causes overlapping and no redrawing
No redrawing will be done unless you do some drawing.
If you call BeginPaint/EndPaint without doing any drawing, then
even if you pass the message to the default window proc, nothing
will happen.
You need to either draw the window contents or let the default
window proc draw the window contents in response to WM_PAINT.
Of course, you can always let the default window proc do its drawing
then draw on top of that if you'd like.
Just don't call any invalidate/update/redraw window functions from your
WM_PAINT handler!! All those messages cause WM_PAINT messages.
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Yeah I noticed that after I tried it,
eitherway I still need help with WM_PAINT, im still trying to get it so when i bring it as the focus window it redraws and doesnt leave half of the window with the image of the window that was infront of it
|
|
|
|