Visual C++ :: How To Create Edit Box In CView
Dec 16, 2013
I'm trying to create an edit box in a CView.So far, this is how far I've gotten:
With this code
Code:
// .h
CEdit m_MyEditField;
// .c
m_MyEditField.Create(WS_CHILD | WS_VISIBLE,CRect(40,40,500,Y+55),this,0x1552);
m_MyEditField.SetWindowText("this is my CEdit field");
As you can see, the edit box doesn't look like the ones in a dialog, which is what I'm trying to accomplish.
Is there possibly some other class I should be using for the edit box?Or another setting for .Create?
View 2 Replies
ADVERTISEMENT
Feb 10, 2013
I have an SDI / CView app (VS 2010). All works well until I minimize the app using the minimize button or drag it partially off of the screen. In the former instance, any attempt to restore the app results in an appcrash with a tight freeze up of the machine. In the later instance the same happens immediately.
In building the app, I scoured the web for code to accomplish the loading and display of the bitmap. After some experimentation I settled on overriding the OnPaint. Below is the code. Note that m_Map is a CBitmap member and IDB_BITMAP1 is a loaded bitmap resource.
Code:
void CMyDragViewView::OnPaint()
{
// CPaintDC dc(this); // device context for painting
// TODO: Add your message handler code here
// Do not call CView::OnPaint() for painting messages
// http://msgroups.net/microsoft.public.vc.mfc/loading-bitmaps-into-main-window/563285
int x = m_Map.LoadBitmap(IDB_BITMAP1);
TRACE1(" x = %d
", x);
CPaintDC* dc = new CPaintDC(this);
[code]....
I suspect that the problem is OnPaint trying to repaint the bitmap which requires reloading it, but I don't know how to work around this.
View 3 Replies
View Related
Nov 22, 2013
My program (Test) is a basic MFC AppWizard (exe) created project. I have followed the steps in the link below to create a docked dialog box (myDialog) using VC++. [URL]...
The dialog box works, however, I have 2 issues that I am trying to resolve.
1) I have added a button to the Dialog box, however, when I run the application they start as disabled (note: the Disabled option on the Button Properties is unchecked). If I add function myDialog::OnButton to the myDialog class, the button remains disabled, however, if I add the function CTestView::OnButton to the View class, the button becomes active and works. How can I make the button work from the myDialog class?
2) I would like to be able to change an Edit box in the same dialog box when I click the button. How can I access the pointer to the myDialog from the View class?
View 2 Replies
View Related
Dec 12, 2012
I am attaching a sample project. Basically what this project does is that I initialize a variable map<CString, bool*> m_mapTest in CView::OnInitialUpdate and then pass the variable to CDocument class. On the other hand, within the function OnSaveDocument defined in CDocument I check m_mapTest. To my surprise, the CString part of m_mapTest is correct but the bool* part of m_mapTest is wrong(I pass an array of bool in CView::OnInitialUpdate).
View 3 Replies
View Related
Feb 25, 2014
I'm using the Feature Pack CTabView, and I noticed that when the view is added using AddView with the following code CView's HWND is NULL when I try and access each of the CView1,CView2, etc.
Code:
int CMyTabView::OnCreate(LPCREATESTRUCT lpCreateStruct) {
if (CTabView::OnCreate(lpCreateStruct) == -1)
return -1;
AddView (RUNTIME_CLASS (CView1), _T("Simple"),100);
AddView (RUNTIME_CLASS (CView2), _T("Pair"),101);
AddView (RUNTIME_CLASS (CView3), _T("Data"),102);
return 0;
}
I think the user has to click the view's tab before the CTabView assigns an HWND. Is there a way to force CTabview to give each CView an HWND when the view is added?
View 11 Replies
View Related
Sep 14, 2013
I have been working with both Chris Mander's MFC grid and the Ultimate Grid.
See for details:
The Ultimate Grid Beginner's Guide By The Ultimate Toolbox, 25 Aug 2007 : [URL] ....
MFC Grid control 2.27 By Chris Maunder, 6 May 2010 : [URL] ....
Both of these grid controls work nicely in a SDI CView windows. But when I create a split window using CSplitterWnd and the following code in an attempt to create a split window with a CListView and and a CView using this code:
Code:
// in CMainFrame.h
// Attributes
public:
CSplitterWnd m_wndSplitter;
//..
// in CMainFrame.cpp
//..
BOOL CMainFrame::OnCreateClient(LPCREATESTRUCT lpcs, CCreateContext* pContext)
[Code] .....
The grid in the CView window appears but is frozen in both instances. I suspect there is some notification necessary to for the grid to send and receive messages from the split CView window, but I cannot figure out how to implement this notification.
Unfortunately, even a demo application would be too large to append, but for anyone that is interested, the split method is encapsulated in the code I've presented here and the implementation of both grid controls is well explained in the links provided.
View 6 Replies
View Related
Sep 24, 2013
I'm trying to take a value from an edit box and display it in the edit box as hex. I'm using this code:
CString buffer;
int intbuf;
m_edit[5]->GetWindowTextA(buffer);
intbuf = atoi(buffer);
buffer.Format("%02X", intbuf);
m_edit[5]->SetWindowTextA(buffer);
If I include the last line of code here I get a stack overflow error. If I don't include it, I can run through the debugger and the buffer CString is converted to hex just like I want, I just can't display it because I get that error.
View 4 Replies
View Related
Apr 17, 2015
Is it possible to edit the message map at startup instead of just having it set at compile time?
I'm reading some values from an XML file at startup. The menu options will be determined from what I find in there. But I need to assign those menu options to the message map.
View 8 Replies
View Related
Apr 26, 2014
I have a tabbed dialog with a couple of Separate dialogs. I created classes of CDialog for each dialog. Im trying to get the text from the edit control from the tabbed dialog and it appears in a message box when I press a button on the main dialog.
Code:
myDialog test;
test.UpdateData(TRUE);
CString bla = test.m_edit1;
test.UpdateData(FALSE);
MessageBox(bla,bla,MB_OK);
The m_edit is a variable of CString for the edit box
it gives me a error and crashes.
How do I get the text from the other dialogs edit control?
View 8 Replies
View Related
Mar 15, 2013
Found an online suggestion of using an rc2 file and cut and paste stuff from .rc file to .rc2 file to see which line causes the problem but don't know how to create a blank .rc2 file. Problem started after I ported from VC++ 6 to VS2010.
View 5 Replies
View Related
Apr 13, 2015
I have a dialog box with several edit control boxes and I want to identify the edit control when I click the left mouse button on it. Any button action (up or down) doesn;t register when the mouse is clicked on any of the edit controls. There has got to be a simple way to do this.
View 1 Replies
View Related
Feb 26, 2014
I need to edit ,update and display a group of 40 parameters on screen. (10 parameters per page and use of Arrow Key pad or touch screen clicks to modify value)....
For that I will need .. Parameter No . , String Name , Point Screen Cord , double value , next element no. etc I have my old code with structure and array of structure written in C. I have translated it on C++/MFC .
How can I implement Class property of c++ ?
View 8 Replies
View Related
Aug 28, 2014
I am trying to create a OCX from a C++ dll., Here's the scenario I have a C++ dll and this dll needs to be called in VB.net program my boss want's me to create an OCX out of this.
C++ dll and use it in a VB.net class library, apparently I have created an OCX but it requires a form but the VB.net program is a class library.
View 5 Replies
View Related
Aug 11, 2013
I'm trying to create a simple webbrowser at my app.
code sample:
....
ATL::CAxWindow m_wndContainer;
ATL::CComPtr<IWebBrowser2> m_spWebBrowser;
HWND hWnd = m_wndContainer.Create(NULL,
CRect(0,0,200,100),
(LPCTSTR)0,
WS_CAPTION|WS_THICKFRAME|WS_OVERLAPPED|WS_MINIMIZEBOX|WS_MAXIMIZEBOX);
CoCreateInstance(CLSID_WebBrowser,NULL,CLSCTX_INPROC,IID_IWebBrowser2,(void**) &m_spWebBrowser);
...
everything is work fine except the fact the it seems that it create an IE version 7.0 and my machine have IE 8 installed.
it not suppose to create the IE according to my installed version?how do i suppose to do it?
View 1 Replies
View Related
Feb 13, 2014
How can I create a dialog as a DLL ? I have a SDI MFC app (CView is based on CFormView) and from a button I want to load a modal dialog, but that dialog must be developed as DLL ... I didn't find something that fit my needs on internet ... P.S. I have only VC6 !
View 14 Replies
View Related
Apr 16, 2013
Well,I have a dat file which following format;
ID Level(Manager or Executive)
Name
Sales(for 12months)
For example;
W00051 M
Lee Ah Moi
1200.00 150.00 1400.20 156.00 200.00 880.00 1500.00 8000.00 800.00 120.00 1600.00 1800.00
My question is how am i going to find the value 880.00 (August) & replace it with a new value?
Is it possible for me to open & edit the same file without creating s new one?
View 5 Replies
View Related
May 23, 2013
how to create a new toolbar with my icons in vc++?
View 3 Replies
View Related
Jan 27, 2013
how to create, initialize, and maintain a memory device context that works as a local buffer for images? The idea is to maintain some large images in local DCs and bitmaps, and only bitblt them to screen in OnDraw().
What I did so far was was to define CDC and CBitmap objects as members of my View class, and then tried to initialize them with the sequence that begins at "// Initialize buffer". I placed that sequence in either OnInitialUpdate, or PreCreateWindow, or OnPrepareDC, or the view constructor, to no avail. The code always crashes in OnDraw, and I've noticed that the m_hDC member of myDevice is zero at that point.
Obviously, the initialization is wrong and MFC does (too many) things in the background which I'm not aware of.... My question was where can I read about that?
Code:
class CMyView : public CScrollView {
// ...
CDC myDevice;
CBitmap bmp;
CBitmap *oldbmp;
[Code] .....
View 5 Replies
View Related
Jan 7, 2013
How can I create MS Word 'print layout' like interface. The attached picture says it all. Basically I want a shaded area around my document just like word so it gives a feel of the 'page'.
I was hoping I can override some function somewhere and along that lines tried playing around with below but that didn't work.
Code:
BOOL CMainFrame::PreCreateWindow(CREATESTRUCT& cs) {
if( !CFrameWndEx::PreCreateWindow(cs) )
return FALSE;
// TODO: Modify the Window class or styles here by modifying
// the CREATESTRUCT cs
cs.cx = 250; // just playing around with size
cs.cy = 250;
return TRUE;
}
How can I do that?
View 6 Replies
View Related
Dec 29, 2012
I want to create a basic window using visual c++ 2010 express.
View 1 Replies
View Related
Dec 23, 2012
How can I implement the paradigm demonstrated by the code below to run on WinXP?
I want to fork a process or create a thread that shares global variables with the parent process/thread.
The child process/thread monitors the progress of the parent process/thread.
I cannot find documentation for a fork function per se, a Unix term. It might be called something different for WinXP.
I would be happy to use threads instead. But I'm rusty even with Unix application threads; and I know nothing of WinXP application threads.
So any turnkey implementation that demonstrates the simplest use of process or thread functions for my purpose demonstrated below.
In either case, do "forked" processes and threads share global address space in WinXP, as they do in Unix?
I would prefer to avoid the overhead of IPC mechanisms. The "overhead" includes my own relearning curve.
The GUI screwed up my indentation. I would try to correct it. But the proper indentation appears when I edit the posting. I suppose I need to insert real tabs. Haven't figured out how (yet).
Not even real tabs work; and I cannot get the "paste as text" button to behave as I expect. What is the trick for posting indented text in this GUI?
#include "stdafx.h"
#include <stdlib.h>
#include <Windows.h>
long curCount;
int isRunning;
int _tmain(int argc, char* argv[]) {
curCount = 0;
isRunning = 1;
[code]....
View 4 Replies
View Related
Jul 28, 2014
Is it possible to create an NPAPI Plugin in VC++, that is cross browser compatible or should atleast work in Chrome Browser?
View 1 Replies
View Related
Mar 5, 2014
I am wokring on a project that has used an MFC DLL in conjunction with Outlook to send and archive mail. I need to be able to create folders for integration from an older mail system. I have looked online to see if there are examples in C++ (since I have to modify the existing C++ dll to include the funcitonality). I realize it is much simpler using VBA or C#, but I am limited with my choice. I essentially want to use the MFC type lib for Outlook 14 and use the CMAPIFolder,CFolders create folders in the Inbox.
here is a sample of the code:
//I have included the necessary header files
COleVariant covOptional((long)DISP_E_PARAMNOTFOUND, VT_ERROR);
//start outlook
if (!olApp.CreateDispatch(_T("Outlook.Application"), &e))
[Code]....
View 5 Replies
View Related
Mar 1, 2014
I compiled the source code of QT5.1 to work with Visual Studio 2010.
But it always start off with a win32 project, so that I need to change the settings every time.
How do I kick start with a x64 project by default?
View 1 Replies
View Related
Aug 13, 2014
Its my 1st time using fopen,fprintf and others and i cant seem to edit my file via fprintf! Heres my program:
Code:
#include <stdio.h>
#include <stdlib.h>
char letter,check,nought,bleh,hi,a;
int main()
[Code]....
View 2 Replies
View Related
Jan 20, 2015
how i am using wxDev-c++ and i need to make.Tasks would include: use a class or struct variable, and create a program that can perform the following actions:
1. The data provided by the user to enter the keyboard.
2. The display of the stored data.
3. edit the data.
Example of data: name surname age.
I Try like it,its let me input and save it but how to edit it or i am doing it bad?
#include<iostream>
#include<fstream>
using namespace std;
int main()
[code]....
View 5 Replies
View Related