|
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
|
|
|
|
|
I have an animation control on a dialog along with a progress control, similar to the Windows Explorer progress dialog during a copy operation.
In my WM_INITDIALOG handler, I load an AVI from the resource and start playing it immediately. I also set a timer for 20 ms and call a USB communications routine every 20 ms thereafter. The problem is, the AVI sometimes doesn't display right away. I tried calling SendDlgItemMessage with WM_PAINT to the Animation control in my WM_TIMER event handler, and that helped a little bit. Anyone have any suggestions?
Brigg Thorp
Software Engineer
Timex Corporation
|
|
|
|
|
You shouldnt send WM_PAINT messages because they are not generally handled in the message queue like a regular message.
A better method would be to call a function like UpdateWindow or RedrawWindow with the RDW_UPDATENOW flag set. These will force a repaint and implicitly send a WM_PAINT message to your animation control.
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!
|
|
|
|
|
OK. I changed the code to call UpdateWindow after I load the animation control, after I start playing the animation (both handled in WM_INITDIALOG) and also every entrance into my WM_TIMER handler (every 20 ms). This seems to help, however there are still some rare occasions when the dialog starts communicating with the USB device, the progress control is drawn correctly, but the AVI is not loaded. Can you offer any suggestions on how I can gaurantee that the AVI file is loaded and frame 1 is drawn before I begin processing?
Regards,
Brigg Thorp
Software Engineer
Timex Corporation
|
|
|
|
|
try the ::Animate_Open function inside of your OnInitDialog handler. It will open the avi file and display the first frame. This function is synchronous so that your application will block until the first frame is displayed.
If you do it this way, I beleive that the call to UpdateWindow will be unecessary.
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!
|
|
|
|
|
in my WM_INITDIALOG handler, I call this function:
<br />
HWND CreateAnimationCtrl(HWND hwndDlg, int nIDCtl) <br />
{ <br />
HWND hwndAnim = NULL; <br />
RECT rc; <br />
POINT pt; <br />
<br />
hwndAnim = Animate_Create(hwndDlg, IDC_ANIMATE, WS_CHILD | ACS_TRANSPARENT, ghInst); <br />
<br />
GetWindowRect(GetDlgItem(hwndDlg, nIDCtl), &rc); <br />
<br />
pt.x = rc.left; <br />
pt.y = rc.top;<br />
ScreenToClient(hwndDlg, &pt); <br />
<br />
SetWindowPos(hwndAnim, 0, pt.x, pt.y, <br />
149, 25, <br />
SWP_NOZORDER | SWP_DRAWFRAME); <br />
<br />
Animate_Open(hwndAnim, MAKEINTRESOURCE(IDR_AVI)); <br />
ShowWindow(hwndAnim, SW_SHOW); <br />
RedrawWindow(hwndAnim, NULL, NULL, RDW_INVALIDATE | RDW_ERASE | RDW_UPDATENOW | RDW_ALLCHILDREN);<br />
<br />
return hwndAnim; <br />
} <br />
If the call is synchronous, then I would expect that this would be completed before my timer event fires. So it must be something with the control itself.
Brigg Thorp
Software Engineer
Timex Corporation
|
|
|
|