|
Hi,
I have a CWnd that I create in my CScrollView::OnCreate(...) like so:
int CMyScrollView::OnCreate(LPCREATESTRUCT lpCreateStruct)
{
if (CScrollView::OnCreate(lpCreateStruct) == -1)
return -1;
m_myCwnd.Create( NULL, "", WS_CHILD|WS_VISIBLE|WS_BORDER, CRect(50,50,100,100), this, 23423 );
m_myCwnd.Create( this );
return 0;
}
Then in my CScrollView::OnSize(...) I want to make the CWnd the same size as the CScrollView so I call MoveWindow(...) like so:
void CMyScrollView::OnSize(UINT nType, int cx, int cy)
{
CRect myRect;
GetClientRect(&myRect);
ClientToScreen(myRect);
m_myCwnd.MoveWindow(myRect.left, myRect.top, myRect.Width(), myRect.Height(), TRUE);
CScrollView::OnSize(nType, cx, cy);
}
The problem is that after the call to MoveWindow(...) nothing happens, my CWnd is still the same size and position as when it was created.
Does anyone have any idea wht I'm doing incorrectly?
Any help would be greatly appreciated,
Craig
|
|
|
|
|
Dear All
When I install the visual C++, I find an option under tools for creating "Self Extracting exe" - how can I make use of this??
regards
Sankar
|
|
|
|
|
Hey
How do I access the files that I select when I goto "Open" in an MFC built SDI app?
What is the string of the path, or how can I then open that file for reading??
AND
How can I stop the default "new file" on start up, and get it to wait for a document to be specified to open?
Please help a desparate newbie!
Tim T
|
|
|
|
|
Come on guys, this is really important to me!
Please!
|
|
|
|
|
OK!
In your new app, go to the class wizard, select the object ID called "ID_FILE_OPEN". Then click on the COMMAND text in the box marked "Messages". Next, click "Add function" and it'll prompt you to name the function - probably "OnFileOpen".
It will generate a member function called OnFileOpen() somewhere in your code, probably as part of your mainframe class. So, you find your OnFileOpen() function, which will be empty except for some comments like "Add your command handler code here".
Add some code like this to your OnFileOpen() function:
{
CString strFilter;
CString path;
FILE *myfile;
CFileDialog MyFileDialog(TRUE,
"*.txt",
NULL,
NULL,
"Text file (*.txt)|*.txt" );
/* Display the File Dialog box */
int result = MyFileDialog.DoModal();
/* Return the path (including filename) */
path = MyFileDialog.GetPathName();
/* Open it up */
myfile = fopen(path, "r");
/* etc...*/
}
Haven't tested this out but it might be worth a bash. As for your second question, no idea but I've noticed that the behaviour differs between Win9x and Win NT.
Hope it helps. Cheers.
|
|
|
|
|
I want to change the order in which my controls react on the tabstop.
I.e. I want to change the tabstop-order, how can I do this?
|
|
|
|
|
Select the dialog that contains your controls. Then go to the 'Layout' menu and select 'Tab Order'.
You'll see a whole bunch of numbers which denote the order that the tabs are set to. Click on these numbers to adjust the order. Your first click will be the first tab, second click will be the second tab, and so on...
Hope this helps.
|
|
|
|
|
Thanks a lot!!
Works fine
|
|
|
|
|
Hi
I want to paint some items in my CListView-derivered class in different colors.
I know how this works with CListCtrl, you have to work with these functions:
afx_msg void DoNotify(NMHDR* pNMHDR, LRESULT* pResult);
and you have to set a ON_NOTIFY(NM_CUSTOMDRAW, IDC_ONLINE, DoNotify) into the Message-map
But ON_NOTIFY requiers a control-id from a CListCtrl.
So how can I do it with a CListView not CListCtrl?
thanks in advance
|
|
|
|
|
Use the ON_NOTIFY_REFLECT macro in your view class.
--Mike--
http://home.inreach.com/mdunn/
"Make sure that if you are using a blow torch that you don't set anything on fire."
-- Chris Maunder
|
|
|
|
|
Yeah thanks, I just found out by myself.
Could you please tell me what's wrong with this code:
The items are not painted in red font-color
NMLVCUSTOMDRAW* pLVCD = reinterpret_cast<nmlvcustomdraw*>( pNMHDR );
if ( CDDS_PREPAINT == pLVCD->nmcd.dwDrawStage )
{
*pResult = CDRF_NOTIFYITEMDRAW;
}
else if ( CDDS_ITEMPREPAINT || CDDS_SUBITEM == pLVCD->nmcd.dwDrawStage )
{
*pResult = CDRF_NOTIFYSUBITEMDRAW;
}
else if ( (CDDS_ITEMPREPAINT) == pLVCD->nmcd.dwDrawStage )
{
COLORREF crText;
crText = RGB(255,0,0);
pLVCD->clrText = crText;
*pResult = CDRF_DODEFAULT;
}
thanks
|
|
|
|
|
It found out again, no more help needed
|
|
|
|
|
Hi,
How can I use CFileFind to search for more than one type of file at once - like if I want to search for .cpp and .h files in one sweep. I know I can create a class for each search but on a global search that will require searching my whole computer for each file type.
Cheers
James
|
|
|
|
|
Hi,
I would like the command for know how datas I have in my serial buffer .
Thanks
youssef
|
|
|
|
|
One way is to call ClearCommError. This will fill a COMSTAT structure, whose cbInQue member will then hold the number of chars in the buffer.
|
|
|
|
|
Dear,
Thank you for your answer.
I use ClearCommError, COMSTAT and cbInQue;
Best regards
youssef
|
|
|
|
|
|
Oeps, forgot to escape something
value1 <empty> <epmty>
value1 <a value> <a value>
value2 <a value> <a value>
value3 <empty> <empty>
value3 <a value> <a value>
Wim
|
|
|
|
|
My guess is that the list control has one of the sort styles set, but your code expects the list not to be sorting for you.
--Mike--
http://home.inreach.com/mdunn/
"Make sure that if you are using a blow torch that you don't set anything on fire."
-- Chris Maunder
|
|
|
|
|
Good Guess!
Thanks a lot.
Wim
|
|
|
|
|
Hi
what's the best method to add bytes to the *middle* of a binary file?
do i have to read in the data that would otherwise be overwritten, to the end of the file, append the file and then write the data record to a later offset?
Or is there a built in function.....
Cheers
Wills
|
|
|
|
|
Hello? Does anybody know the answer to my question?
Wills
|
|
|
|
|
Sorry, as far as I'm aware, you're going to have to do it the hard way. Read the data in, and dump it all back out with the extra bit in the middle.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
hey peepz, i'm just starting with the doc / view architecture here, seems like a real mess to me. But anyways thats not the point, my question is dumb 'n simple: how do i enable a button i put on the toolbar? they seem to be disabled by default... i cant find any enable/disable code for the other buttons anywhere in the code, yes i know i'm a control freak, can someone also try to explain why there isn't any code for the New document button and menu 'n stuff? i'm really confused...
Thanx
Kuniva
Want, take, have.
(oh btw, best way of learning some language is by looking at examples, start large!) :p
|
|
|
|
|
to control buttons and menu items, you have to use the UpdateUI stuff. go to calss wizard and find the button/menu item you want on the left side and create an UPDATE_UI handler from the right side. (make sense? )
then in the handler, do something like this:
pCmdUI->Enable(m_bEnabled);
-c
------------------------------
Smaller Animals Software, Inc.
http://www.smalleranimals.com
|
|
|
|