|
Is there any way how to close stdout
actualy i can use fclose(stdout) but how to reopen it?
Problem is about:
Program such oggenc.exe are reading data from stdin
i hope i can write them for it into stdout, but how
i will let him know i am done?
thank you
viliam
|
|
|
|
|
why on earth do you want to do such a thing ?
|
|
|
|
|
|
i still don't understand why he would want to close stdandard stream for this...
|
|
|
|
|
you right,
lame and oggenc are during stream encoding using stdin
and i dont know how to let them know that no more data is comming.
viliam
|
|
|
|
|
What are those programs expecting as a "termination" character?
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
i dont know, this programs doesn't say
it is maybe simple and obvious but i have no idea how to use it for stream
processing.
...and data are raw PCM data (wav audio) and there is probably no
chance to say "this character" means end.
viliam
|
|
|
|
|
am stuck with the uml diagrams for the n-queens problem and need assistance. need to identify entities and their relations
|
|
|
|
|
http://www.durangobill.com/N_Queens.html
|
|
|
|
|
i really don't understand how code finds correct VTable(not function)
I read here : http://www.parashift.com/c++-faq-lite/virtual-functions.html#faq-20.4
ıt says:"The idea is to change each Der object's v-pointer so it points at its class's v-table. (This is not a second v-pointer; it's the same v-pointer that was defined in the base class, Base; remember, the compiler does not repeat step #2 in class Der"
I confused here.
How many are vtables created?
amount of base+derived class.One VTABLE for each.But all of them has one VPTR.IS this right?
So if there is a VTABLE for each class but one VPTR; How can code find the correct function?
I know calling virtual func. means calling an offset.But this offset is in the class's VTABLE.But first it must find one more offset that indicate correct class?
Am i wrong?
For example i have one base class and one virtual funct. and three derived class in a dll.Here when i call to 3. derived class virtual function from base class pointer from my exe.Here first it must find 3. VTABLE and and first offset.Right?
But here we have only one VPTR so haw can it find 3. VTABLE and then offset of the function?
I am looking for your answers
Thanks.
|
|
|
|
|
sawerr wrote: How many are vtables created?
one vtbale for each class having virtual function.
sawerr wrote: But all of them has one VPTR.IS this right?
yes, but if derived class class is having virtual function, it uses vptr declared in base class, only thing its initialized to dervied class vtable .
sawerr wrote: So if there is a VTABLE for each class but one VPTR; How can code find the correct function?
I know calling virtual func. means calling an offset.But this offset is in the class's VTABLE.But first it must find one more offset that indicate correct class?
Am i wrong?
vptr discussed above is initialized with each class's vtable in constructor of each class. So, lets say you are creating object of dervied class, then base class's constructor will call first, initializing vptr to base class's vtable. But then derived class's constructor class will be called, reinitializing it to derived class's vtable . And function would be found by indexing. because, that function will have addresses of that class's functions.
sawerr wrote: For example i have one base class and one virtual funct. and three derived class in a dll.Here when i call to 3. derived class virtual function from base class pointer from my exe.Here first it must find 3. VTABLE and and first offset.Right?
But here we have only one VPTR so haw can it find 3. VTABLE and then offset of the function?
Not clear about question .
|
|
|
|
|
I tried to make the CPropertySheet derived class instance the main applacation window in the very start of MFC standard machinery - somehow like follows:
<small>...<br />
CMyPropertySheet PropSheet("Test Property Sheet",NULL);<br />
m_pMainWnd = &PropSheet;<br />
...</small>
but I did not succeed (even if the PropSheet is initialized correctly).
Of course, I can have silent, invisible window or dialog "behind" PropertySheet, but it seems to me rather idle.
Thanks for any advice and/or experiences...
|
|
|
|
|
Are you really doing it this way?
...
CMyPropertySheet PropSheet("Test Property Sheet",NULL);
m_pMainWnd = &PropSheet;
...
PropSheet needs to be a member of your app class.
It also needs to be created.
Mark
|
|
|
|
|
It's not necessary to mess with the app class. Use AppWizard to create a dialog-based application. Then edit the dialog's .h and .cpp files, changing CDialog to CPropertySheet . Add the pages in the sheet's constructor.
"Approved Workmen Are Not Ashamed" - 2 Timothy 2:15
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Hi there,
I've been stuck on this problem for over a day now and it's driving me crazy:
From the mainframe i create a new dialog (modeless):
void CMainFrame::OnMachineInit()
{
CInitmachinedialog *initmachinedialog;
initmachinedialog = new CInitmachinedialog;
initmachinedialog -> Create (IDD_MACHINEINITDIALOG, this);
initmachinedialog -> ShowWindow(SW_SHOW);
initmachinedialog -> init_pre_operations(2);
}
void CInitmachinedialog::init_pre_operations(int init_status)
{
[...]
running = TRUE;
THREADSTRUCT *_param = new THREADSTRUCT;
param->_this = this;
AfxBeginThread (init_thread,_param,THREAD_PRIORITY_ABOVE_NORMAL,0,0,NULL);
}
UINT CInitmachinedialog::init_thread (LPVOID param) // thread 1
{
THREADSTRUCT* ts = (THREADSTRUCT*)param;
while (running) ts->_this->initmachine(); // while (running = true) the thread is running
ts->_this->DestroyWindow();
return 0; // same as afxendthread(0)
}
The "destroywindow" command has no effect? It doesn't close the dialog or do anything?
Any idea why????
|
|
|
|
|
arrayjet_c++ wrote: Any idea why?
Proably because MFC uses thread local storage so the _this pointer is not available in the worker thread. There are really old KB Articles about this problem. You might look into using PostThreadMessage() to send a message to the dialog and then it would handle the message and call DestroyWindow() in the proper thread.
led mike
|
|
|
|
|
Hi,
Have you actually checked if DestroyWindow function has ever been reached?
Is running variable a member of CInitmachinedialog class, and if so, is it static?
Are you sure that ts->_this->DestroyWindow(); is working at all? eg. isn't overriden.
Try putting ts->_this->DestroyWindow(); inside init_pre_operations function to test it outside of a thread.
Regards
|
|
|
|
|
Yes the destroywindow function is definitely being reached.
Running is declared as static volatile and is used to monitor the working thread,
this is how THREADSTRUCT is definied in my header file:
typedef struct THREADSTRUCT
{
CInitmachinedialog* _this;
}THREADSTRUCT;
Any ideas?
|
|
|
|
|
Hi again,
Try to replace ts->_this->DestroyWindow(); with
ts->_this->SendMessage(WM_CLOSE);
It definitely works.
Regards
|
|
|
|
|
No i'm afraid it doesn't
ts->_this->SendMessage(WM_CLOSE) has no effect - same as ts->_this->DestroyWindow() really.
|
|
|
|
|
Ensure that the dialog style contains WS_SYSMENU flag.
Also, make sure that virtual DestroyWindow function is not overriden in your class with not functional code.
Regards
|
|
|
|
|
My program is SDI application. In order to support multi-language interface,all text of menus , tooltips of tool buttons and text displayed in dialogs are wrote in a text file.when mouse move over the tool buttons and the menus ,the tooltips will display on the status button.
I want change tooltip text on the statusbar when mouse move over diffrent tool buttons in the toolbar ,or move over diffrent menus ,and the tooltip text is from the text file .the tooltip text is not from string table in Resouce .
how can i do in my application?
Could you help me ?
Any help will definitely be appreciated.
|
|
|
|
|
In MFC, see the CToolTipCtrl class.
In CWnd, check out these functions: EnableToolTips, CancelToolTips, FilterToolTipMessage, and
OnToolHitTest.
Mark
|
|
|
|
|
hello,
i write a service and it can run well,but i have found a problem,that is if the service is running i can uninstall it successfully(stop it ,delete the record in the service list and registry),but if the service is already stoppped,then i can not delete the service(the record is still in the service list and the registry),and the service labeld disabled and the service can not be installed again after reboot the machine,what is the matter?what can i do to solve this problem?
|
|
|
|
|