|
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
|
|
|
|
|
Thanks for the sugesstion Joaquin but that doesn't seem to work either. I may finally give up just trying to do it a normal way and overload a function call.
Paul
Paul_from_Connecticut
|
|
|
|
|
Can i just seek to position <filesize-128> and write a null char?
|
|
|
|
|
In WIN32, the API is SetEndOfFile
Tim Smith
I know what you're thinking punk, you're thinking did he spell check this document? Well, to tell you the truth I kinda forgot myself in all this excitement. But being this here's CodeProject, the most powerful forums in the world and would blow your head clean off, you've got to ask yourself one question, Do I feel lucky? Well do ya punk?
|
|
|
|
|
redeemer wrote:
Can i just seek to position and write a null char?
NUL characters do not terminate a file. You would have to either truncate the file at (length - 128 ), or fill the last 128 bytes with some characters.
Peace!
-=- James.
"Fat people are hard to kidnap."
(Try Check Favorites Sometime!)
|
|
|
|
|
Your Best bit is to use GetFileSize() to get the file size and assign it to a DWORD then subtract 128 from this DWORD then pass the DWORD to SetEndOfFile().
Peter
|
|
|
|
|
Is that not what I said:
You would have to either truncate the file at (length - 128 )[...]
Peace!
-=- James.
"Fat people are hard to kidnap."
(Try Check Favorites Sometime!)
|
|
|
|
|
I have a more identical propert page and it is necessary for me to change caption for each of them!
How it to make?
Best regards,
Eugene Pustovoyt
|
|
|
|
|
Hi Eugene,
You might glean the information you need from the following article: Hacking the CPropertySheet. Try scrolling down to "Changing the Tab Label". Hope this helps.
- Jason
(SonorkID 100.611)
"I just recieved an email from myself but I didn't send it ?"
- Colin Davies, Sonork conference
|
|
|
|
|
I tried, but a method
TC_ITEM item;
item.mask = TCIF_TEXT;
item.pszText = "New Label";
pSheet.GetTabControl()->SetItem (0, &item);
causes a mistake of the program
Eugene Pustovoyt
|
|
|
|
|
What you're showing is what I have in the MFC book I wrote and certainly works in all my code. Try this simply because it has a couple of ASSERTs and VERIFYs that might tell you where the problem occurring.
(By the way, this code needs to be in your CPropertySheet class)
CTabCtrl* pTab = GetTabControl();
ASSERT(pTab);
TC_ITEM ti;
char szText[100];
ti.mask = TCIF_TEXT;
ti.pszText = szText;
ti.cchTextMax = 100;
VERIFY(pTab->SetItem(0, &ti));
Cheers,
Tom Archer
Author - Inside C#, Visual C++.NET Bible
|
|
|
|
|
Thank you Tom and thank you Jason
for Your the help, I have made it
Best regards,
Eugene Pustovoyt
|
|
|
|
|
hi all. i'm trying to sort my tree item, which are file names by type, by date, by size or by name. so i called csortchildrencb to sort them. but first of all i want all the folder name at the begining of the tree and the all the files name to be below. so i wrote my callback function like below. but i dont really know how csortchildrencb sort the tree items. and i could not able to get all the folder on the top and the files below. right now folder and file are still mixing. what should be change in callback function??
i'm not sure lParam2 is comparing to lParam1 or lParam1 is comparing to lParam2?
<br />
<br />
CTreeCtrl *myTreeCtrl;<br />
static int CALLBACK MyCompareProc1(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)<br />
{<br />
<br />
CTreeCtrl *pmyTreeCtrl = (CTreeCtrl*) lParamSort;<br />
FileInfo *file1 = (FileInfo*)lParam1; <br />
FileInfo *file2 = (FileInfo*)lParam2;<br />
int compare;<br />
<br />
if(file2->status == FOLDER && file1->status == FILE)<br />
{<br />
compare = 1; <br />
}<br />
else if(file2->status == FOLDER && file1->status == FOLDER)<br />
{<br />
compare = file2->name.Compare(file1->name);<br />
}<br />
else if(file1->status == FILE && file2->status == FILE )<br />
{ <br />
compare = file2->type.Compare(file1->type);<br />
}<br />
<br />
return compare;<br />
<br />
}<br />
<br />
<br />
void CSMPprojectDlg::SortTreeItem()<br />
{ <br />
myTreeCtrl = &m_TreeCtrl;<br />
TVSORTCB tvs; <br />
tvs.hParent = m_TreeCtrl.GetRootItem();<br />
tvs.lpfnCompare = MyCompareProc1; <br />
tvs.lParam = (LPARAM)myTreeCtrl; <br />
m_TreeCtrl.SortChildrenCB(&tvs); <br />
<br />
}<br />
<br />
void CSMPprojectDlg::SortingAtree()<br />
{<br />
SortTreeItem(); <br />
}<br />
<br />
class FileInfo<br />
{<br />
public : <br />
int status;<br />
CString name;<br />
CString size;<br />
CString createdTime;<br />
CString lastWrite;<br />
CString lastAccess;<br />
CString type;<br />
};<br />
<br />
thanks..
|
|
|
|
|
You are not handling the case file1->status == FOLDER && file2->status == FILE .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|