|
Neha wrote:
How can solve this problem?
Make sure you're not depending on a WM_SIZE handler for correct behavior, and don't be resizing the window (via MoveWindow() , SetWindowPos() , etc.) from within your WM_SIZING handler.
---
Shog9
This is my December
These are my snow covered dreams
This is me pretending
This is all I need...
|
|
|
|
|
in your code you are using GetWindowRect() function .. ?. If yes then it will not work. At the time when user resizing the window GetWindowRect() returns the old position ( when the Show window content is off)..
Call your Resizing functon in WM_EXITSIZEMOVE Message.
It Will Work All time
|
|
|
|
|
Does anyone know how to change the mainframe's noclient area's back color(toolbar,status bar,etc.),not it's original grey.
Best regards;P
|
|
|
|
|
Non-client area will be painted when the frame recieves WM_NCPAINT message. Then you can paint your own custom window frame in CWnd::OnNcPaint().
|
|
|
|
|
Hi everyone. I have a listview control, in which some items are loaded into when the dialog it is on initalizes. I want to select the first row, that is, have the first row selected so it is highlighted, and will return the row datas when I do . I tried the following code, where 0 is the first row (0), 1 is to set the selected flag active, and LVIS_SELECTED is the selected flag I wish to change:
<br />
m_lvwEMails.SetItemState(0, 1, LVIS_SELECTED);<br />
This does not highlight the first row, nor does it return the selected row when I do the following
<br />
iSelected = m_lvwEMails.GetNextItem(-1, LVNI_SELECTED);<br />
I have tried every permutation of this code, and putting it in different spots in code. No luck, nor does this work with other list views in my program. All list views are fully functional and work as expected otherwise. All list views are set to report style. Anyone know what I might be doing wrong?
|
|
|
|
|
Anonymous wrote:
m_lvwEMails.SetItemState(0, 1, LVIS_SELECTED);
Most likely, 1 != LVIS_SELECTED. Use:
m_lvwEMails.SetItemState(0, LVIS_SELECTED | LVIS_FOCUSED, LVIS_SELECTED | LVIS_FOCUSED);
(leave out the LVIS_FOCUSED bits if you're *sure* don't want it to have the focus.)
---
Shog9
This is my December
These are my snow covered dreams
This is me pretending
This is all I need...
|
|
|
|
|
I should have refreshed my browser; I didn't notice you had already answered!
|
|
|
|
|
No worries - you gave a more complete explanation of the problem in any case.
---
Shog9
This is my December
These are my snow covered dreams
This is me pretending
This is all I need...
|
|
|
|
|
I think the call would be:
m_lvwEMails.SetItemState(0, LVIS_SELECTED, LVIS_SELECTED);
The state mask and the state information are one in the same in this case. You might have been thinking in terms of TRUE/FALSE for the second param. The LVITEM bitfields can be confusing.
Cheers
|
|
|
|
|
In the article,its name is "Using the CFindReplaceDialog class"
you can see it in:http://www.codeproject.com/dialog/cfindreplacedialog.asp
you can see A Function which names CMyTreeCtrl::OnFindDialogMessage
LRESULT CMyTreeCtrl::OnFindDialogMessage(WPARAM wParam, LPARAM lParam)<br />
{<br />
ASSERT(m_pFindDialog != NULL);<br />
<br />
if (m_pFindDialog->IsTerminating())<br />
{<br />
m_pFindDialog = NULL;<br />
return 0;<br />
}<br />
<br />
if(m_pFindDialog->FindNext())<br />
{<br />
CString FindName = m_pFindDialog->GetFindString();<br />
bool bMatchCase = m_pFindDialog->MatchCase() == TRUE;<br />
bool bMatchWholeWord = m_pFindDialog->MatchWholeWord() == TRUE;<br />
bool bSearchDown = m_pFindDialog->SearchDown() == TRUE;<br />
<br />
<big>FindWhatYouNeed(</big>FindName, bMatchCase, bMatchWholeWord, bSearchDown);<br />
}<br />
<br />
return 0;<br />
}
you see the Function : FindWhatYouNeed().
what is it ? user difined Function?
I Don't difined it
How can i use it ?
without it ,how can i over My FindReplace??
Study Together!
|
|
|
|
|
why don't you post this on the actual article? if you do, the article's author will get a copy of your message and maybe he/she will be able to answer you.
-c
There's one easy way to prove the effectiveness of 'letting the market decide' when it comes to environmental protection. It's spelt 'S-U-V'.
--Holgate, from Plastic
|
|
|
|
|
thanks,
i am afried that i pose but no recall.
i can try it .
thank you.
does any one know the question ,
Study Together!
|
|
|
|
|
|
Hi
CFileDialog problem under win 2000 !!
select 'my document' then the dialogbox lock, didn't work ! only killed by task manager. also 'GetSaveFileName' either.
I'm afraid this is an MFC bug !
below is my sample code, check it !
CFileDialogEx *pDlg = new CFileDialogEx(FALSE,
_T("jpg"),
NULL,
OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT,
_T("JPG Files(*.jpg)|*.jpg|BMP Files (*.bmp)|*.bmp|AVI Files(*.avi)|*.avi|All Files(*.*)|*.*||"),
NULL);
long nRet = pDlg->DoModal(); // <-- here, don't return when select 'my document'.
delete pDlg;
|
|
|
|
|
I'm not familiar with CFileDialogEx, but I would try CFileDialog first. It takes the same args, and it doesn't seem that you need the Ex version. Everything looks right.
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
hi - Ive read 'The Ultimate (DLL) Header File' by Joseph M. Newcomer, & 'DLL Tips' by xicoloko ..
Does anyone else have notes on :-
A) Building a dll (and libs where required)for
Static -> Release/Debug &
Dynamic -> Release/Debug
Configs and then
B) Defining A Header File For The Seperate 'Use' Program That Utilises the matching lib/dll automatically - Ive seen a pre-built system that seems to use the MSVC Project Settings, which is ok by me (I must be missing how it works though)
any other/more pointers/references would be appreciated
Garth
|
|
|
|
|
I'm sorta nooby so have patience. I have written a .dll for a modeling program. The .dll basically brings up a dialog. On the dialog I have a help button which brings up a dialog with a CRichEditCntrl. I have it so that when you pressed the help button a OpenFileDialog pops up and asks for the .rtf file - then it loads it in. What I really want however is to have the .rtf imbedded. Normally I would use an CEditView but I'm using a .dll and the help stuff is not an option. I don't really need the whole enchilada help files just some .rtf format text in the CRichEdit window. Hmm... I sure this has to be simple. Can't you use the EDITSTREAM structure to load an .rtf file that has a resource ID or such?
I have code similar to what is under the RichText section and trying to do something similar with the dialog but don't want to have to load up a file:
Code for Rich Edit
|
|
|
|
|
Sorry I don't know exactly, but check this [^]out, I'm sure it will help!
Good luck!
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
I got it figured out (sorta). It's not really an imbedded .rtf but It works for what I want it too.
//This all creates the info window. The CRichEdit is dynamicall created based
//on the placement of the group frame.
WINDOWPLACEMENT lpwndpl;
// We use the frame to locate our RTF control:
m_RichFrame.GetWindowPlacement(&lpwndpl);
m_RichText.Create(
WS_CHILD | WS_VISIBLE | WS_BORDER | WS_VSCROLL|
ES_AUTOVSCROLL |
ES_MULTILINE | ES_WANTRETURN | ES_READONLY,
lpwndpl.rcNormalPosition, this, IDC_RICHFRAME);
//A default character format
CHARFORMAT cfm_default;
cfm_default.cbSize = sizeof(cfm_default);
cfm_default.dwMask = CFM_FACE|CFM_SIZE|CFM_BOLD|CFM_ITALIC|CFM_COLOR;
cfm_default.dwEffects = CFE_BOLD;
cfm_default.crTextColor = RGB(0,0,0);
_tcscpy(cfm_default.szFaceName,_T("Arial"));
cfm_default.yHeight = 200; //in twips
//set the default formatting
m_RichText.SetDefaultCharFormat(cfm_default);
m_RichText.SetBackgroundColor(FALSE,RGB(116,92,184));
//a new char format
CHARFORMAT cfm;
cfm.cbSize = sizeof(cfm);
cfm.dwMask = CFM_FACE|CFM_SIZE|CFM_BOLD|CFM_ITALIC|CFM_COLOR;
cfm.dwEffects = CFE_BOLD;
cfm.crTextColor = RGB(193,201,62);
_tcscpy(cfm.szFaceName,_T("Arial"));
cfm.yHeight = 300; //in twips
//set the temporary format
m_RichText.SetSelectionCharFormat(cfm);
//used for text placement
int totalLength = 0;
//string 1
CString Text1;
Text1.Format("blah blah/n/n");
int len_Text1 = Text1.GetLength();
totalLength += len_Text1;
//add text
m_RichText.ReplaceSel(Text1);
//get last space after text
CHARRANGE crInsertSel2;
crInsertSel2.cpMin = totalLength;
crInsertSel2.cpMax = totalLength;
//select the space
m_RichText.SetSel(crInsertSel2);
//string 2
CString Text2;
Text2.Format("blah blah/n/n");
int len_Text2 = Text2.GetLength();
totalLength += len_Text2;
//add text
m_RichText.ReplaceSel(Text2);
//you get the idea.......
CHARRANGE crInsertSel3;
crInsertSel3.cpMin = totalLength;
crInsertSel3.cpMax = totalLength;
This just selects the last space, formats the selection and inserts new text there...
No .rtf but It works
|
|
|
|
|
Does anyone have some sample code for monitoring all keyboard presses? My program needs to watch ALL keyboard input while it is minimized regardless of what application is currently active.
Even if you don't have code, any ideas on how to do it?
Thanks for your help.....
Don Grout
|
|
|
|
|
you can either use a global Keyboard hook, or you can use DirectInput from DirectX to hook into the keyboard presses.
Here is an article that has the hook mehtod shown, and there is some discussion in the comments about the DirectX method:
http://www.codeproject.com/dll/trackuseridle.asp#xx321060xx[^]
Good Luck
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Thanks for the link. It led me to the article on KeyBoard Hooks which is more useful.
http://www.codeproject.com/dll/keyboardhook.asp
Don
|
|
|
|
|
How can I activate the default(or first, doesn't matter) dial-up connection?
|
|
|
|
|
|
Thank you!
I strangely keep forgetting that there is a search function on this page :p
Maybe because I mostly deal with programming at late night... hmm
|
|
|
|