|
In the "for" statement, one of the conditions was testing for equality when it should have been testing for "NOT EQUAL".
As soon as the correction was made, everything returned to normal.
Perhaps there isn't, but it sure would have been valuable to know if there was a way to force "cout" to print its buffer.
William
Fortes in fide et opere!
|
|
|
|
|
I do not know whether I understand your problem, but - if I correctly understand - you can use cout << flush to force everything to be displayed on your screen (or the standard output). This piece of code may be needed when using different libraries, e.g. using both cout and getch() . For example:
cout << "Press any key to continue...";
getch();
will give no output and will wait for a key to be pressed. Meanwhile,
cout << "Press any key to continue..." << flush;
getch();
will give the desired output. Notice that endl and cin also call flush, so you don't usually need to call it explicitly.
Hope this helps.
<marquee>Hosam Aly Mahmoud
|
|
|
|
|
redirect cout to another stream that you control...
Jonathan de Halleux.
|
|
|
|
|
In my main rich edit view, I want to add a gutter to display line numbers. I am doing an MDI MFC app and have NOT found any way to do this. If anyone knows of any solutions to draw line numbers or add gutters to rich edit view/control, please reply! Thanks!
|
|
|
|
|
Hi Gurus,
i woul like help here! is there a way i can call an SDI from another SDI just like i can call a Dialog from an SDI, if any one has an answer, then am quite gratefull for your Advise.
GBU.
Sharing is a gift of nature.
|
|
|
|
|
Hi,
I am using the code provided by Chris and it works like a champ, but I would like to know how I can minimize the dialog to systray whenever someone presses the close ("X") button?
Thanks in advance!
Regards,
Varun Shoor
|
|
|
|
|
So you already have the code to minimize to systray?
Override OnSysCommand or WM_SYSCOMMAND and handle SC_CLOSE, put your systray-code there
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
you get a message, that your dlg is closing.
WM_CLOSE or WM_QUIT
you can catch the message, and make your dialog go to systray
|
|
|
|
|
This is not the correct way to catch the [x]-button click
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
yes, that is why I am asking.. what is the best way to catch it and supress it?
eSupport - Support software with both email & web interface
LiveResponse - The Ultimate LiveResponse software
http://www.kayako.com
|
|
|
|
|
How about taking a look at my first posting?
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi guys I' a new progammer in (Visual)C++. I would like to know how to encrypt and decrypt user defined classes(containing CString, CTime, long, int variables)using the CRYPTO API.
|
|
|
|
|
|
Anyone knows an article that describes how to do that without mfc? I didnt found one. Greets, gri
|
|
|
|
|
I use directshow to capture 1394 video, I record inside an avi file. Then I want extract a single bitmap frame from this avi file.
For that purpose I use vfw.h in the same sotf.
But i am never able to catch AVIStreamOpenFromFile, even if i stop the directshow's graph.
I really do not understand why!!!
I guess it is because of a video stream already opened by directshow and I mustn't close it properly.
PLease help !!!!
PIer
ps : (I am using wXP)
Mr PIER
|
|
|
|
|
Hi!
There are two classes in my ATL dll. One called Apple, another called Banana.
Banana has a method to create and return an Apple.
In IDL it will be like
GetApple([out, retval] IApple** ret)
But i don't know how to write this method in the cpp of bananna.
I wrote:
{
CApple* p = new CApple();
*ret = p;
}
But the comiler said CApple is an abstract class and can't be created.
Do you have any experience in this thing?
|
|
|
|
|
|
In fact, in my test project, Apple can be a class without any method or property.
I just don't know how to create a simple object with COM interface in another object's method inside COM DLL.
the idl of apple is
interface IApple : IDispatch{
};
and idl of banana is
interface IBanana : IDispatch{
[id(1), helpstring("GetApple")] HRESULT GetApple([out,retval] IApple** apple);
};
And i try to implement the GetApple as
#include "stdafx.h"
#include "Banana.h"
#include "Apple.h"
// CBanana
STDMETHODIMP CBanana::GetApple(IApple** apple)
{
*apple = new CApple();
return S_OK;
}
VC7 said the CApple is abstract class, so can't be created.
Any idea?
|
|
|
|
|
Ah, I see now. See Q181265[^]
Basically, your CApple doesn't implement any of the IUnknown methods, that's why you can't create instances of it. You instead create instances of CComObject , which does implement IUnknown .
--Mike--
Ericahist | Homepage | RightClick-Encrypt | 1ClickPicGrabber
Latest art~!@#2rDFA#@(#*%$Rfa39f3fqwf--=
NO CARRIER
|
|
|
|
|
Thanks! I wanna ask for a little more.
In Apple i try to hide a struct. It is not on the interface to the client. But the other class in the COM know it is there, and can access it.
in apple.h
struct Image
{
int num;
};
// CApple
class ATL_NO_VTABLE CApple :
public CComObjectRootEx<ccomsinglethreadmodel>,
public CComCoClass<capple, &clsid_apple="">,
public IDispatchImpl<iapple, &iid_iapple,="" &libid_fruitlib,="" *wmajor="*/" 1,="" *wminor="*/" 0="">
{
public:
Image img;
CApple()
{
}
The banana add a method
interface IBanana : IDispatch{
[id(1), helpstring("GetApple")] HRESULT GetApple([out,retval] IApple** apple);
[id(2), helpstring("QueryApple")] HRESULT QueryApple([in] IApple* apple, [out,retval] int * ret);
};
And in banana.cpp i try
STDMETHODIMP CBanana::GetApple(IApple** apple)
{
CApple* p = new CComObject<capple>();
p->img.num = 100;
*apple = p;
return S_OK;
}
STDMETHODIMP CBanana::QueryApple(IApple* apple, int* ret)
{
CApple* p = dynamic_cast<capple*>(apple);
*ret = p->img.num;
return S_OK;
}
But when i use this dll in c#, it always get a System.ExecutionEngineException.
the script is
FruitLib.Banana banana = new FruitLib.BananaClass();
FruitLib.Apple apple = banana.GetApple();
int n = banana.QueryApple(apple);
Any idea then?
Thanks!
|
|
|
|
|
I've created a CRichEditCtrl dynamically ( run time ) in both Dialog based application and in Document based application.
In Dialog based application we could copy pase the text using Ctrl+C and Ctrl +V ..... it was success.... but in Document based ( SDI ) application its not possilbe copy paste the text.... anybody have any idea ? its urgent...!!
__________________
mrithulaghadaka saankethika vidhagdhan...!!
|
|
|
|
|
Hello, Sir:
Now i have a problem. I am doing a project, and i used a temporary file in many objects. Because my project declare many object, and the objects uesed the temporay file .I want to delete in WM_CLOSE, but i am not sucessful. Can you help me? Thanks a lot.
|
|
|
|
|
to continue:
I debug result is "The file was using in other process. I want to delete file after the program is end.
And i do that in OnClose()
CMyAppDlg::OnClose()
{
......;
::TerminateProcess(GetCurrentProcess(), 0);
DeleteFile(mytemporayfile);
}
Is it right?
Wish to get your replay! Thans a lot.
|
|
|
|
|
Are you joking or what?:
So, you do:
....
::TerminateProcess(GetCurrentProcess(), 0);
DeleteFile(mytemporayfile);
...
Let me ask you: How you expect DeleteFile(mytemporayfile) directive to be executed if you just ::TerminateProcess(GetCurrentProcess(), 0) one line above???...
"...Ability to type is not enough to become a Programmer. Unless you type in VB. But then again you have to type really fast..."
Me
|
|
|
|
|
Did u close the file handles properly ? otherwise u cant delete it.... pls get the last error valuse using GetLasError()...and pls check in error list ... if the sharing violation is the reason...u should close the hadles.........
tamaaaaaaaar...!! slathak..!!!
|
|
|
|