|
Two ways:
1. GotoDlgCtrl ( GetDlgItem ( IDC_MY_EDITBOX ));
2. GetDlgItem ( IDC_MY_EDITBOX )->SetFocus();
|
|
|
|
|
Use this:
GotoDlgCtrl(GetDlgItem(IDC_MYCONTROL));
That way, you don't need to setup a member variable of the control type...
|
|
|
|
|
How can I set separately any Video for Windows parameters (Brightness,Saturation,Contrast, Hue and others)
from my application without vfw standard dialogs?
ok@aquanet.co.il
|
|
|
|
|
I am looking for some clues as to how to do Detachable Menus using MFC. These menus can be seen in Microsoft Powerpoint under Slide show\Action Button menu pick.
They have a tiny caption bar on them, and user can click and drag them to detach them.
I could get the same look using Owner draw menus. But I am having a hard time trying to emulate click and drag because it is menu, and not a window. Any ideas are greatly appreciated.
|
|
|
|
|
You might Like to have a look at Stas Levin's BCGControlBar library. It's free and supports tearoff menus, as well as the rest of the Office 2000 UI.
His homepage is:
http://msnhomepages.talkcity.com/WindowsWay/stasl/index.html
Not sure if this will be of use to you, but it could be.
Yours,
|
|
|
|
|
hi,
in fact, these menu are simply toolbar (detachable) with textbutton wich display a popup menu when pressed. There is no way to add a CMenu to a CToolBar, and as CMenu is not a CWnd derived, there is no way to dock it in anything ...
you should check this great article wich explain the popup method :
http://www.microsoft.com/msj/defaulttop.asp?page=/msj/0199/c++/c++0199top.htm
I've currently my own implementation of this system, but this is a lot of code since you have to do all menu i/o management yourself. You should use the pixielib on the
dilascia page (he wrote the article below)
++, Benoit
authem_b@epita.fr
|
|
|
|
|
Dear Friend...
Thanks for the reply..I was wondering myself that this tearoffs should be toolbars mimicing menus.
In fact for menu customization, I ended up creating a custom menu class which is a toolbar by itself.
However, I found one issue with the customdraw notification that CToolBar sends us. These tearoffs
normally have a small caption, which I believe is just a customdrawn button. But if you specify a smaller
height for a tearoff button ( of normal window caption / 2 ), CToolBar still draws the button with the normal
size. So in effect what you get is a button which is partically filled with the caption color. How do we solve
this problem?
Thanks for pointing me to Paul's article. That is a great help. And also thanks for substantiating my guess
that these popups are actually toolbars, and that Microsoft haven't found an ingenuous way of manipulating
menus!!!
Regards
Shailesh
|
|
|
|
|
Hi,
I recently purchased visual studio 6.0, and the book Programming Microsoft Visual C++, Fifth Edition. Now, by trade I am a unix programmer, so my normal day to day activities are via the 'vi' editor. In the book (mentioned above), chapter 1, page 10 under "The Source Code Editor", the first sentence states that Visual C++ 6.0 contains keyboard bindings for "a variety of popular editors (such as VI and EMACS).." - maybe I'm just looking wrong, but I can't find out how to do this, the 2 included with VS6.0 are Developer Studio, Visual C++ 2.0, Epsilon, and BRIEF. I've loaded service pack 4, and have searched endlessly through MSDN, to no avail. If someone knows what I need to do to enable VI key bindings within the source code editor of Visual C++ 6.0+SP4, I would be very happy.
Thank you,
Nick
|
|
|
|
|
This is probably a simple question to answer, but I can't seem to find a solution. I am trying to create two new documents when the user chooses the "File|New" command. I have two document templates set up, and wish to create one of each automatically.
Also, how would I go about handling an "File|New Document 2" command - To create a new document from template 2, without showing the user the MFC "new file type" dialog.
I hope semobody can help me with my problem.
Thanks in advance,
David Wulff
Battleaxe Software
|
|
|
|
|
#1 First create two new data members in your application class.
for example:
CMultiDocTemplate* m_pDocTemplate1;
CMultiDocTemplate* m_pDocTemplate2;
#2 Change the document template registering to something
like this.
m_pDocTemplate1 = new CMultiDocTemplate(
IDR_MYDOC1,
RUNTIME_CLASS( CMyDocument1 ),
RUNTIME_CLASS( CChildFrame ),
RUNTIME_CLASS( CMyView1 ) );
AddDocTemplate( m_pDocTemplate1 );
m_pDocTemplate2 = new CMultiDocTemplate(
IDR_MYDOC2,
RUNTIME_CLASS( CMyDocument2 ),
RUNTIME_CLASS( CChildFrame ),
RUNTIME_CLASS( CMyView2 ) );
AddDocTemplate( m_pDocTemplate2 );
#3 Overwrite the "OnFileNew" command handler in your
application class.
void CMyApp::OnFileNew()
{
// don't call CWinApp::OnFileNew()
// Create a new document from template 1
m_pDocTemplate1->OpenDocumentFile( NULL );
// Create a new document from template 2
m_pDocTemplate2->OpenDocumentFile( NULL );
}
That's it.
Best regards
Holger Persch
|
|
|
|
|
Thanks. It is so simple, yet I spent ages doing everything but that. I was thinking more along the lines of creating the new document, manually by creating the frame, view, etc - but this is all I need!
Thanks again,
|
|
|
|
|
I would like to know How I could dipslay japanese character in CStatic run under English window nt version and set font to MS gothic. The reason is that I can display japanese characters correctly by setting font to MS gothic in MS access under English window nt version and english Access version. However there is something that MS handle to display japanese characters when font is setting to MS gothic. I try to put some text in Vb control and set font to MS gothic some control work and some don't
Any idea
|
|
|
|
|
You need to make sure that the proper code pages are displayed. Most often, the English NT does not have the correct .NLS files to display Japanese characters installed to the computer.
At least this is a place to start. Then you need to set the locale for the control and then set the font. Otherwise, you are just as likely to set it to the English font rather than the Japanese font.
|
|
|
|
|
Hi everyone,
I have this question regarding DLL. I'm currently working on a project that contains an application( A FRAME ) that is using DLL functions. I have A MENU on the frame and in the menu, I have functions that uses DLL.
Let say for example, in the MENU, I would have an option named CACULATIONS, and under CALCULATIONS, I would have a ADDITION option. So when I click on the ADDITION, a dialog box would pop up and allow me to use the addition function created by a ADDITION DLL.
What I would like to know is the following, Is it possible for me to add new DLL's into the application without adding codes to the application itself (i.e without adding new codes to the frame)??
For example, let's say I have a new Calculation method called SUBTRACT and it's a separate DLL from the original adding dll. Then if I have a option in the MENU called ADD DLL, I would have a dialog box pop up in which allows me to add the new dll.
The dialog box will contain edit boxes that asks the user to enter where the new DLL file is, and what the user would like to call the new DLL method that he's adding.
So when the user enter the values and runs the program, a SUBTRACT option will now be listed under the CALCUATION MENU and the application will now be able to refer to the SUBTRACT DLL without adding new codes to the application itself. IS THIS POSSIBLE??? It's sort of like a plugin thing. IF ANYONE HAVE ANY IDEAS, PLEASE LET ME KNOW.
THANK YOU VERY MUCH.
Steve
P.S: One more thing, is there a code that allows me to call up the OPEN AND SAVE dialog boxes. (i.e when you want to open an existing document in Words, a dialog pop up.) How do I write codes for those dialog boxes for OPEN, SAVE, AND SAVE AS??? PLMK. THANKS AGAIN!
|
|
|
|
|
Read the article:
How to do run-time (or explicit) linking of C++ plug-in components and objects
By Gert Boddaert
here at Codeproject.
http://www.codeproject.com/dll/plug-in.asp
I hope this helps
Best regards
|
|
|
|
|
I was wondering what MFC dlls need to be included in a program that I use. It only uses CButton, CEdit, and CListCtrl controls. I know that the user will need to have ie4 or greater for the list control, but I'm unsure of what else might be needed. I would like to distribute the app for NT4, 95, and 98. Could someone help me out?
|
|
|
|
|
If you want to distribute the program then it means you need only files
MSVCRT.DLL
MFC42.DLL
other mfc*.dll files are only for Debug version
Hope it helped, Honza
|
|
|
|
|
Run the Dependency Viewer on your EXE to find out which DLLs it uses.
|
|
|
|
|
Look on your VC++ CD for the DEVSTUDIO\Vc\Redist folder. This folder contains all the files you will need to redistribute any VC++ applications on various Windows platforms.
The file REDISTRB.WRI tells you which files you will need under which circumstances for a given platform.
For many applications you *will* a need different set of DLLs for WinNT and Win95, e.g. atl.dll.
Don't just copy some likely looking DLLs and hope it will be OK - I tried that once and got burnt
Dave
|
|
|
|
|
How do I add tooltips to a CToolBar using an extended tooltip control like Chris Maunder's multiline extended tooltip control. See the link below:
http://www.codeproject.com/miscctrl/tooltipex.asp
Thanks in Advance,
John
|
|
|
|
|
Note: The environment where my program ,must run is one without mice.
I have created a dialog that has two added controls to the CFiledialog using the stc32 and those stuff.
Now I would like to be able to set the focus to one of those controls when the users press the tab key over the cancel button, but I have no idea where to start.
Could you help me?
Thank you in advance.
|
|
|
|
|
Hi All,
I need to create a UDP Packet and send it to multiple Servers (and monitor the replies that the program (Anti-Virus) will return. Basically it is to test if the servers are working correctly (basically a test virus). Replies mean its working fine...if no reply we have a problem with the server reporting the viruses. Currently being done via an ms-dos batch file and takes 45 min. (with human intervention) to complete...Thats a big waste of time!!!!
I have seen a spoofing program at CodeGuru, but don't see where I can insert the proper message to make this happen...
Can anyone help???
Dan
|
|
|
|
|
Printing problem.
I have a dialog with a web browser control on it. To provide print functionality I'm using the 'Second Method' described in the MSDN "HOWTO: Print from the Microsoft WebBrowser Control" article:
LPDISPATCH lpDispatch = NULL;
LPOLECOMMANDTARGET lpOleCommandTarget = NULL;
lpDispatch = m_ctrlBrowser.GetDocument();
ASSERT( lpDispatch );
lpDispatch->QueryInterface( IID_IOleCommandTarget, (void**)&lpOleCommandTarget );
ASSERT( lpOleCommandTarget );
lpDispatch->Release();
// Print contents of web browser control
if( m_bStatic == true )
lpOleCommandTarget->Exec( NULL, OLECMDID_PRINT, 0, NULL, NULL );
else
{
lpOleCommandTarget->Exec( NULL, OLECMDID_PRINT, OLECMDEXECOPT_DONTPROMPTUSER, NULL, NULL );
}
lpOleCommandTarget->Release();
The dialog can be loaded as normal and the print functionality works fine. However, the dialog can also be loaded so that the OnBtnPrint function is called when the url has been navigated to (the m_bStatic variable is set to true for normal dialog loading), then it posts WM_CLOSE:
void FSReportDlg::OnNavigateComplete2Explorer(LPDISPATCH pDisp, VARIANT FAR* URL)
{
if( false == m_bStatic )
{
OnBtnPrint();
PostMessage( WM_CLOSE );
}
}
The problem is that when the dialog is loaded in this fashion only the first page is ever printed, even though it knows how many pages there are (i.e. page 1 of 6). I have tried it without OLECMDEXECOPT_DONTPROMPTUSER and only the first page is printed if the 'All Pages' option is selected. If a page range is specified then all pages are printed correctly. However, the whole point of this functionality is that no user intervention should be needed.
There is a further problem. A selection of urls may be printed, causing the dialog to be loaded for print only once for each url. When this is attempted the first page of the first url is printed, but then a 'Navigation Cancelled' page is printed for each url afterwards.
Anyone got any ideas?
System is:
Windows NT4 SP5/6 (tried on different machines with same symptoms)
Internet Explorer 4.72.3612.1713 & 5.00.2919.6307 (tried on different machines with same symptoms)
Developed with:
Visual Studio 6 SP3
|
|
|
|
|
I've searched, although not exhaustively for some reference or example of implementing recordset paging without success.
I have an application that allows users to search for records by any criteria. While this makes things easy for the users, when searching on large tables with minimal search criteria, quite a lot of data has to go over the network. What I want to do is implement a paging mechanism that will get the first x records in the set, then keep track of the users position in the recordset, and only retrieve more records when they are needed.
Ideally I believe this should be a part of my underlying data classes, and I have to believe someone has done this before... Does anyone know of a reference/example they can share?
Thanks!
|
|
|
|
|
I would like to control the mouse and mouse klicks from my program.
I also would like to know if it would be possible to
simulate the keyboard from my program, so that the program
could enter text in other programs.
An example in VC++ for the two problems above would be appreciated.
|
|
|
|
|