|
Hi,
I can't manage to do the importing so far.
When I import a class into the project, why doesn't it let me associate a dialog box with it. It's not in the list of existing ones (in the class wizard), even though it's in the class view. I know someone will get pissed because I'm repeating myself, but I just can't seem to figure it out.
I tried to edit resource.h, but ... well, couldn't do it
Thanks
|
|
|
|
|
Remove the old .clw file from u project directory. Then activate the class wizard. Just press ok in the dialog shown. UR imported classes will be available in the class wizard.
|
|
|
|
|
I'm starting a console window application from a dialog based application, using CreateProcess, because I need to hide the DOS window. Do you guys have any idea how can I capture the output of the DOS window to display it in my dialog?
I tried to pipe the DOS application to a file, and then read from the file, but there's one problem: the DOS application writes to the file when it finishes. I need to get info from it while it is still working.
To give you a better understanding of what I'm trying to do, here's an example: I start an external compiler, and I want to display in my dialog the data that the compiler shows in its DOS window.
Thanks!
|
|
|
|
|
I have a simple class for doing this which I will send to you. Just email me at gullettm@yahoo.com and I will respond with the class and a demo project.
The class is not 100% perfect but works very well for my needs which sound exactly like yours.
Thanks,
Matt Gullett
|
|
|
|
|
This sounds like a great subject for a CP article...
--------------
"Aagh!! I'm a victim of a Random Act of Management!"
|
|
|
|
|
Hello, the toolbars used by Visual C++ and most other Microsoft products are Command Bars ( not the Rebars that MFC provides ) so I was wondering if there was a free control for that. And if not, why don't all of use create a new command bar control? Anyone interested?
QuickSilver
|
|
|
|
|
How do I that without that the button will hide the static ?
|
|
|
|
|
Put the text on the button, or use a BitmapButton to put a bitmap on it.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
I need Help Urgent !!!
What is the problem in this code:
in run time when use in read func the program gets error and shut down. Who can help ????
_________________________________________________
//Header file:
-------------------------
typedef struct dPerson{
CString str;
BYTE status;
CString id;
DWORD ID;
BYTE f2[400];
BYTE f1[400];
BYTE t[12];
}dPerson;
-----------------------------------------
class CPerson : public CCmdTarget
{
DECLARE_DYNCREATE(CPerson)
CPerson();
public:
virtual ~CPerson();
public:
dPerson per;
CPerson* pNext;
CPerson* pBack;
DECLARE_MESSAGE_MAP()
};
-------------------------------------------------------------
________________________________________________________________
//cpp file:
-----------------
void CDemo::OnButtonAdd()
{
UpdateData(true);
person.per.id = m_editId;
//person = member variable of CDemo from type CPerson
...
...
...
CFile file;
// CFileException ex;
if(file.Open(strPath, file.modeWrite|file.modeNoTruncate|file.modeCreate ))
{
file.SeekToEnd();
file.Write( &(person.per) , sizeof(dPerson));
MessageBox("************ S A V E D ************** ");
}
}
/************************************************************/
void CDemo::read_persons(CFile* persons)
{
CPerson* q = new CPerson;
DWORD dwRead = sizeof(dPerson);
if((*persons).Read(&q->per, sizeof(dPerson)))
{
q->pNext = q->pBack = NULL;
p_head = p_tail = q; //p_head and p_tail are member variables of CDemo - type CPerson*
}
else
{
MessageBox("Have not register of users ! ");
return;
delete q;
}
DWORD size = dwRead;
while (size == dwRead)
{
q = new CPerson;
if( (size = (*persons).Read( &q->per, sizeof(dwRead))) == sizeof(dwRead) )
{
q->pNext = NULL;
q->pBack = p_tail;
p_tail->pNext = q;
p_tail = q;
}
else
delete q;
}
}
/************************************************************/
|
|
|
|
|
|
It would probably help if you described what the error was, and what line it occured in. I for one am not drawn to messages that are ALL IN CAPS, nor do I have time to create a project to try and figure out what error you are getting and where it is, so I can try to help you.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
When I read from the file I gets incorrect vulues in the members of the object CPerson and this is performed a lot of problems !
|
|
|
|
|
I have a CString that is holding a date. I want this date to be the max date in the microsoft datepicker.
the function is -
void SetMaxDate(DATE newtime);
My question is how do you fill DATE?
I can not find any documentation for DATE.
|
|
|
|
|
You can use a COleDateTime (which is the MFC wrapper for the DATE type). You can set the date and time in the COleDateTime object using ParseDateTime(). ParseDateTime will take in strings in any of the standard Windows Date Time formats. Then you can just pass your object into the SetMaxDate function, which will cast the object to a DATE. For example:
COleDateTime vtMaxDate;
CString vcstrMaxDate = _T("01-01-2001");
vtMaxDate.ParseDateTime(vcstrMaxDate);
SetMaxDate(vtMaxDate);
Hope this helps.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
|
Hello,
I'm trying to write an OLE DB Wrapper class and have created a function called SetStringFieldValue and inside that function I need to set 1 columns data to the string passed to the function. I have yet to find any examples of SetData anywhere and for some reason its not working for me. Any help is greatly appreciated.
void COleDBWrapper::SetStringFieldValue(int nIndex, LPCTSTR lpszValue)
{
CString strValue(lpszValue);
IRowsetChange* pIRowsetChange = (IRowsetChange*)m_pUnkRowsetChange;
IRowsetUpdate* pIRowsetUpdate = (IRowsetUpdate*)m_pUnkRowsetUpdate;
IAccessor* pIAccessor = NULL;
HACCESSOR hAccessor;
ULONG cBindings = 1;
DBBINDING rgBinding[1];
memset(rgBinding, 0, sizeof(DBBINDING));
char szValue[50];
_tcscpy(szValue, strValue.GetBuffer(0));
rgBinding[0].iOrdinal = nIndex;
rgBinding[0].dwPart = DBPART_VALUE|DBPART_STATUS|DBPART_LENGTH;
rgBinding[0].obLength = (strValue.GetLength() + 1) * sizeof(TCHAR);
rgBinding[0].obStatus = (strValue.GetLength() + 1) * sizeof(TCHAR);
(CString)rgBinding[0].obValue = szValue; // -- DOESN'T DO JACK! -- //
rgBinding[0].wType = DBTYPE_STR;
rgBinding[0].pTypeInfo = NULL;
rgBinding[0].pObject = NULL;
rgBinding[0].pBindExt = NULL;
rgBinding[0].dwMemOwner = DBMEMOWNER_CLIENTOWNED;
rgBinding[0].cbMaxLen = (strValue.GetLength() + 1) * sizeof(TCHAR);
rgBinding[0].dwFlags = 0;
HRESULT hr = m_pUnkRowset->QueryInterface(IID_IAccessor, (void**)&pIAccessor);
if (FAILED(hr))
return;
hr = pIAccessor->CreateAccessor(DBACCESSOR_ROWDATA, 1, rgBinding, 0,
&hAccessor, NULL);
if (FAILED(hr))
return;
hr = pIRowsetChange->SetData(m_hRow, hAccessor, szValue);
// hr is ALWAYS DB_E_ERRORSOCCURRED
}
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
I'm trying to write an OLE DB Wrapper class
It sounds like reinventing the wheel - can't you use ATL OLEDB consumer templates?
hr is ALWAYS DB_E_ERRORSOCCURRED
IErrorRecords should give you more detailed information. See DBViewer sample for details. You may also check the status variables associated with fields.
Tomasz Sowinski -- http://www.shooltz.com
|
|
|
|
|
IErrorRecords::GetDescription and GetSource both give me "M" so they were no help. Also, I am writing my own wrapper class because the templates are ok but they are still too primative. Thank you for your response.
Bret Faller
Odyssey Computing, Inc.
|
|
|
|
|
Hopefully the question is pretty descriptive.
Paradise is where I am.
Voltaire
|
|
|
|
|
|
Hi All,
my program has one dialog box. On the dialog box I have put
some buttons, 2 edit box components, some comboboxes and some labels,
I was wondering what can I do to move the components around on the sheet
when I want to resize the dialog box. I want to keep the components
at the same distance of the nearest dialog border, and I want to resize the CEdit boxes.
Any idea how to do that in run time?
Thanks!
John
|
|
|
|
|
Writing, writing and writing.
Use SetWindowPlacement.
You need to relocate the buttons each time that you recize the Dialog.
Make this in the OnSize Message
Good Luck!!!!
Carlos Antollini.
|
|
|
|
|
That function is only for window resizing.
How can I resize the components on the window?
It must be possible something like this
void CTestDlg::OnSize(UINT nType, int cx, int cy)
{
CButton *pCloseButton;
pCloseButton = (CButton*) GetDlgItem(IDCLOSE);
pCloseButton->Move(10,10);
}
Is there something like a move methode???
Thanks,
John
|
|
|
|
|
Like the original post said, you need to call it for child windows as well. A link has been provided to a class here that allows you to set rules by which child windows are automatically sized. I've not tried it myself, but it's the only other option to a list of MoveWindow or SetWindowPos calls in your OnSize code.
Christian
#include "std_disclaimer.h"
The careful application of terror is also a form of communication.
Eagles may soar, but weasels don't get sucked into jet engines.
|
|
|
|
|
From codeproject->Dialogs:
http://www.codeproject.com/dialog/resizabledialog.asp
http://www.codeproject.com/dialog/dynwindow.asp
|
|
|
|