|
Поцелуй свой поток в зад!!!
|
|
|
|
|
Use a Pipe to redirect the output to your window;
See CreatePipe, STARTUPINFO and CreateProcess.
Arjan.
|
|
|
|
|
Thank you for the reply. It led me to find an article named "Creating a child process with redirected input and output", which is exactly what I wanna do
|
|
|
|
|
Hi,
I'm studying C++, VC++, COM. I would like to know real world examples of various assignments programmers have worked on. For example, what the application did what role did they play. The examples would be using these kinds of technologies. If any programmers could provide some insight into their "real world VC++, MFC, COM experiences it would be very helpful. Any one who has worked on large scale apps, developing controls, database interfaces, or anything else they have done using these technologines, who can lend some insight into how they real world of programming is.
|
|
|
|
|
My first "real" job was in a manufacturing environment, (before C++ and MFC was even a smile on someone's face), where numerically controlled machine tools produced parts for larger assemblies. Since each machine had a special set of codes that caused it to perform specific actions, there was a compiler that would translate the commands to create a part into the machine codes to control the machine.
My job as a programmer was to "update" the compiler and make it work on the new computing platform that was being installed as part of the shop floor overhaul. The legacy code was written in FORTRAN IV, and we were also updating it to F77 on the new computer, in addition to cleaning up as much of the "bad" software as we could. Ever done string processing in FORTRAN? Ouch!!
Since the new computer was much newer than the computer that ran the legacy code, there were some new options available for producing graphics, so I also developed a graphical display of the paths that the machines would follow given the codes that were produced from the compiler for the parts that were being made. Reviewing the graphics output saved the time and trouble of setting the machines up to create a test piece, to see if the part program was really correct.
That was only my first job, and it lasted several years. Much of the experience, though, wasn't so much about programming as it was about manufacturing. The compiler and graphics software never stood on its own, but was an integral part of the manufacturing process. That process had to be understood to make the software fit in.
Very good question, too, and I hope you get some good stories and insights.
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
I want to use CRecentFileList as a convenient way of storing some data for my program. As a test, I wrote a console app that creates a CRecentFileList object. I add some strings to it using the Add() method and then use the [] operator to read the strings. Everything works OK until I try to save the data to the registry using the WriteList() method. I get an access violation.
Is there something I'm doing wrong? Must I write my own class to do it? Using CRecentFileList is easier and quicker but I do not think I am really using it as it was intended. It is a shame it isn't a specialization of a class that I could use for my intended purpose.
|
|
|
|
|
The WriteList() method requires a CWinApp object, as you can see from the code:
void CRecentFileList::WriteList()
{
ASSERT(m_arrNames != NULL);
ASSERT(!m_strSectionName.IsEmpty());
ASSERT(!m_strEntryFormat.IsEmpty());
LPTSTR pszEntry = new TCHAR[m_strEntryFormat.GetLength()+5];
CWinApp* pApp = AfxGetApp();
pApp->WriteProfileString(m_strSectionName, NULL, NULL);
for (int iMRU = 0; iMRU < m_nSize; iMRU++)
{
wsprintf(pszEntry, m_strEntryFormat, iMRU + 1);
if (!m_arrNames[iMRU].IsEmpty())
{
pApp->WriteProfileString(m_strSectionName, pszEntry,
m_arrNames[iMRU]);
}
}
delete[] pszEntry;
}
The good news is that WriteList() is virtual, so you could probably just rewrite this one method to make it work.
HPS HwndSpy - GUI developer's aid to visually
locate and inspect windows. For the month of August
only, use coupon code CP-81239 for 30% off.
|
|
|
|
|
Hello all
I'm trying to enable context sensitive help for cproperty sheet. I created a Dialog project by select "Use context sensitive help" from appwizard. I added a button to the Dialog and written the following handler.
MyDialog::OnClick()
{
MyPropertySheet sheet("SampleSheet");
sheet.AddPage(new MyPropertyPage());
sheet.DoModal();
}
when click event is occured it shows up propertypage and if I click "Help" button or f1 key I'm getting "Help topic does not exist, contact application vendor".
I edited the afxDlg.rtf and added the following
#HIDD_MYSHEET This is mysheet help
<page-break>
HIDD_MYHEET id defined in .hm file.
I also added an entry in .hpj file under map section like
#define HIDD_MYSHEET <value defined="" in="" .hm="" file="">
I'm not able to figure out where I'm doing wrong. if any one knows how to do enable help for the propertysheet please help me.
Many thanks for your help.
Hari.
|
|
|
|
|
Try calling ModifyStyleEx(0, WS_EX_CONTEXTHELP) in your CPropertySheet's OnInitDialog.
HPS HwndSpy - GUI developer's aid to visually
locate and inspect windows. For the month of August
only, use coupon code CP-81239 for 30% off.
|
|
|
|
|
Hello HPSI
thanks for the reply. I tried it but I'm getting the same error . Any idea how to solve.
Thanks
Hari.
|
|
|
|
|
Hi
I've copied a .exe file of around 4MB to another computer to test the program out there.
That computer is on WinNT4, P4 2.4Ghz, 256 MB RAM (SP6)
I tried to open the .exe file, works great on Win2k, XP and alsoo on NT4 SP1. (The NT4 computer is a virtual one, vmware usage .. just for testing purposes)
Now, i get an error :'Program too big to fit in memory' when i try to open the file.
What is the problem and how can i solve it?
Greetings
Jens
|
|
|
|
|
Hi The tool tips for my tree control remain on my dlg and any other window behind my dlg untill i minimize my dlg or select another window how can i fix this
also i have a group box that creates the sunken look for my custom tree control how do i stop it from showing through my tree control without losihng that sunken look
thanks
|
|
|
|
|
Hi,
try to change tree control style.
|
|
|
|
|
Marissa182 wrote:
i have a group box that creates the sunken look for my custom tree control how do i stop it from showing through my tree control without losihng that sunken look
Hide the groupbox (ShowWindow(SW_HIDE)) and use CreateEx:
GetDlgItem(IDC_ZONETREE_FRAME)->ShowWindow(SW_HIDE);
CRect frameRect;
GetDlgItem(IDC_ZONETREE_FRAME)->GetWindowRect(frameRect);
ScreenToClient(&frameRect);
DWORD dwStyle = WS_CHILD|WS_VISIBLE|TVS_HASLINES|TVS_LINESATROOT|TVS_SHOWSELALWAYS|TVS_HASBUTTONS;
zone_tree.CreateEx(WS_EX_CLIENTEDGE, "SysTreeView32", "mytree", dwStyle,
frameRect, this, IDC_ZONETREE);
HPS HwndSpy - GUI developer's aid to visually
locate and inspect windows. For the month of August
only, use coupon code CP-81239 for 30% off.
|
|
|
|
|
Now I meet several problems
1.virtual void operator()(const char* string)=0; // call using operator
2.template <class TClass> class TSpecificFunctor : public TFunctor
//TFunctor is a class
3.TSpecificFunctor<TClassA> specFuncA(&objA, TClassA::Display);
4.TFunctor** vTable = new TFunctor*[2];
5.delete[] vTable;
6.(*vTable[1]) ("TClassB::Display called!"); // via operator "()"
//Why is Table[1]" put into the bracket?
Can you tell me their meaning?
Thank you in advance!
The following codes you can refer:
// This code was compiled and tested with Borland C++ Builder 5.0. Let me know
// if there is something I should mention for the use with other compilers.
#pragma hdrstop // Borland C++ Builder specific
#pragma argsused // do.
#include <iostream.h> // due to: cout
// abstract base class
class TFunctor
{
public:
// two possible functions to call member function. virtual cause derived
// classes will use a pointer to an object and a pointer to a member function
// to make the function call
virtual void operator()(const char* string)=0; // call using operator
virtual void Call(const char* string)=0; // call using function
};
// derived template class
template <class TClass> class TSpecificFunctor : public TFunctor
{
private:
void (TClass::*fpt)(const char*); // pointer to member function
TClass* pt2Object; // pointer to object
public:
// constructor - takes pointer to an object and pointer to a member and stores
// them in two private variables
TSpecificFunctor(TClass* _pt2Object, void(TClass::*_fpt)(const char*))
{ pt2Object = _pt2Object; fpt=_fpt; };
// override operator "()"
virtual void operator()(const char* string)
{ (*pt2Object.*fpt)(string);}; // execute member function
// override function "Call"
virtual void Call(const char* string)
{ (*pt2Object.*fpt)(string);}; // execute member function
};
//-----------------------------------------------------------------------------------------
// 4.3 Example of How to Use Functors
// dummy class A
class TClassA{
public:
TClassA(){};
void Display(const char* text) { cout << text << endl; };
/* more of TClassA */
};
// dummy class B
class TClassB{
public:
TClassB(){};
void Display(const char* text) { cout << text << endl; };
/* more of TClassB */
};
// main program
int main(int argc, char* argv[])
{
// 1. instantiate objects of TClassA and TClassB
TClassA objA;
TClassB objB;
// 2. instantiate TSpecificFunctor objects ...
// a ) functor which encapsulates pointer to object and to member of TClassA
TSpecificFunctor<TClassA> specFuncA(&objA, TClassA::Display);
// b) functor which encapsulates pointer to object and to member of TClassB
TSpecificFunctor<TClassB> specFuncB(&objB, &TClassB::Display);
// 3. create array with pointers to TFunctor, the base class and ...
TFunctor** vTable = new TFunctor*[2];
// ... assign functor addresses to the function pointer array
vTable[0] = &specFuncA;
vTable[1] = &specFuncB;
// 4. use array to call member functions without the need of an object
vTable[0]->Call("TClassA::Display called!"); // via function "Call"
(*vTable[1]) ("TClassB::Display called!"); // via operator "()"
// 5. release
delete[] vTable;
// hit enter to terminate
cout << endl << "Hit Enter to terminate!" << endl;
cin.get();
return 0;
}
|
|
|
|
|
Aleon666 wrote:
virtual void operator()(const char* string)=0;
This is a pure-virtual function. It has no definition, and must be implemented in a derived class.
Aleon666 wrote:
template <class TClass> class TSpecificFunctor : public TFunctor
This is a template class defintion. It allows a class to be customised using varying parameter - it's a template for producing more specialised classes.
Aleon666 wrote:
TSpecificFunctor<tclassa> specFuncA(&objA, TClassA::Display);
This creates an instance of the TSpecificFunctor class that has been specialised with the parameter "TClassA "
Aleon666 wrote:
TFunctor** vTable = new TFunctor*[2];
This creates an array of 2 pointers to TFunctor objects.
Aleon666 wrote:
delete[] vTable;
This deletes the array of pointers to TFunctor objects created above.
Aleon666 wrote:
(*vTable[1])("TClassB::Display called!");
"*vTable[1] " is put in brackets so that the "*" would apply to the vTable[1] part. It needs to be there because vTable[1] is a pointer to a TFunctor , but the object itself is needed - it must be dereferenced first. If the brackets were not there, the code would not compile because it will try to call
vTable[1]("TClassB::Display called!"); which is non-valid code because vTable[1] is a pointer.
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Thank you very much!
I have been illuminated by you.
Thanks again
Today is valentine's day for our chinese people
Will you send some presents to your lover if he/she is in China
|
|
|
|
|
You're welcome
Aleon666 wrote:
Today is valentine's day for our chinese people
Will you send some presents to your lover if he/she is in China
Nope, she's in Australia
Ryan "Punctuality is only a virtue for those who aren't smart enough to think of good excuses for being late" John Nichol "Point Of Impact"
|
|
|
|
|
Hello all,
I just built a small program to log SMB connects. Using NetFileEnum I can pretty much log which user opens which directories and which files. But now I want to link this information to the host PC of the user. I can get all the users with their PCs using NetSessionEnum, but I can't link both.
Situation;
I have a public account on a big network, called LAN. Now with the thing I built I can see which files and dirs are opened by user LAN, yet I can't see from which PC it comes. And user LAN can be logged in from loads of PCs at the same time. I can use NetSessionEnum to get the PCs, but then I can't link it to the files they opened.
Does anyone have any idea how I can get this information full?
Thanks,
- Fahr
|
|
|
|
|
have class?where?
thanks!
|
|
|
|
|
http://www.fmod.org
Free for non-commercial use...
Kochise
In Cod we trust !
|
|
|
|
|
|
Hi, I would like to disable displaying "..." suffix when text in ListView column header is longer that header's current width. For example Total Commander does it. Is there any way?
Thanks in advance.
|
|
|
|
|
You can't, it's hard-coded, it all depends on the wish of the coder who added to "..." or not...
Kochise
PS : Total Commander is great, I use it anywhere, home, office, ...
In Cod we trust !
|
|
|
|
|
I want a modal dialog box to perform some automatic tasks after it is shown on the screen. In that tasks there can also appear a messagebox, so if I use the Windows Message OnSetFocus(), the messagebox will keep coming up, because every time the user clicks OK on the message box, the dialog gets his focus. Is there a way to achieve this?
Thnxx
|
|
|
|