|
Doh! The easiest ones are sometimes the hardest to find!
==================
The original message was:
Hi Jeremy!
I think your have problems because you are creating font in the local variable and as soon as it go out of scope the font is destroyed.
The lifetime of the CFont object should be the same as your edit control. The best thing to do this is to add a CFont variable to your dialog class.
Regards, Alex Gorev, Dundas Software.
================== The original message was: This must be easy BUT.....
I've tried to change the font on a single CEdit box in a dialog. I've used the following code....
CFont m_Font; m_Font.CreateFont(.........); GetDlgItem(CEDIT_ID)->SetFont(&m_Font);
Now this "sort of" works. The font is changed BUT the line size of the CEdit is not changed accordingly so the lines below overlap lines above.
Can someone please sell me how this can be done??
Thanks in advance
Jeremy Davis
|
|
|
|
|
I would like to know how I can execute another program
from within my MFC apps.
|
|
|
|
|
To execute another program from within your MFC/SDK application you can use 'ShellExecute'.
==================
The original message was:
I would like to know how I can execute another program from within my MFC apps.
|
|
|
|
|
==================
The original message was:
To execute another program from within your MFC/SDK application you can use 'ShellExecute'.
================== The original message was: I would like to know how I can execute another program from within my MFC apps.
Thanks, This is what I needed
|
|
|
|
|
==================
The original message was:
I would like to know how I can execute another program from within my MFC apps.
|
|
|
|
|
==================
The original message was:
I would like to know how I can execute another program from within my MFC apps.
I recommend using the _exec function or any of the variations of it. Look it up in C++ help since the command instructions are extensive.
Best wishes for the holday!
|
|
|
|
|
STARTUPINFO si;
PROCESS_INFORMATION pi;
BOOL bResult;
// Initialise the STARTUPINFO structure
memset(&si, 0, sizeof(si));
si.cb = sizeof(si);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_SHOW;
bResult = ::CreateProcess(NULL, // no executable module name (use command line)
"WordPad.Exe", // command line, file name in same directory as the DLL
NULL, // process handle not inheritable
NULL, // thread handle not inheritable
FALSE, // handle inheritance
0, // no creation flags
NULL, // use parent's environnement block
NULL, // use parent's starting directory
&si, // pointer to STARTUPINFO structure
&pi); // pointer to PROCESS_INFORMATION structure
if (!bResult)
{
TRACE("Can't start WordPad.Exe\n");
}
regards, Jean-Claude.
|
|
|
|
|
I use a dropdown combobox. By runtime the combobox style should be changed from CBS_DROPDOWN to CBS_DROPDOWNLIST. How can I do that.
Thank you for your help
Bernhard
|
|
|
|
|
Hi !
You can't change the style of the combo box after creating because different windows are created inside the control depending on the style.
For combo boxes created with the CBS_SIMPLE styles, the ComboBox window is the parent of the edit control and the list box that is always displayed on the screen.
Combo boxes created with the CBS_DROPDOWNLIST style have no edit control. The region of the combo box that displays the current selection is in the ComboBox window itself.
For combo boxes created with the CBS_DROPDOWN style, three windows are created. The combo box edit control is a child of the ComboBox window.
What I suggest you to do is either destroy and recreate control with different style or have two controls in the same position and hide/show one of them.
Regards,
Alex Gorev,
Dundas Software.
==================
The original message was:
I use a dropdown combobox. By runtime the combobox style should be changed from CBS_DROPDOWN to CBS_DROPDOWNLIST. How can I do that.
Thank you for your help
Bernhard
|
|
|
|
|
I'm not 100% positive...but I believe you can... try this in your InitDialog function
GetDlgItem(IDC_YOURCOMBO)->ModifyStyle(CBS_DROPDOWN,CBS_DROPDOWNLIST,0);
You may or may not need a :: in front of the GetDlgItem...whichever will give you a CWnd.
Carole
==================
The original message was:
Hi !
You can't change the style of the combo box after creating because different windows are created inside the control depending on the style.
For combo boxes created with the CBS_SIMPLE styles, the ComboBox window is the parent of the edit control and the list box that is always displayed on the screen.
Combo boxes created with the CBS_DROPDOWNLIST style have no edit control. The region of the combo box that displays the current selection is in the ComboBox window itself.
For combo boxes created with the CBS_DROPDOWN style, three windows are created. The combo box edit control is a child of the ComboBox window.
What I suggest you to do is either destroy and recreate control with different style or have two controls in the same position and hide/show one of them.
Regards, Alex Gorev, Dundas Software.
================== The original message was: I use a dropdown combobox. By runtime the combobox style should be changed from CBS_DROPDOWN to CBS_DROPDOWNLIST. How can I do that.
Thank you for your help
Bernhard
|
|
|
|
|
Hi Carole!
Modifying the style of the combo box will work only if you do this before the window creation. After that it will not work.
Alex Gorev,
Dundas Software.
==================
The original message was:
I'm not 100% positive...but I believe you can... try this in your InitDialog function
GetDlgItem(IDC_YOURCOMBO)->ModifyStyle(CBS_DROPDOWN,CBS_DROPDOWNLIST,0);
You may or may not need a :: in front of the GetDlgItem...whichever will give you a CWnd.
Carole
================== The original message was: Hi !
You can't change the style of the combo box after creating because different windows are created inside the control depending on the style.
For combo boxes created with the CBS_SIMPLE styles, the ComboBox window is the parent of the edit control and the list box that is always displayed on the screen.
Combo boxes created with the CBS_DROPDOWNLIST style have no edit control. The region of the combo box that displays the current selection is in the ComboBox window itself.
For combo boxes created with the CBS_DROPDOWN style, three windows are created. The combo box edit control is a child of the ComboBox window.
What I suggest you to do is either destroy and recreate control with different style or have two controls in the same position and hide/show one of them.
Regards, Alex Gorev, Dundas Software.
================== The original message was: I use a dropdown combobox. By runtime the combobox style should be changed from CBS_DROPDOWN to CBS_DROPDOWNLIST. How can I do that.
Thank you for your help
Bernhard
|
|
|
|
|
==================
Maybe he could put it in the PreCreateWindow then.....
Haven't tried it...but would be worth a shot.
The original message was:
Hi Carole!
Modifying the style of the combo box will work only if you do this before the window creation. After that it will not work.
Alex Gorev, Dundas Software.
================== The original message was: I'm not 100% positive...but I believe you can... try this in your InitDialog function
GetDlgItem(IDC_YOURCOMBO)->ModifyStyle(CBS_DROPDOWN,CBS_DROPDOWNLIST,0);
You may or may not need a :: in front of the GetDlgItem...whichever will give you a CWnd.
Carole
================== The original message was: Hi !
You can't change the style of the combo box after creating because different windows are created inside the control depending on the style.
For combo boxes created with the CBS_SIMPLE styles, the ComboBox window is the parent of the edit control and the list box that is always displayed on the screen.
Combo boxes created with the CBS_DROPDOWNLIST style have no edit control. The region of the combo box that displays the current selection is in the ComboBox window itself.
For combo boxes created with the CBS_DROPDOWN style, three windows are created. The combo box edit control is a child of the ComboBox window.
What I suggest you to do is either destroy and recreate control with different style or have two controls in the same position and hide/show one of them.
Regards, Alex Gorev, Dundas Software.
================== The original message was: I use a dropdown combobox. By runtime the combobox style should be changed from CBS_DROPDOWN to CBS_DROPDOWNLIST. How can I do that.
Thank you for your help
Bernhard
|
|
|
|
|
I have multiply views and document in seperate MFC DLLs and every view has its own toolbar. When i open new document in the same view it create again the toolbars (The code of create toolbars its on the constructor of the view). How i can modify the code to not recreate the toolsbar and i have the creation and the control of the toolbars in the same DLL because different DLL loaded in different version of the program.
|
|
|
|
|
a window is resizable, but when the length of window excede 300 pixels (for example), it can NOT make larger and stop resizing. How ? Thanks in advanced
|
|
|
|
|
You could catch the WM_SIZE message and check to see if the width is greater than you want it to be and then reset it to 300.
==================
The original message was:
a window is resizable, but when the length of window excede 300 pixels (for example), it can NOT make larger and stop resizing. How ? Thanks in advanced
|
|
|
|
|
Read up on WM_GETMINMAXINFO. Windows sends this to you as the user is resizing the window. You fill in a MINMAXINFO struct with the min/max sizes, and Windows will not let the window be sized outside of those bounds.
--Mike--
==================
The original message was:
a window is resizable, but when the length of window excede 300 pixels (for example), it can NOT make larger and stop resizing. How ? Thanks in advanced
|
|
|
|
|
I've got a set of filenames: some are to files which exist, others are to files which do not exist;
some are absolute, others are relative; some are on local drives, others on network drives.
I'm looking for a way to extract the drive name from a file path, regardless of any of the above
factors.
Can anyone give me a pointer of where to look for this?
Thanx.
|
|
|
|
|
I use something like the following to get the path of an executing application:
CString sPath;
// get the path where the application is running
GetModuleFileName(AfxGetApp()->m_hInstance,
sPath.GetBuffer(_MAX_PATH+1),_MAX_PATH); //path+file
sPath.ReleaseBuffer(); // releases excess memory
sPath = sPath.Left(sPath.ReverseFind('\\')); //keep path
ReverseFind finds the zero-based index of the first matching character (from the end).
You could use the equivalent of sPath.find and look for the first ":" or ":\" character (without the quotes naturally).
Hope this helps.
Al
==================
The original message was:
I've got a set of filenames: some are to files which exist, others are to files which do not exist; some are absolute, others are relative; some are on local drives, others on network drives.
I'm looking for a way to extract the drive name from a file path, regardless of any of the above factors.
Can anyone give me a pointer of where to look for this?
Thanx.
|
|
|
|
|
Have a look at the _splitpath API function...
- Chris
==================
The original message was:
I've got a set of filenames: some are to files which exist, others are to files which do not exist; some are absolute, others are relative; some are on local drives, others on network drives.
I'm looking for a way to extract the drive name from a file path, regardless of any of the above factors.
Can anyone give me a pointer of where to look for this?
Thanx.
|
|
|
|
|
Hello,
I am trying to add a background image to a control. I was trying to use Mihai Filimon's method (see Adding background image to any control) but I am have 3 link errors, live "unresolved external... AtlComPtrAssign(..) ). I added atl.lib to my project settings. Is there any other thing I might have forgotten to do?
Thank you.
|
|
|
|
|
Hi!
There is no any problems of using the AtlComPtrAssign() method if you are creating the ATL project using MSVC wizard (I've tried it). If you are adding ATL support to an existing MFC application you can follow this steps:
1. From ClassView, select the project to
which you want to add ATL support, and
click the right mouse button.
2. From the popup menu, click New ATL Object.
3. When prompted, click Yes to add ATL support.
4. From the ATL Object Wizard dialog, select
the object you want to add.
Note If you only want ATL support without adding any
ATL objects, click Cancel in the ATL Object Wizard.
Good luck,
Alex Gorev,
Dundas Software.
==================
The original message was:
Hello, I am trying to add a background image to a control. I was trying to use Mihai Filimon's method (see Adding background image to any control) but I am have 3 link errors, live "unresolved external... AtlComPtrAssign(..) ). I added atl.lib to my project settings. Is there any other thing I might have forgotten to do? Thank you.
|
|
|
|
|
I am needing to create a Singleton COM component. This needs to have data served to several programs so of course needs to be an out of process server which leads me to using the ATL EXE server rather than a DLL or a MFC based COM object. It appears that I can create one rather straight forward from the ATL wizard under the new option in Visual Studio 6. However I am missing something. Although I can see the created component in the OleViewer via its TypeLib I can not access it to use in any programs. When trying to add it via "Project/AddtoProject/ComponentsAndControls" I get a message "File Does Not Exist".
Any pointers on what I am missing. Thanks Mike.
|
|
|
|
|
Hi Mike!
You should use the #import directive with the name of your TLB file. You can find more information about it in MSDN.
Regards,
Alex Gorev,
Dundas Software.
==================
The original message was:
I am needing to create a Singleton COM component. This needs to have data served to several programs so of course needs to be an out of process server which leads me to using the ATL EXE server rather than a DLL or a MFC based COM object. It appears that I can create one rather straight forward from the ATL wizard under the new option in Visual Studio 6. However I am missing something. Although I can see the created component in the OleViewer via its TypeLib I can not access it to use in any programs. When trying to add it via "Project/AddtoProject/ComponentsAndControls" I get a message "File Does Not Exist".
Any pointers on what I am missing. Thanks Mike.
|
|
|
|
|
I am using vc++ 6.00 and I am using drawtext to output text. I am not able to print characters above ascii 127. I tried to make them unsigned char, I also tried the /J option but nothing happens. Please help me.
|
|
|
|
|
It will depend on the font that you are using. I assume you are trying to print out characters like the box drawing ones (or foreign language chars). Many of the Windows fonts map only to a small square box (or some other boring shape) for chars above 127. Some of the OEM terminal fonts may be more useful for you. Of course it could be something else that isn't right. You should probably also check if you are using Unicode or not and make sure you are casting your strings with TCHAR - this could impact on it as well. Another thing would be the default language you are using.
Regards,
Gary Menzel
==================
The original message was:
I am using vc++ 6.00 and I am using drawtext to output text. I am not able to print characters above ascii 127. I tried to make them unsigned char, I also tried the /J option but nothing happens. Please help me.
|
|
|
|