|
You should add into object a pointer to CFIleDialog, and then call a constructor with customization paramaters, it work fine with me, see example:
CFileDialog *m_pMySaveAsDialoh;
...
...
...
m_pMySaveAsDialog=new CFileDialog(FALSE, "", NULL, NULL, "AutoCad DXF File (*.dxf)|, NULL);
m_pMySaveAsDialog.DoModal();
// this code works fine for me
DOS to MFC transportation !!! I do not recommend doing this !!
|
|
|
|
|
Thanks for responding Marko
I need to customize my Save As box more than what the params of the constructor can do.
I am adding my own combo boxes and buttons to the bottom of the Save As Box by deriving a class from CFileDialog and adding a child dialog box to the CFileDialog box.
When you do this you can't tab into the child ... to fix this you set "control" in the properties ... but then you loose the <enter> key. You can click on a button, but you can't tab to one and press ENTER !!??
|
|
|
|
|
Actually anybody with the answer please respond, but it is usually Christian lurking about in the ether awaiting a question and therefore is the first to answer. Also this is probably up his alley as it is to do with fonts.
I have a dialog that among other controls has a multi-line Edit Box. Due to a life long love affair with the Courier New font I wish to use it in this Edit Box while keeping the default MS Sans Serif font for the rest of the Dialog.
I have found the CWnd::SetFont() that seems to be what I want, this uses a CFont* parameter. Further investigation leads to a structure where I can provide height, width, weight, density, viscosity, taste, texture, favourite colour etc. This is at a much lower level than I care to delve at the moment.
Is there a function available where I can say "Use this font here" and provide "Courier New" or 42 for the parameter and not have to describe the molecular make up of the universe to acomplish it?
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
CFont::CreatePointFont()
---
Multitasking: Screwing up several things at once.
|
|
|
|
|
PJ thanks for the help, CreatePointFont and CreatePointFontIndirect were the only two functions I didn't take a look at.
Obviously I haven't got this completely fixed or I wouldn't be back again, would I?
I tried the following code in the OnInitDialog function of my Dialog -
CFont cFont;
cFont.CreatePointFont(80, "Courier New", m_cEditBox.GetDC());
m_cEditBox.SetFont(&cFont);
the font is changed to Courier New, but it is Bold and if I type lowercase letters like select all is fine, if I type property I can't see the bottom half of the p's or the y.
What else have I screwed up? Help just isn't helping me at the moment.
Michael Martin
Pegasystems Pty Ltd
Australia
martm@pegasystems.com
+61 413-004-018
|
|
|
|
|
Michael -
Two things :-
1. Declare the CFont variable as a member variable in your class,
not on stack..
CFont m_fontCourier;
2. Create and set the font
// Set the fonts for various fields please..
LOGFONT lf;
memset(&lf, 0, sizeof(LOGFONT)); // Zero out the structure.
lf.lfHeight = 12; // Request a 12-pixel-height
VERIFY(m_fontCourier.CreateFontIndirect(&lf)); // Create the font.
m_cEditBox.SetFont(m_fontCourier);
This should work, it does for me..I think the problem was, you created the CFont object on the stack, which got 'freed' when the method returned and popped the stack.
Hope this helps
VIvek
|
|
|
|
|
CreatePointFont() is easy, but you do not have much control.
Here is how I would create the font.
LOGFONT LF;
::ZeroMemory (&LF, sizeof(LOGFONT));
LF.lfHeight = -MulDiv (m_nPointSize, m_cEditBox.GetDC()->GetDeviceCaps(LOGPIXELSY), 72);
_tcscpy (LF.lfFaceName, "Courier New");
LF.lfWeight = FW_NORMAL;
m_Font.CreateFontIndirect (&LF);
m_cEditBox.SetFont (&m_Font); be sure to explore the LOGFONT structure, with it you can do some pretty cool things with fonts.
---
Multitasking: Screwing up several things at once.
|
|
|
|
|
As has been said before, declare a CFont variable in your class. But there is a much easier way to get what you want!!
class myClass
{
.....
protected:
CFont myFont;
};
myClass::OnInitialUpdate() //or wherever
{
....
CDC* pDC = myEditBox.GetDC();
myFont.CreatePointFont(90,"Courier New",pDC);
myEditBox.SetFont(&myFont);
myFont.DeleteObject();
....
}
|
|
|
|
|
Note:::::::
the CreatePointFont( ) takes 3 parameters,
Point Size (x 10) so 90 = 9 point font,
Face Name,
CDC* necessary to get the font the correct size!
Happy Hunting
|
|
|
|
|
I am looking for a way to send a lbuttondown message to another app, when i hit the ENTER key, at the coordinates that the mouse is at. I already have the hook set up, so would i use the SendMessage function to send this information, and what parameters would i pass to it?
|
|
|
|
|
mouse_event may be what you're looking for. It's used for synthesizing mouse motion and button clicks. There's also SendInput function, but it's not available on Windows 95.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
Hi, I am working on a free Internet program that is almost done. I have only one problem that keeps hunting me. I need to find a way to make this program bullet proof. The way this software works is that the user installs a piece of software on there computer. When the user wants to use free internet he starts the program and the program dials a local phone number. The software then displays a banner window on the screen where banners are rotated every 35 seconds.
I have implemented a system where the user cannot use cntrl-alt-dlete keys to get rid of the software. But this is not good enough since there is a software called system properties that allows one to view all the processes in windows and also kill them.
My problem is when the banner window is killed the connection stays alive. It is not also killed together with the software. I use windows dial up networking to make the connection.
To counter this I have implemented a DLL that monitors if the banner window is running or not. If the DLL senses that the banner window is not running then it will kill the connection.
The DLL checks the bannerwindow every 2 to 4 minutes.
What happens now is that this DLL is making the banner window act very slow. When a user clicks on an advertisers banner it opens up the window after 55 seconds. I have also some buttons with direct links on the bannerwindow. When the user clicks on these it will open the banner window also in 55 seconds.
I would like to get rid of this DLL and look for a different solution.
Does anybody know how to keep a program alive (when it has been end tasked from the task manager) enough time so the program can send a string to the modem to kill the connection together with the program?
Or does anybody know of any other solution?
That will have the same effect. Thus killing the connection when the program is being ungracefully killed also. So, banner window and connection must be killed together.
Thanks in advance,
Raymond
|
|
|
|
|
Hello, the codegurus around the world.;)
If I am on the same situation, I try to use Timer rather than Thread.
Timer is easier than Thread.
1) Main program is always checking if the banner window is opened.
(Timer and CWnd::FindWindow() )
2) If the banner window doesn't exist, try to open the banner window again.
(Well, in my sense, the user can kill the banner window, but show this ASAP and connect ISP by the modem. )
At the same time, the banner window is always checking if the main window is opened?
BTW, I sometimes use NetZero, and if I close the banner window, the connection is also closed.
Have a nice day!
-Masaaki Onishi-
|
|
|
|
|
Ok, so you imply me to use a seperate Dll to check if the banner window is open?
I have done this and I have run in a performance problem with the banner window.
When user click on it it reacts very slow to the users clicks, it sometimes takes 30 to 40 seconds for the advertisers page to open.
I am using a seperate DLL to check if the banner window is running.
Do you know of any Dll source code that does the some job but without affecting the performance?
Thanks in advance,
Raymond Bnetoera
|
|
|
|
|
Hi there again and thanks for your reply.
BTW, Do you know how Netzero implemented to kill the connection after the bannerwindow was disabled?
If you have more info on how NetZero was programmed please forward this to me.
Thanks in advance,
Raymond Bentoera
|
|
|
|
|
You could write a loader program. All it would do is run you free internet application, and monitor its status. If your program gets killed, the loader program would close the internet connection.
-Ben
"Its funny when you stop doing things not because they’re wrong, but because you might get caught." - Unknown
|
|
|
|
|
I'm writing a Win32 Console Application and I'm using the getline() function for the input of strings. Each time getline() is executed the user has to press enter twice after entering any data. I've tried using several different combinations of cin, cin.get(), cin.ignore, and getline(). The best combination is cin.ignore() followed by getline(). The only problem is having to press enter twice. If anyone knows how to fix this let me know.
|
|
|
|
|
flush fixes this, from memory.
Christian
#include "std_disclaimer.h"
People who love sausage and respect the law should never watch either one being made.
The things that come to those who wait are usually the things left by those who got there first.
|
|
|
|
|
How will my app check every second if I'm connected to the internet (in MFC)!?
/*
BETA
*/
|
|
|
|
|
Try this: InternetGetConnectedState
|
|
|
|
|
How can I disable a menu during runtime?
The Unknown Nobody
|
|
|
|
|
Process the WM_INITMENU or WM_INITMENUPOPUP and disable the items you want.
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor_soukhov@yahoo.com | ICQ:57404554 | http://siv.da.ru
|
|
|
|
|
What i need is that if you press a button, a menu/submenu is disabled.
Thank you for your help
SSR
|
|
|
|
|
I don't find response about that in the French web, therefore I try here...
I can move the components with the mouse in the dialog box editor, of course, but I would like to manage to specify my picture position (x,y) with the code.
With Delphi, it's MyPicture.Left=x and MyPicture.Top=y, and with Builder C++, it's MyPicture->Left=x; and MyPicture->Top=y; but with Visual C++ I don't find the members Left and Top for the my Control CStatic...
Do you know ?
Thanks...
|
|
|
|
|
Hi Pierrick,
You have to use MoveWindow() method of CStatic class. Refer MSDN for a arguments of this method.
Best regards,
-----------
Igor Soukhov (Brainbench/Tekmetrics ID:50759)
igor_soukhov@yahoo.com | ICQ:57404554 | http://siv.da.ru
|
|
|
|