|
|
Hi,
This is a really basic question, but for the life of me, I can't figure it out. I have an MFC dialog app that I could like to determine if it has input focus. I've tried things like GetTopLevelWindow, GetActiveWindow, and compared them to m_hWnd, but the case is never true, what should I try?
Thanks,
Aaron
modified 12-Jul-20 21:01pm.
|
|
|
|
|
GetFocus() ?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I think that works alright for my purposes.
Thanks
modified 12-Jul-20 21:01pm.
|
|
|
|
|
Hi all
I'm trying to create a simple web application with hyperlink. Please take a look at this sample.
http://msdn.microsoft.com/msdnmag/issues/03/09/net/default.aspx
What I'm trying to do is to copy the way Microsoft represents their hyperlinks (look at ones with figures).
I know how to create those hyperlinks with Javascript but I don't know with asp.net I would like to know if there are any sample codes can help me to do that
Thanks
|
|
|
|
|
Im in a property page. If the user clicks a button, how
can I make it go to another property page? I try using
the SetActivePage() command, but I always get unhandled
exemption error right here:
BOOL CPropertySheet::SetActivePage(int nPage)
{
-->> if (m_hWnd == NULL)
{
GetPropSheetHeader()->nStartPage = nPage;
return TRUE;
}
return (BOOL)SendMessage(PSM_SETCURSEL, nPage);
}
Any ideas? Please any response any one can give me will
be greatly appreciated.
Sincerely,
Danielle (an overworked graduate student)
|
|
|
|
|
DanYELL wrote:
If the user clicks a button...
What does the button-click handler look like?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Sometimes sending a message gets it into the queue a little too early.
You might also try
PostMessage(PSM_SETCURSEL, nPage);
return TRUE;
and see if the page switches successfully AFTER your button press is handled.
|
|
|
|
|
Blake Miller wrote:
Sometimes sending a message gets it into the queue a little too early.
Sending a message bypasses the queue altogether and uses the windows procedure directly.
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
I'm sure this must be easy, but I haven't hit upon the magic MSDN incantation to get what I want.
I have a simple ATL/MFC (VS.NET 2003) dialog. I want to put up the equivalent of a multiline edit control, but pass in HTML source, and have it displayed formatted.
I have no need to "edit" the HTML, or run any scripts, or any of that stuff. The HTML is stuff I generate which is mostly simple fonts/colors, etc. Right now I launch a browser passing in a temporary .HTM file, but I'd prefer to do this in a dialog (along with some other unrelated controls). The key is *simple*.
Can anybody point to some sample code that does this?
Thanx;
Brad.
|
|
|
|
|
|
That was quick!
Thanks for the pointers. I'll play with both those and see what works best without a huge code overhead.
Brad.
|
|
|
|
|
Michael Dunn wrote:
MFC has the CDHtmlDialog class...
This must be a .NET-specific thing. Yes?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
How can I make windows monitor a certain directory and not open it. To dissalow it and all of it's programs inside it!
gabby
|
|
|
|
|
Why do you want to do this?
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
I want to build a firewall.
check the one I've done until now. It is on codeproject
gabby
|
|
|
|
|
Is the folder on an NTFS volume?
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
yes it is on NTSF volume.
But if you can help me on FAT as well please tell me. I want to build a firewall.
Please if you want you can check the one I've poetd as article
I want a better one
gabby
|
|
|
|
|
Check out MSDN articles Q279682 and Q285998 for examples. They are VB, but easy enough to port over to C++.
Here are a few C++ examples, too:
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ad/ad/example_code_for_checking_for_a_control_access_right_in_an_ace.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ad/ad/example_code_for_setting_an_ace_on_a_directory_object.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/ad/ad/example_code_for_setting_a_control_access_right_ace.asp
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/msmq/msmq_using_queue_security_850z.asp
"When I was born I was so surprised that I didn't talk for a year and a half." - Gracie Allen
|
|
|
|
|
Hi,
I'm working on a MFC application with a CScrollView derived view class. Everything is working fine, except that when I use double buffering, the text comes out "blurry". I can't quite explain how it looks, but without double buffering, the text comes out as expected, but using double buffering, it kind of seems like everything is drawn twice, a pixel apart.... (I know it's not much of an explanation, but it's the best I got )
Any ideas's on why this is happening? It's not happening with any other drawing that I'm doing...
Another thing I need some help on is the print preview:
The regular print seems to be working fine, but in the print preview, everything is scaled down, and is displayed basically without margins. This probably has a easy solution, but anyways....
Thanks!
Edit: Forgot that some migth enjoy a bit of source code to go along with my first problem:
<br />
void CITPAXpertView::OnDraw(CDC* pDC)<br />
{<br />
CITPAXpertDoc* pDoc = GetDocument();<br />
ASSERT_VALID(pDoc);<br />
if (!pDoc)<br />
return;<br />
<br />
int nWidth = GetDocument()->GetDocSize().cx;<br />
int nHeight = GetDocument()->GetDocSize().cy;<br />
Graphics graphics(pDC->m_hDC);<br />
<br />
#ifdef _DEBUG<br />
#undef new<br />
Bitmap* bmp = new Bitmap(nWidth,nHeight);<br />
#define new DEBUG_NEW<br />
#else<br />
Bitmap* bmp = new Bitmap(nWidth,nHeight);<br />
#endif<br />
<br />
Graphics* graph = Graphics::FromImage(bmp);<br />
<br />
CRect area;<br />
area.SetRect( 0, 0, 100, 100); TextPrint(&graphics, 10, 0, area, "Hello!", 1);
area.SetRect( 100, 0, 200, 100); TextPrint(graph, 10, 0, area, "Hello!", 1);
<br />
graphics.DrawImage( bmp, 0, 0, nWidth, nHeight);<br />
delete graph;<br />
delete bmp;<br />
}<br />
The TextPrint is as follows:
<br />
void CITPAXpertView::TextPrint(Graphics* pdc, int height, REAL rotation, CRect area, CString text, int alignment, Color fargen)<br />
{<br />
FontFamily fontFamily(L"Arial");<br />
Font font(&fontFamily, (REAL)height, FontStyleRegular, UnitPixel);<br />
RectF areal( (REAL)area.left, (REAL)area.top, (REAL)(area.right - area.left), (REAL)(area.bottom - area.top));<br />
StringFormat stringFormat;<br />
<br />
SolidBrush solidBrush(fargen);<br />
<br />
if (alignment == 0) { stringFormat.SetAlignment(StringAlignmentNear); }<br />
else if (alignment == 1) { stringFormat.SetAlignment(StringAlignmentCenter); }<br />
else { stringFormat.SetAlignment(StringAlignmentFar); }<br />
<br />
stringFormat.SetLineAlignment(StringAlignmentCenter);<br />
<br />
WCHAR* tekst = new WCHAR[text.GetLength()+1];<br />
mbstowcs(tekst, text, text.GetLength()+1);<br />
<br />
if( rotation != 0 ) {<br />
pdc->TranslateTransform(-areal.X-areal.Width/2, -areal.Y-areal.Height/2, MatrixOrderPrepend);<br />
pdc->RotateTransform(-rotation, MatrixOrderAppend);<br />
pdc->TranslateTransform(areal.X+areal.Width/2, areal.Y+areal.Height/2, MatrixOrderAppend);<br />
pdc->DrawString(tekst, -1, &font, areal, &stringFormat, &solidBrush);<br />
pdc->ResetTransform();<br />
}<br />
else {<br />
pdc->DrawString(tekst, -1, &font, areal, &stringFormat, &solidBrush);<br />
}<br />
<br />
delete tekst;<br />
}<br />
I hope this helps, and maybe, just maybe, someone can help me out...
|
|
|
|
|
Hi there,
I am interested in catching all exceptions that could happen in my piece of MFC VC++ code. Up until now i have used been using Catch(CException *pException), but i noticed it doesn't catch divide by zero. To work around this someone recommended that I use Catch(...), is this best way for catching all exceptions. BTW what role does '...' play within C++? Never come across it before.
Thanks In Advance
Rich
|
|
|
|
|
|
Hi,
I am trying to store a message dialog resource in a DLL so that I can use it in all my applications.
I have had a bit of success thanks to Johan Rosengren, so now I can store the dialog resource in the DLL and use it in my application.
The problem I am still having is when I try and call functions that are part of the MFC framework. Like GetAfxAppName() or any of the Registry Profile functions.
Is there any way I can get this methods to work inside the DLL? or is it just a lost cause
Thanks
Mark
|
|
|
|
|
...
MHillary wrote:
thanks to Johan Rosengren
...and here I am again
Did you check AFX_MANAGE_STATE ? You should do a search on MSDN (www.msdn.microsoft.com[^]) and read up on the subject, it's a bit long to quote verbatim.
|
|
|
|
|
Hi,
I did, basicly what I've done is create a header file called Dialogs with simple C methods in it with names like ShowMessageDialog(...) ShowProgressDialog(...) etc In each one I've got AFX_MANAGE_STATE(GetStaticModuleState( )); Before I make any calles into MFC.
The problem that I found though is that switches everything over to the DLL, so when I call AfxGetApp() an assert is generated.
In the case of the Application Name I've called GetAfxAppName() before AFX_MANAGE_STATE and then passed that string to the dialogs constructor. But for things like the registy functions it just doesn't work.
Cheers
Mark
|
|
|
|
|