|
Nice! MFC makes creating the property pages similar.
I assume I will create a new class derived from CPropertySheet and instantiates the property pages. Correct?
Kuphryn
|
|
|
|
|
no. just instantiate a CPropertySheet object and add your pages to it (just like my little sample code does). unless you need to change the default sheet behavior you don't need to create a new class for it.
-c
There ain't no second chance
Against the thing with the forty eyes
|
|
|
|
|
Okay.
In his book, Jeff Prosise implements an Apply button. I am not sure if he creates it via deriving a class from CPropertySheet or CPropertySheet comes default with it.
Kuphryn
|
|
|
|
|
Chris Richardson, a member at CodeGuru mentioned that the default CPropertySheet that MFC generates does come with an Apply push-button.
http://63.236.73.79/cgi-bin/bbs/wt/showpost.pl?Board=vc&Number=371721&page=0&view=collapsed&mode=threaded&sb=5
Kuphryn
|
|
|
|
|
I got the property sheet to work with two property pages. I used the default method (same as yours) to create the property sheet. Now I am trying to figure out how to update the data in doc after the user clicks Apply in the property sheet. Jeff Prosise derived a completely separate property sheet, thus I can seen what is going on with is code. However, with MFC default CPropertySheet, I am not sure how to copy data from the property pages to data in doc. In the code Prosise creates, the property sheet sends a message to main, which redirects the message to view where the data are copied. Prosise uses the ELLPROP data structure.
Do I have to create something similar to what Prosise shows or is there a default way to copy data after the user pushes Apply?
Kuphryn
|
|
|
|
|
|
There is a checkbox, right above the "Submit" button, that says "Notify me by e-mail if someone answers this message." It is on by default but you can turn it off.
I am not sure if there is a way to change the default - so that it shows up off by default for your user account. If so I haven't found it.
No generalization is 100% true.
Not even this one.
|
|
|
|
|
Hello
I've one problem with CListBox messages
So I've class CContactCtrl : CListBox
This Control is Ownerdraw Variable and she nicely operate WM_DRAWITEM and
WM_ERASEBKGND
messages, but only when the control has some elements.
When I remove all elements from control then I have white background
When I override WM_PAINT message then background is painting very well, even
if
control doesn't have elements, but WM_DRAWITEM doesn't occur
What can I do to fix this problem?
Maybe I should send WM_DRAWITEM message from WM_PAINT function?
Sys: XP & VC++.NET
sorry for my bad english...
NodeX
|
|
|
|
|
In this piece of code I expect a CRichEditCtrl to clear itself. It works fine in Win98, in XP nothing happens.
UpdateData(TRUE);
m_profileCtrl.UpdateData(TRUE);
m_profile.Empty();
m_profile.Delete(0,m_profile.GetLength());
m_profile = _T("");
m_profileCtrl.UpdateData(FALSE);
UpdateData(FALSE);
Of course this piece of code is a bit overkill, yet it should work.
Am I making some sort of stupid mistake, or can I safely blame XP?
Also, is there another way to clear a text box properly?
Cheers!
|
|
|
|
|
Try adding an UpdateWindow call at the end (though I thought it should work without it.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I found it!
You'll NEVER believe it, but the ONLY way to make it work was by setting the text to a space _T(" ");
Unbelievable!
Thanks for your quick answer though!
|
|
|
|
|
Hmmm... this does seem like a bug to me. Maybe someone else here can enlighten us.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
It was very odd, and frustrating, as I don't have XP myself. So I kept sending patches, but they didn't work
- Griffith
|
|
|
|
|
Just a hunch; try it without misusing the CString object:
<br />
CRichEditCtrl::SetWindowText( _T( "" ) );<br />
Peace!
-=- James.
"Fat people are hard to kidnap."
(Try Check Favorites Sometime!)
|
|
|
|
|
That was about the first thing that came to mind with me, and much to my surprise that didn't work.
Especially because the CRichEditCtrl::Clear(); fuction refused to work too.
|
|
|
|
|
Then that sounds like either (1) a serious bug in the RE Control, or (2) a redraw problem.
Peace!
-=- James.
"Fat people are hard to kidnap."
(Try Check Favorites Sometime!)
|
|
|
|
|
I have am having a problem with my status bars. I have 2 and the first one has 2 panes (don't know if that makes a difference). The problem occurs when I resize when my main window is not maximized and I use the grippers to resize the status bars...When I do this, the status bar does not refresh properly...It keeps drawing the new size on top of the old one. I don't know what I am doing wrong.
Here is some of my code:
static UINT indicators1[] =
{
ID_SEPARATOR, // status line indicator
ID_INDICATOR_CAPS,
ID_INDICATOR_NUM,
ID_INDICATOR_SCRL,
};
static UINT indicators2[] =
{
ID_SEPARATOR, // first message line pane left
ID_SEPARATOR, // first message line pane right
};
CMainFrame::OnCreate
--------------------
// Create Status Bar1
if (!m_wndStatusBar1.Create(this) ||!m_wndStatusBar1.SetIndicators(indicators1,sizeof(indicators1)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1;
}
// Create Status Bar2
if (!m_wndStatusBar2.Create(this, WS_CHILD|WS_VISIBLE|CBRS_BOTTOM, ID_RESULT_STATUS_BAR) ||
!m_wndStatusBar2.SetIndicators(indicators2,sizeof(indicators2)/sizeof(UINT)))
{
TRACE0("Failed to create status bar\n");
return -1; // fail to create
}
// Set up Status bar styles
m_wndStatusBar1.SetPaneInfo(0,0,SBPS_STRETCH|SBPS_NORMAL,0);
m_wndStatusBar2.SetPaneStyle(1,SBPS_NOBORDERS);
CMainFrame::OnSize
------------------
// Resize the Status Bars
if (m_wndStatusBar2)
{
CRect rect;
m_wndStatusBar2.GetWindowRect(&rect);
m_wndStatusBar2.SetPaneStyle(1,SBPS_NOBORDERS);
m_wndStatusBar2.SetPaneInfo(1, 0,SBPS_NOBORDERS, rect.Width()/2);
}
ANY HELP WOULD BE MUCH APPRECIATED!
Thanks in advance!
Mandy
[akashorty.net]
|
|
|
|
|
I was doing a ShellExecute and expected a non-associated file to bring up the "Open with" dialog. It does not. How can I bring up the open with dialog in a C++/MFC program?
Thomas
modified 29-Aug-18 21:01pm.
|
|
|
|
|
Use CFileDialog...
Regards,
Dan
|
|
|
|
|
Here someone bothered to write the full solution.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Hi All,
I have a dll that works great in VB/ASP, but when I created an .idl file, I get an error when compiling:
.\test.idl(31) : error MIDL2025 : syntax error : expecting a type specification near "<"
.\test.idl(31) : error MIDL2026 : cannot recover from earlier syntax errors; aborting compilation
below is where it is happening:
NOTE: On the following line, I had to put quotes in the code so you could see the code because it looked like a TAG in HTML...("<"GetRefTypeInfo failed">"**)
HRESULT GetItem([in, out] VARIANT* Server,
[in, out] VARIANT* Category,
[in, out] VARIANT* CType,
[out, retval] ("<"GetRefTypeInfo failed">"** );
The idl file was generated by OLE View (cut/paste) to test.idl and compiled with "C:>MIDL test.idl /h test.h"
Can anyone tell me why this is giving this error
Regards,
Dan
|
|
|
|
|
|
Hi Vivek, thanks for the reply! Ok, if this is because of failure, then I will set the value in the IDL myself. It should be an "ADO Recordset" it is returning...It compiled ok now...I added the below to the IDL:
importlib("C:\Program Files\Common Files\System\ADO\MSADO15.DLL");
HRESULT SearchTickets(
[in, out] VARIANT* rsGotSchema,
[in, out] VARIANT* Criteria,
[in, out] VARIANT* ServerName,
[out, retval] _Recordset **ptrRs );
Ok done and I get it compiled, but when ran it errors here (see below):
// param #1: a passed recordset (checked before OK...)
// param #2: Query for the new recordset
// param #3: Server name
// param #4: the recorset to be filled
_RecordsetPtr pRsTickets;
hr = pRsTickets.CreateInstance(__uuidof (Recordset));
if(SUCCEEDED(hr))
{
hr = IQUIZ->SearchTickets(
(VARIANT*)&pRsSchema,
COleVariant("Some query..."),
COleVariant("Server..."),
(_Recordset**) &pRsTickets);
// *****************************************************
// When here, both recordsets have been set to NULL????
// *****************************************************
}
Output from DOS...
BEFORE CreateInstance()...pRsTickets: 0
AFTER CreateInstance()...pRsTickets: 1
BEFORE SearchTickets()...pRsSchema: 1
SearchTickets Failed (hr): -2146827864
AFTER SearchTickets()...pRsTickets: 0
AFTER SearchTickets()...pRsSchema: 0
Release OK...
This is where it blows-up (C:\...VC98\include\COMIP.H):
// Returns the address of the interface pointer contained in this
// class. This is useful when using the COM/OLE interfaces to create
// this interface.
//
Interface** operator&() throw()
{
_Release();
m_pInterface = NULL;
return &m_pInterface;
}
Can you (or anyone) help????
Regards,
Dan
|
|
|
|
|
For some reason no matter what I do I keep getting an error compiling only on the 'found' routine. I can't figure out why. I have tried everything that I can think of to get around it. If anyone could give me a hand it would be great!
Thanks !!!
______________________________________________________________________________
#include <stdafx.h>
#include <stdio.h>
#include <iostream>
#include <iomanip>
#include <string>
using namespace std;
int i = 0;
static int grade_ctrA,
grade_ctrB,
grade_ctrC,
grade_ctrD,
grade_ctrF,
avg_grade,
student_ctr = 0;
class grades
{
char firstname[15];
char lastname[15];
long int ssn;
int marks;
char grade;
public:
void input(grades std[])
{
long int issn;
int ctr;
ctr = i;
cout << "Enter the Students First Name :";
cin >> std[ctr].firstname;
cout << endl;
cout << "Enter the Students Last Name :";
cin >> std[ctr].lastname;
cout << endl;
cout << "Enter the Students SSN :";
cin >> std[ctr].ssn;
std[ctr].grade = ' ';
issn = ssn;
found( grades std[ctr] ,issn );
cout << endl;
cout << "Enter the Students Mark :";
cin >> std[ctr].marks;
cout << endl;
}
void Grade(grades std[])
{
if ((std[i].marks >= 90) && (std[i].marks <= 100))
{
std[i].grade = 'A';
}
else if (std[i].marks >= 80)
{
std[i].grade = 'B';
}
else if (std[i].marks >= 70)
{
std[i].grade = 'C';
}
else if (std[i].marks >= 60)
{
std[i].grade = 'D';
}
else
std[i].grade = 'F';
}
void display()
{
cout << setw(15) << firstname << " " << setw(15) << lastname << " "
<< setw(15) << ssn << " " << setw(1) << marks << " "
<< setw(1) << grade << endl;
}
bool found(grades std[] ,long int ssn)
{
int index;
index = i;
int flag = 0;
cout << "SSN passed to Found routine is " << ssn;
do
{
if ((ssn == std[index].ssn) && (index != i))
{
cout << "Duplicate ssn entered, please re-enter";
cin >> std[i].ssn;
return true;
flag = 1;
}
else
{
return false;
flag = 0;
}
index++;
}
while((index <= 15) || (flag == 0));
cout << "Found output is " << flag << endl;
}
}; // End of Class Student
void main()
{
int j = 0;
grades std[4];
do
{
std[j].input(std);
std[j].Grade(std);
i++;
}
while(j <= 3);
for (int k=0; k<=3; k++)
std[k].display();
}
Paul_from_Connecticut
|
|
|
|
|
At first sight, found seems to be lacking a return true at the end.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|