|
Hi!
Does anyone know, how to determine (until preprocessor defines) the app use MFC or not, if included support MFC in static library ?
|
|
|
|
|
When using the DLL version of MFC, the symbol _AFXDLL is defined. When using the statically-linked version, it's not defined.
As for whether MFC is being used or not... it looks like you can check for __AFX_H__, which is defined when afx.h is #include'd.
--Mike--
http://home.inreach.com/mdunn/
"Make sure that if you are using a blow torch that you don't set anything on fire."
-- Chris Maunder
|
|
|
|
|
Hi,
I know how to import say a dialog box from another project,
project->add to project->files->the_resource_file.rc
But don't know how to import that dialog's class from the other project.
I want to be able to import a dialog box and it's class, so I wont have to recreate member variables and all the rest of them things. How can I go about that?
Thanks
|
|
|
|
|
Import the h and cpp files.
|
|
|
|
|
I did, that didn't work, might there be something wrong with my compiler?
Because even though I could see the dialog class in the class view, when I right clicked on the dialog box (in the resource editor) and chose class view, that gave me the options:
1)create a new file and
2)Choose an existing one
when I chose to associate it with and existing one, the class (of that same dialog box-imported)that was supposed to be there WASN'T, and I repeat, I could see it in the class view, and I could see the .cpp and .h files in the file view.
Now, what is going on? I really need help, I wouldn't like to waste a whole day remaking the old things.
Thanks a lot
P.S. I hope I make sense
|
|
|
|
|
Copy both the .CPP and .H files. And then use Project->Add to project-> files to add these files in to ur project.
I think, u have to import the resource.h file also.
|
|
|
|
|
Rejeesh,
I'll do that, but you can't copy the whole resource.h there can be only one at a project. But Christian gave me an exact advice of how to do it.
Thank you guys I hope that'd work.
|
|
|
|
|
Cut and paste will work. But there should not be same values in ur existing resource.h file.
One more thing. Better u open the new .rc file in any text editor and copy the required data from the old. Do the same with resource.h also (without ID conflict).
Happy coding.
Rejeesh
|
|
|
|
|
If you're only importing the rc file, you probably need to recreate the resource definitions from the old resource.h file, I would have thought. I always do this by physically copying the dialog definition from the old .rc file and pasting into the new, and then creating the new definitions directly in the resource.h file.
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.
|
|
|
|
|
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.
|
|
|
|