|
I have a problem with the combination of ModifyStyle and DoModal :
ModifyStyle(0, WS_MINIMIZE, SWP_HIDEWINDOW);<br />
dlg_whatever.DoModal();
(only these both together pose the problem)
at this point. i.e. after the subdialog ended with EndDialog , the keyboard's ALT status is "toggled", even though the keyboard has not been touched all the time.
This poses a problem for me, so I carry out a SetKeyboardState , clearing the ALT status (testwise clearing the status of ALL keys too). This works so far, that a subsequent GetKeyboardState showsn that the ALT key is not toggled any more.
However, when any key gets pressed now, PreTranslateMessage shows WM_SYSKEYUP (i.e. ALT status).
Does anyone know
1. the reason for this behaviour,
2. how to clear the ALT state more effectively than by SetKeyboardState?
|
|
|
|
|
I have trouble believing that ModifyStyle() will alter the Keyboard state. What makes you believe the Alt key status has been toggled?
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
As I posted, not ModifyStyle, nor DoModal, but these two in combination achieve that.
In the meantime I found out, what's happening. I have to note, that I have noticed and tested this issue only in XP.
Every time, when no control has the focus in the dialog, ALT mode will be entered - and that is happening after ModifyStyle, DoModal.
I inserted a SetFocus() after DoModal, and the problem is cleared. Then I tested around, and found, that in other cases, when no control is focused on (for example, when the currently focused control becomed disabled), ALT mode will be entered.
The ALT status was easy to notice, because a PreTranslateMessage handler processes certain Alt-key combinations, like AltReturn, AltRight, etc., and these functions showed up without having touched the Alt key before.
Thanks anyway.
|
|
|
|
|
Vancouver wrote:
Every time, when no control has the focus in the dialog, ALT mode will be entered - and that is happening after ModifyStyle, DoModal.
I think you will find that if no control has focus the Dialogs System Menu will get focus, which will then process keys as SystemKeys (ALT style).
The first control with a Tab Stop style will automatically get focus so shouldn't normally need to use SetFocus().
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
1. I DID find, that PreTranslateMessage received the ALT key combinations in this situation (where the ALT has been simulated).
Btw, this is a dialog-based application, there is no system menu. I realize I should have written that in the first post.
2. The first non-disabled tab-stop button DOES receive the focus automatically, but not always.
One case is after the ModifyStyle + DoModal, another case was when the focus was on a CEdit control, which became disabled and the focus has not been assigned.
As soon as the focus will be assigned explicitely when disabling the control, the problem is gone.
Now I am assigning the focus to the dialog, i.e. with "this", which then gives the focus automatically to the first control in the TAB sequence.
|
|
|
|
|
I have a small problem with bolding text using RichEditView. I have tried using this code:
CRichEditCtrl &RichCtrl = GetRichEditCtrl();
CHARFORMAT cf;
cf.dwEffects = CFE_BOLD;
cf.dwMask = CFM_BOLD;
RichCtrl.SetSelectionCharFormat(cf);
I have used the same code for underline, italic, strikeout and link (changing the attributes to match the type) and the code works for them.
Any ideas?
|
|
|
|
|
Egg on face. I forgot to change the Font. Code works fine. Where's my sign?
|
|
|
|
|
Hi,
i am trying to get a CWnd derived class having a vertical scrollbar by PreSubclassWindow.
void CWndDerivedClass::PreSubclassWindow()<br />
{<br />
ModifyStyle( 0L, WS_VSCROLL );<br />
CWnd::PreSubclassWindow();<br />
}
It's not working, all i can see is a vertical scrollbar but i can't use it.
Spy++ing: There are only WM_NCHITTEST messages with return value HTTRANSPARENT (no HTVSCROLL).
If i CreateEx the class:
<br />
m_cWndDerivedClass.CreateEx( 0L, NULL, NULL, WS_CHILD|WS_VISIBLE|WS_VSCROLL, rcRect, this, 1002 );<br />
then i have a valid and full functional vertical scrollbar!
Does anybody know how to solve this problem?
I don't want to CreateEx the derived class, or do i have to?
thx a lot
|
|
|
|
|
Friends,
I want to enumerate files present in certain folder. I may also want to enumerate files present in a subfolder withing a folder.
What are the possible methods to do so ?? I would prefer some non MFC solution.
Imtiaz
|
|
|
|
|
Combination of these api will help
- FindFirstFile
- FindNextFile
- FindClose
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
|
|
|
|
|
HANDLE find;
WIN32_FIND_DATA wfd;
find = FindFirstFile( "path/to/your/folder/*.*", &wfd );
if( INVALID_HANDLE_VALUE != find )
{
do
{
// wfd will contain the data of the current file
}
while( FindNextFile( find, &wfd ) );
FindClose( find );
}
|
|
|
|
|
|
You must call FindNextFile() before you use the values in the WIN32_FIND_DATA structure:
HANDLE find;
WIN32_FIND_DATA wfd;
find = FindFirstFile( "path\\to\\your\\folder\\*.*", &wfd );
if( INVALID_HANDLE_VALUE != find )
{
while( FindNextFile( find, &wfd ) )
{
}
FindClose( find );
} P.S. The convention on Code Project is to enclose blocks of code in <pre>...</pre> tags.
Software Zen: delete this;
|
|
|
|
|
Gary R. Wheeler wrote:
You must call FindNextFile() before you use the values in the WIN32_FIND_DATA structure:
are you sure?
|
|
|
|
|
This is all i have to say.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/findfirstfile.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/findnextfile.asp
make sure you read the description of the second paramter on FindFirstFile and the remarks
P.S. I don't give a rats ***
Hey! Look at this nice litte example which happens to use the data in the WIN32_FIND_DATA structure before FindNextFile is called
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/fileio/base/listing_the_files_in_a_directory.asp
|
|
|
|
|
Oops. It looks like you're right .
Although, it doesn't really make a difference, in this specific case, since FindFirstFile() for *.* will return the current directory (named ". ").
Software Zen: delete this;
|
|
|
|
|
Hi all:
I have a titleless dialog(for some reason), which has a constructor like
MyDlg(CWnd* pParent = NULL);
But somehow I want to add a button to this dialog which have the standardize minimize funtion.
here is the customized minimize funtion's implementation
<br />
void MyDlg::OnBtnMinimize()<br />
{<br />
ShowWindow(SW_MINIMIZE);<br />
}<br />
But after I clicked the minimized button it just disappears. Later I found it(just part of this dialog) positioned at somewhere in the lower left corner of the desktop and just above the system taskbar. It obviously not positioned at the system taskbar.
How can I get the standard minimize function without the title bar? Do I have to pass the return value from GetDesktopWindow to Mydialog dialog, I tried It didn't work!
|
|
|
|
|
|
Thanks for your WS_EX_APPWINDOW answer, it works.But if you don't mind I wanna ask you few more questions which related to this one.
When I clicked the minimize button, this dialog does positioned at the sys taskbar. But what makes it not so good is it doesn't have caption when It appears in the sys taskbar. I've tried to add CAPTION "" to the script and it worked but it at the expense of just the part of dialog appears not as whole.How can I get a caption at the taskbar(still does't have caption bar) when It minimized or maximized?
Furthermore, When I click the dialog at the sys taskbar consecutively, It seems not responding well, it only get minimized. Which should be get maximized and minimized correspondingly.
Thanks fot your time and patience!
|
|
|
|
|
I have been trying to debug my Add-In for Visual Studio .NET 2003 on Windows XP SP2. I seem to be always getting an error message with the error code 800a0030. I have tried using Error Lookup but even that can't tell me what the code means, it just says error message not found. I have also looked through all the files that come with VS .NET 2003 to see if I can find it there but no luck.
Does anybody know?
I am the handsome one in the crowd.
|
|
|
|
|
The file WinError.h has a table at the beginning that explains the what the bits in the error code are used for. The copy I have here (VS 2002) does not have a definition for error 48 (0x0030) but maybe yours does. Also, depending on what technology you are using, error code 48 could be defined in some other file. But then again, it could just be a custom error that is not defined anywhere
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Well according to google[^], the error seems to be 'Error loading DLL'
Does your error message give any more information, like the name of the DLL. At a guess, Visual Studio doesn't like something in your add-in; maybe a missing interface or a problem in the DLL initialization code.
Michael
CP Blog [^]
|
|
|
|
|
No I just get the error code. It seems like the error occurs when I make use of the VCCodeModel functions. . I can't even step into the function (the exact name I can't remember at the moment, I think it has to do with getting a project from a collection of projects)
I am the handsome one in the crowd.
|
|
|
|
|
I want to set color and a font different with my dialog font for a text on dialog. Please help me, thank you very much
|
|
|
|
|
Handle the ON_WM_CTLCOLOR() message
like this
HBRUSH CWFSEC2MailerTestDlg::OnCtlColor(CDC* pDC, CWnd* pWnd, UINT nCtlColor){<br />
HBRUSH hbr = CDialog::OnCtlColor(pDC, pWnd, nCtlColor);<br />
CBrush *brush;<br />
brush = NULL;<br />
CWnd* pStaticWnd = (CWnd*)GetDlgItem(IDC_STATIC_STATUS);<br />
if(pWnd == pStaticWnd){<br />
pDC->SetTextColor(RGB(0, 0, 255));<br />
}
pStaticWnd = (CWnd*)GetDlgItem(IDC_STATIC_INFO_DOC);<br />
if(pWnd == pStaticWnd){<br />
if(lock_docstatus_text){<br />
pDC->SetTextColor(RGB(0, 100, 200));<br />
}
else{<br />
pDC->SetTextColor(RGB(0, 0, 255));<br />
}
}
pStaticWnd = (CWnd*)GetDlgItem(IDC_STATIC_INFO_SEND);<br />
if(pWnd == pStaticWnd){<br />
if(lock_sendstatus_text){<br />
pDC->SetTextColor(RGB(0, 100, 200));<br />
}
else{<br />
pDC->SetTextColor(RGB(0, 0, 255));<br />
}
}
return hbr;<br />
}
more info you can find on msdn I think.
good luck.
"If I don't see you in this world, I'll see you in the next one... and don't be late." ~ Jimi Hendrix
|
|
|
|