|
Well I have to agree yours is the best by a long shot! ++C is is then.
And dammit - I missed my alarm this morning so now it is 13:41 in Britain (too late to say April Fools... grr).
____________________
David Wulff
I know who you are mate.
|
|
|
|
|
I use the wizard to create the MFC application, choose Explorer style, so ,the app has two view:CLeftView, CRightListView, the following codes:
void CRightListView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
GetParent()->GetClientRect(&m_ClientRect);
MoveWindow(&m_ClientRect);
}
the m_ClientRect is the sum of CLeftView and CRightListView, that's not I want to see.
How to get only the rect of CRightListView?
I'm amumu, and you?
|
|
|
|
|
GetClientRect(&m_ClientRect);
---
CPUA 0x5041
Sonork 100.11743 Chicken Little
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|
|
I know, but the base point of what you get is (0,0), but CRightListView's base point is not (0,0), it has a offset.
I'm amumu, and you?
|
|
|
|
|
The client rect by definition is relative to the client. To move it, use ClientToScreen from the main window, if that's what you want the rect to be relative to.
As in MyWindow.ClientToScreen(rcClient);
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
I changed my code:
void CRightListView::OnSize(UINT nType, int cx, int cy)
{
CView::OnSize(nType, cx, cy);
GetClientRect(&m_ClientRect);
ClientToScreen( &m_ClientRect );
MoveWindow(&m_ClientRect);
}
But it is not correct.
I'm amumu, and you?
|
|
|
|
|
qf0421 wrote:
But it is not correct.
That's highly descriptive. What is not right ? Whatever it is, the answer lies in what I've told you, it just needs to be altered for what you want to do. If you tell me what you're trying to do and what is instead happening, then maybe I can help you.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
I've got it - get the WindowRect of the control, GetWindowRect as opposed to GetClientRect. Then if that is relative to the entire screen, call ScreenToClient in the window class on that rect to translate it to be relative to the window. yuou want the window rect anyhow if you're going to call movewindow, otherwise you're scrunching the window size down by whatever the non-client area is.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
For example:
CLeftView.m_Rect is (0, 0, 100, 100 ), and the rect of CRightView I can get is (0, 0, 50, 100), but the CRightView is on the right side of CLeftView, so, what I get should be( 100+x, 0, 150+x, 100 ), x is the width of splitter.
I want to use function to finish this coordinate-switch, how to get it?
Thank you for your help and your patience
I'm amumu, and you?
|
|
|
|
|
This is just a C++ question. Does anybody know how to get data from an excel file? I figured out a way to put data to an excel file. I just do this:
ofstream outfile("ftest.out");
int a=1, b=2, c=3, d=4;
outfile << a << "," << b << "," << c << "," << d;
then when I open ftest.out with excel, it recognizes that the comma means to move to the next block. But when I try to get data from an excel file the same way:
ifstream infile("ftest.in");
int a, b, c, d;
infile >> a >> "," >> b >> "," >> c >> "," >> d;
This doesn't work. Does anyone know some other method to get data from an excel file?
|
|
|
|
|
I don't know how to get the data from a normal excel file but I do know why your outfile code worked and your infile code doesn't...
Your ftest.out file would be considered a csv file (comma seperated values) and excel supports csv. A normal excel file is not stored in csv format.
Sorry I don't really have an answer but at least you know it isn't some little bug in your code.
There are a few articles here on codeproject dealing with excel files, maybe you could find an answer there... try here for instance
-Jack
To an optimist the glass is half full.
To a pessimist the glass is half empty.
To a programmer the glass is twice as big as it needs to be.
|
|
|
|
|
I haven't tried it, but generally, if you export the Excel file in ASCII or .csv format (whichever it offers you as an option) the result will be a comma-separated text file. You can then read it as char data and parse the fields using the commas as end-of-field indicators. I believe there's a tokenizer function that does this, but I'm far from my MSDN library right now. Check there online for "token" or some such.
|
|
|
|
|
How do I export the Excel file in ASCII or .csv format? Do you mean that this is an option in the excel program itself, or do you mean that visual C++ has the ability to do this to the file? If its an option in excel itself, could you tell me how to go about exporting the file?
|
|
|
|
|
I don't use Excel, though several at work do, so I'm not certain how to do it. But I believe I found it once in the File menu. Check there for an Export option; it should offer you a set of format selections, including text (aka ASCII, or CSV). If it's not there, check the online Help for "Exporting." Every other spreadsheet program since Calc has had this option, so I doubrt that it's been left out.
A potential problem might come up when using multiple sheet spreadsheets - it may export only one sheet - you'll need to manually review the resulting file to see what you've got.
|
|
|
|
|
There is (was) an "Excel Developers Kit" (book) that at least went through the 97 version.
Good ideas are not adopted automatically.
They must be driven into practice with courageous patients. -Admiral Rickover. ...
|
|
|
|
|
You may consider using the getline method:
ifstream infile("ftest.in");
char[81] myText;
for(int i = 0;!infile.eof;i++)
{
myText = infile.getline(myText);
}
Hope something like this helps.
Nick Parker
|
|
|
|
|
My goodness - is this homework, or does your boss want it ? It reads like you've typed in a spec from an assigment or work request.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Christian Graus wrote:
is this homework
Good call....
Nick Parker
|
|
|
|
|
I'd love to know where, I'd love to do a course that gives homework this in depth. But it's obviously been typed in from some sort of assignment description.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
help with downloading from a login/pass web using php Anonymous 12:48 17 Mar '02
hi, i would like to do something like that:
the website targeted use php to login with a username and a password.
and then, some menu is shown, (all using .php or .php3 extension for viewing pages.)
the fact is, if i do not log with my user/password within internet explorer, i can't even retrieve files i want using internet explorer.
but, even after logging in, and when i am able to download any file ending with .php3?someparam=somevalue&another=anothervalue etc...
when i use a offlinebrowser application to save all pages i want, the external application finally download a page which says i'm not logged on. although i can still download that page opening an internet explorer windows... (and setting the offline browser 'spider' to identify itself as IE doesn't solve the problem.)
so i have figured out that i need something, which will log in using a specified username/password, and then, will download all files linked from a single url. (and that need to work with either .php or .php3?x=1&pass=2 files...)
how can i do that?
|
|
|
|
|
I have a OnEraseBkgnd() function to change the background colour of my MDI app's frame window to a nice blue colour rather than boring grey... but every permutation of my attempts to do so don't work..
Can somebody please tell me the correct code for changing the background? I have this so far, but does not work:
BOOL CMainFrame::OnEraseBkgnd(CDC* pDC)
{
// Paint it a nice colour.
CBrush backBrush(0x00755121);
// Save old brush.
CBrush* pOldBrush = pDC->SelectObject(&backBrush);
CRect rcRect;
pDC->GetClipBox(&rcRect); // Erase the area needed.
pDC->PatBlt(rcRect.left, rcRect.top, rcRect.Width(), rcRect.Height(), PATCOPY);
pDC->SelectObject(pOldBrush);
return TRUE;
}
Thanks
|
|
|
|
|
I believe the problem is that you need to do this elsewhere to get the background of an MDI app. I forget exactly where, but my recollection is an article on this was posted recently.
Christian
The tragedy of cyberspace - that so much can travel so far, and yet mean so little.
"I'm somewhat suspicious of STL though. My (test,experimental) program worked first time. Whats that all about??!?!
- Jon Hulatt, 22/3/2002
|
|
|
|
|
Your code is correct for painting over a background. However the reason that it does not appear is because your MDI frame window, contains an MDI client window. This is where you will need to handle the erase background message.
You will have to sub class that window in order to handle that message. The MDI frame provides a variable m_hWndMDIClient that represents that handle of that window.
|
|
|
|
|
This is what you want:
http://www.codeproject.com/useritems/MDIBackgroundImage.asp
Mazy
"So,so you think you can tell,
Heaven from Hell,
Blue skies from pain,...
How I wish,how I wish you were here." Wish You Were Here-Pink Floyd-1975
|
|
|
|
|
I've Windows XP, VC + SP5
I've installed (windowsxp.x86.fre.rtm.symbols.exe) but when I debug my application still they are not found:
[...]
Loaded 'C:\WINDOWS\system32\ole32.dll', no matching symbolic information found.
[...]
But "C:\WINDOWS\SYMBOLS\DLL\ole32.pdb" exists, it's been installed by the exe above.
I heard about a problem with 'pdb' files and about some changes to do in the registry under DevStudio but I don't remember more
Any help?
Thanks in advance.
|
|
|
|
|