|
Just out of curiousity: does the behaviour remain if you set the OFN_EXPLORER flag as well?
I'm thinking about some events that does not occur if the OFN_EXPLORER flag is omitted, e.g. OnTypeChange.
--
Roger
It's supposed to be hard, otherwise anybody could do it!
|
|
|
|
|
That was an idea worth investigating. It turns out that OFN_EXPLORER has no connection to the problem. I added the flag and it works correctly when "Use managed extensions" is No and incorrectly when it is Yes.
Now I have complete control of when it appears. Unfortunately, in the real world I need managed extensions since I use the .NET, but at least I know where the problem is. That is more than I knew when I started to ask questions on the board.
The bottom line: the code project is very useful....
|
|
|
|
|
IlanTal wrote: ...I need managed extensions...
Is this a Managed C++ question? If so, have you tried here?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Now, thanks to this board, I know it is a problem with managed extensions. When I started, it never occured to me that the problem could be there.
|
|
|
|
|
Your code snippet works fine for me.
What happens if you use GetOpenFileName() instead?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Thanks. Look above. It is the .NET which is causing the problem.
|
|
|
|
|
IlanTal wrote: It is the .NET which is causing the problem.
How so? I have v1.1 of the .NET Framework installed.
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
Did you see my reply to Roger? I have COMPLETE control of when it happens, just turn on or off managed extensions and Voila!
|
|
|
|
|
Hi IlanTal,
your code worked.
Whats problem?
|
|
|
|
|
Likewise, thanks. It is .NET. Look above on the board.
|
|
|
|
|
I have a string input by user and one Static Text on Dialog.
How can i display string in Static Text as long(as many characters) as much that not exceed Static Text length on Screen.
Thanks
|
|
|
|
|
fcoder wrote: as long(as many characters) as much that not exceed Static Text length on Screen
what do you mean by this ?!
if you want to put some string in your static control, you can use something like this :
((CStatic*)GetDlgItem(IDC_MY_STATIC))->SetWindowText("new string");
|
|
|
|
|
an example:
user input 1000 characters.and i have to display it on Static Text in a Dialog.
I now use:(IDC_INSTALL_DES_FOLDER:Static Text)
CSize szTextSize;
CRect rect;
GetDlgItem(IDC_INSTALL_DES_FOLDER)->GetClientRect(&rect);
int i= 0;
MapDialogRect(rect);
::GetTextExtentPoint32(dc.m_hDC, m_strDesFolder, m_strDesFolder.GetLength(), &szTextSize);
while (szTextSize.cx > rect.Width() - 180)
{
::GetTextExtentPoint32(dc.m_hDC, m_strDesFolder, m_strDesFolder.GetLength() - i, &szTextSize);
i++;
}
if (i != 0)
{
m_strDesFolder.Delete(m_strDesFolder.GetLength() - i, i);
m_strDesFolder += _T("...");
}
but when user put something like abcssssssssssssssssssssssssssss...(ex 100 s character)
it work not well
|
|
|
|
|
Are you trying to resize the static control depending on the text it is to display? If so you can use the DrawText function to calculate the rect for the text and use this to then create the control.
|
|
|
|
|
GetDlgItem is not a nice way of doing it ,control variable should be more fine,<imho>
Regards,
FarPointer
|
|
|
|
|
UpdateData() is much more crap !!!
|
|
|
|
|
Yes it send an EN_CHANGE to the parent giving a false information of text change by the user.
Regards,
FarPointer
|
|
|
|
|
v2.0 wrote: ((CStatic*)GetDlgItem(IDC_MY_STATIC))->SetWindowText("new string");
Why the superfluous cast?
"Let us be thankful for the fools. But for them the rest of us could not succeed." - Mark Twain
"There is no death, only a change of worlds." - Native American Proverb
|
|
|
|
|
DavidCrow wrote: Why the superfluous cast?
to ease the read...
|
|
|
|
|
handle the WM_CHAR message and in that every time chec the count of characters. and limit to it to that length provided to the static text
Cheers
"Peace of mind through Technology"
|
|
|
|
|
Hi fcoder ,
You can use SetWinwodwText m_YourStatic.SetWindowText("yourtext");
and you can calculate of text
example if text length>50 then write only 10 character and then use ...
or you can change font from Control or MoveWindow to change size of control
|
|
|
|
|
My control inherit from list control of icon,and i reload OnCustomDraw
event.The list need refresh every minute, but OnCustomDraw will be executed when every item drawing, so the control flicks badly, how to avoid?
|
|
|
|
|
Set the extended list view style LVS_EX_DOUBLEBUFFER
If you need this to work on older windows systems you'll have to do the double buffering yourself.
|
|
|
|
|
Where did you get the LVS_EX_DOUBLEBUFFER style flag. I can't find it.
|
|
|
|
|
It's defined in commctrl.h
<br />
#if (_WIN32_WINNT >= 0x501)<br />
#define LVS_EX_DOUBLEBUFFER 0x00010000<br />
|
|
|
|