|
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
|
|
|
|
|
Hm, I tested this:
__declspec( dllexport ) void Test()
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
CWinApp* p = AfxGetApp();
}
and I got the correct pointer to the app. You might also perhaps try passing in a pointer to the app (although it should be unecessary), try using a wrapper class for the registry - there is a ton of articles with registry-classes here
|
|
|
|
|
Hi,
I tried doing that test as well. I created two projects. One was a MFC application and one was MFC dll.
I placed the test function in the dll and called it from the app. I got NULL returned by AfxGetApp(). So if I call something like AfxGetAppName() I get a runtime error.
What type of dll do you create?
Cheers Mark
|
|
|
|
|
A Regular DLL with MFC dynamically linked
|
|
|
|
|
How can I trap when my dialog or window has become inactive like when the user has clicked on another window?
I have tried WM_KILLFOCUS but that does not work.
Also how can I test if a click is on the title bar of my window?
|
|
|
|
|
Anonymous wrote:
How can I trap when my dialog or window has become inactive
Handle WM_ACTIVATE .
Anonymous wrote:
how can I test if a click is on the title bar of my window
Handle WM_NCLBUTTONDOWN and send the (x,y) coordinates in a SendMessage (WM_NCHITTEST, ...) call and compare the return value with HTCAPTION .
/ravi
My new year's resolution: 2048 x 1536
Home | Articles | Freeware | Music
ravib@ravib.com
|
|
|
|
|
Hi,
Have got few doubts about dll loading and unloading.
I have an application with some 8 to 10 dlls (some using statically linked MFC and some ATL dlls). When I launch the application, I see that the dlls are loaded more than once. I think the OS is loading and unloading these dlls atleast 2 or 3 times and then it gets loaded finally.
* How can I stop this behaviour and load my dlls only once when the application is launched and it is unloaded only when I quit the application?
* Should I release all the memory I allocate in a dll when the dll is unloaded?
TIA
satya
|
|
|
|
|
Hi,
How can I iconize my application through program?
TIA
satya
|
|
|
|
|