|
Ooops - if my other post came up, it's because I was trying to click reply on two things at once. I *hate* that IE pops Windows to the top, it is so frustrating sometimes.
The next version of MFC has jpeg/gif/etc support, in the meantime to get more comprehensive control than the control someone else suggested, go to www.apintlib.de, and you'll be able to read/write them and a lot of other formats as well.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
www.paintlib.de you mean no?
---
"every year we invent better idiot proof systems and every year they invent better idiots"
|
|
|
|
|
Yes, thanks. I actually got an email from the original poster and corrected it in a reply email, but I *should* be more careful, especially with URL's.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
I am trying to set the text color of a number of CEdit and CComboBox controls whose state is not Enabled.
I can override the background colour, overrriding the OnCtlColor method, but not the text colour, whatever I
do it uses the SYSTEM Grey Color. I can set the Sytem Grey Color to black, but this effect everything!!
Any ideas would be appreciated
Marc Clarke, marclark@lehman.com
|
|
|
|
|
When an edit control is disabled Windows treats the control like a static control. Test for CTLCOLOR_STATIC.
|
|
|
|
|
Thanks, that indeed traps the message, but calling SetTextColor on the device context has no effect the text remains Grey.
I think I have a workaround. Thanks anyway
Marc
|
|
|
|
|
Running an MFC app, using sockets. The send socket appears to consume system resources for no apparent reason. when the send/recieve is complete and the sockets released so are the resources. Should this socket have its buffers released during run time or is there something obvious that I am missing out on. If this is not the case then what else could consume system resources at a rapid rate.
Thanks in advance for any replies.
Brian
****************************
* brianh@ee.bath.ac.uk *
****************************
|
|
|
|
|
Wild theory.
If you're sending more than, say 512 bytes at a time, the socket will probably have to fragment the data to get within the current Maximum Trasmission Unit (MTU) limits for internet packets. I have suspected resource problems in the past related to this fragmentation.
No proof on this, but maybe you can experiment. Win9x may be more succeptable.
There may be other factors involved as well, such as the rate at which packets are being received. ?
|
|
|
|
|
<<< In the name of GOD >>>
Hi.
I want to use try and catch in my program for managing errors.
void CEditorDlg::Saving()
{
UpdateData(TRUE);
CFileException *fileErr;
CFileDialog fd(FALSE, "*.txt", NULL, OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, "Text file (*.txt)|*.txt||", this);
CFile file;
if(fd.DoModal() == IDOK)
{
try
{
file.Open(fd.GetPathName(), CFile::modeCreate | CFile::modeWrite, fileErr);
file.Write(m_MainEdit, m_MainEdit.GetLength());
file.Close();
}
catch(CFileException *err)
{
file.Abort();
err->ReportError();
}
}
}
But when in saving file was any error, this code won't work.
Please tell me, how can i use of try/catch for managing ERRORS.
Thanks.
Hadi Rezaie
|
|
|
|
|
You should put in a catch for all cases like this
catch(...)
that will get called for any errors not specifically covered.
Christian
The content of this post is not necessarily the opinion of my yadda yadda yadda.
To understand recursion, we must first understand recursion.
|
|
|
|
|
>You should put in a catch for all cases like this catch(...)
I disagree - in VC you will leak memory if CException based pointers are thrown, and you might catch all sorts of processor traps that you can't deal with.
Not everyone agrees with me on this one, so I just post this as a caveat emptor.
|
|
|
|
|
You should pass a pointer to an existing exception object, then check the return value of the call to open - if FALSE, check the exception object. This is an exception that is filled in, not thrown. From the MSDN:
CFile f;
CFileException e;
char* pFileName = "test.dat";
if( !f.Open( pFileName, CFile::modeCreate | CFile::modeWrite, &e ) )
{
#ifdef _DEBUG
afxDump << "File could not be opened " << e.m_cause << "\n";
#endif
}
In your code, you are passing in an uninitialized pointer - thats bound to be problematic.
|
|
|
|
|
Two things.
First, you must delete any thrown CException based exceptions by calling the Delete() function inside your catch handler.
e->Delete();
Second, You are only passing a pointer to a CFileException object. You need to pass an actual one. It would be better to just use the Constructor based method instead, which will create the exception for you if there is an error.
|
|
|
|
|
<<< In the name of GOD >>>
Hi.
I have program(Dialog based) that in this program i used of Status bar control.
I want to change status bar position in the dialog.
More explain: I want to change position when event is OnSize, OK ?
I wrote it but this code won't work.
::MoveWindow(wnd_Status.m_hWnd, 10, 10, 20, 20);
Please help me ...
Hadi Rezaie
|
|
|
|
|
How can I detect the answer of a modem that I called from mine immediately after dialing the phone number (during PROCEEDING of call state and not at the end)?
THANKS
|
|
|
|
|
There is a Carrier Detect (CD) line that will go high when the connection is made.
If you are using a 3rd party ActiveX control or the MSComm control, there is an event that will fire when the status of the line changes. You can then retrieve the status of the CDHolding property to see whether the connection has been made or not.
|
|
|
|
|
Hello!
I'm trying to insert Simple MAPI to my Application (without using the CDocument related Component from Component Gallery). There's a quite good example in the MSDN Library (just what I need) but the Linker always exits with
"mapitestView.obj : error LNK2001: unresolved external symbol _MAPISendMail@20"
I could reproduce the error with a simple wizard generated Standard SDI App, in which I inserted my several lines of code.
I included mapi.h and added mapi32.lib to the linker settings.
I'd be very glad if someone could give me some advice on how to avoid this error.
bye
Matthias
|
|
|
|
|
Get rid of mapi32.lib from the linker settings. You can't call the MAPI functions directly, you need to do this:
typedef ULONG (FAR PASCAL *MAPIFUNC) (LHANDLE lhSession, ULONG ulUIParam,
lpMapiMessage lpMessage, FLAGS flFlags,ULONG ulReserved);
const HINSTANCE hMAPILib = ::LoadLibrary("MAPI32.DLL");
MAPIFUNC lpMAPISendMail = (MAPIFUNC)GetProcAddress(hMAPILib, "MAPISendMail");
then when you want to call it:
ULONG result = lpMAPISendMail(0, 0, &mail, NULL, 0);
...
VERIFY(::FreeLibrary(hMAPILib));
Should do the trick.
~Kevin
|
|
|
|
|
How can I convert int to string and float to string?
Thank you
Kyousuke
|
|
|
|
|
You can use the itoa function (integer to ascii) to convert an integer to a string.
char *pReadBuffer;
_itoa(m_yourInteger, pReadBuffer, 10);
greetz
|
|
|
|
|
Do you mean C++ standard strings (std::string) or MFC CStrings? In standard C++ you do it with string streams:
#include <sstream>
#include <string>
using namespace std;
//...
ostringstream os;
string s1, s2;
os << 123; // int to stringstream
s1 = os.str(); // stringstream to string
os.seekp(0); // clear stream
os << 1.234; // float to stringstream
s2 = os.str();
In MFC, use CString.Format()
|
|
|
|
|
We have a C++ app which ran on Win95 using the C++ convention to call another exe as system("Myapp.exe"), then calls another exe next line system("Myapp1.exe"). In Win95 these two programs start automatically, using command.exe. Everything ok.
When we run the same application on NT, system("Myapp.exe"), line will wait unti Myapp.exe finishes before starting Myapp1.exe.This executes cmd.exe.
Obviously CreateProcess should have been used, but are there any workarounds without changing the code. To force the exe's to start.
Thanks.
Gerry.
|
|
|
|
|
|
I've already done this in a batch file, but in the C++ compiled code, it has system("Myapp.exe").....I'm trying desperately not to change any code.....
I was going to change the environment var in the Registry, from cmd.exe to command.exe....this works...but results undefined .
Thanks.
Gerry.
|
|
|
|
|
I'm looking into developing an app that needs to have a slight twist on the doc/view architecture, and I'd like some opinions.
In a nushell, we'd like to have an Explorer-type interface, but with the tree containing multiple documents. The top level of the tree would contain N documents, and the data within each document, which is organized hierarchically, would be displayed as children of the documents.
The wrinkle here is that the window containing the tree is outside the normal doc/view paradigm; it not only displays a "list" of available documents, it also displays data for each document. I know how to deal with the latter problem - I'll bypass the UpdateAllViews() mechanism in MFC and replace it with a custom Publish/Subscribe scheme - but how to deal with the tree window?
So far, two ideas have occurred to me:
1) Make the tree window be a child of the mainframe, and not a view; that is, something analogous to a permanently docked control bar.
2) Create a phony "master document", which references all the other documents, and then have this window be a view into the master doc.
I'm still kicking ideas around, but tonight I'm leaning toward 1). Thoughts? Suggestions? References? Catcalls? (I suppose for you Aussies, these would be Koala calls...)
TIA
Jim Johnson
|
|
|
|