|
You don't need to do anything. The char will be implicitly converted to an int (look up "integral promotion" in your help docs) to do the comparison.
--Mike--
http://home.inreach.com/mdunn/
Tables, ladders, chairs, OH MY!
|
|
|
|
|
Someone can tell me the exact role of this ?
Thank
Yuri
|
|
|
|
|
Hi folks,
i have an environment where the server is unix and the workstations are Windows NT. Now the admin wants to send smtp-messages to the workstations. (like "i will shutdown the server in 10 seconds") i think this means i have to write small smtp-servers on all workstations which do nothing more than listen on port 25 for incoming mails, recieve them and pop them up on the screen. Anyone out there who has ever done something like this? Any help would be appriciated!
|
|
|
|
|
SMTP is not suitable for this purpose. It's for sending email, not popup notifications. Tell your administrator to find a better protocol, or define one himself.
|
|
|
|
|
Yep, it sounds like you need to use Net Send from the command prompt. but I would not know how to implement this from the UNIX side. He could just send the notification from the NT Server\Domain.
Giles
|
|
|
|
|
Dear All,
I have been stuckup by a problem i want to change the bakgroud color
of each indiviudal cell of the grid control
can any one help me on this
Sumanth Kalidindi
Hyderabd
|
|
|
|
|
Greetings,
Status: Large graphics intense project using C and Win32 with the GDI
Problem: After short periods of use the client area stops repainting correctly (partial repaint 1/3 of client area). Afterwords most of windows graphics functions are messed up and menus and stuff can't redraw
System: Windows NT 4.0 sp4, Visual C++ 6.0 sp5, 1GB RAM.
Help solving this problem would greatly be apreciated (I have it narrowed to one function) out of 120,000 lines of code
Please mail me if you have any ideas (message queue, GDI issues....)
Randy@NeuronEntertainment.com
Sincerely,
Randy Trulson
|
|
|
|
|
You have what is called a memory leak. You have run out of GDI resources, and so the whole thing is melting down. As you are using Win32, you need to be extra careful to Destroy EVERY handle that you create when you are finished with it. If it's any consolation, I changed an MFC function to straight C, and spent two nights debugging the memory leaks, because there was so much more I needed to take care of.
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
I'm trying to create a multithreaded server program. After I create the thread that listens for incoming connections it will go for a little while then it'll crash. I usually get some error in barcore.cpp. I have no idea what's causing this. Here is the code i use for my listen function.
UINT PASCAL CLJFileServer::ListenProc(LPVOID *pParam)
{
CLJFileServer *pThis = (CLJFileServer*)pParam;
CTimeoutSocket* pClient = NULL;
pThis->m_pListen = new CTimeoutSocket();
pThis->m_pListen->Create(pThis->m_uPort);
while(pThis->m_bStop != true)
{
if (pClient)
delete pClient;
pClient = new CTimeoutSocket;
pThis->m_pListen->SetTimeout(LJ_TIMEOUT);
int bAccepted = pThis->m_pListen->Accept(*pClient);
if (bAccepted)
{
pThis->SendAck(pClient);
if (pThis->m_uServerType == LJFS_LISTEN)
pThis->Login(pClient);
pThis->ForwardConnection(pClient);
}
}
delete pThis->m_pListen;
return 0;
}
Any ideas. I will email you my code if you need a better idea. Thanx in advance.
Stephen Caldwell
Desick Information Technologies
|
|
|
|
|
I inserted a month calendar control (CMonthCalCtrl) into my project, and handle the MCN_GETDAYSTATE notification message to set day state (e.g. to emphasize every Friday). It's pretty easy for the current month of the calendar. However, when user change the date, for example, from Jan 2000 to Dec 1999, I cannot expect which month the calendar will change to and I have no idea how to calculate which day is Friday. Is there any one can give me a hint for that? Thanks in advance.
Yijun
|
|
|
|
|
If all you have is the month/year, you can set a CTime to the 1st of that month, and use CTime::GetDayOfWeek() to get the day of the week that the 1st falls on. From there you can find the Fridays.
--Mike--
http://home.inreach.com/mdunn/
The Signature, back by popular demand: Buffy. Pajamas.
|
|
|
|
|
Thanks for your answer. But what troubles me is I don't know which month will be shown. In other words, I want to know how to get the date the calendar will show, so I can caculate which day is Friday.
Yijun
|
|
|
|
|
I have the following piece of code in an ATL COM component that I have developed. What this piece of code does is create a COM instance of another object inside the same COM component. However, somewhere in this piece of code is a memory leak. I have tested the COM object that is being created here seperately and it does not have a leak so it must be somewhere in this creation/destruction code... could anyone please let me know if they see something glaringly wrong? Thanks.
// Calculate the checksum
HRESULT hr = NULL;
IHash *IHash = NULL;
// Now we will intilize COM
hr = CoInitialize( 0 );
// Use the SUCCEEDED macro and see if we can get a pointer
// to the interface
if ( SUCCEEDED( hr ) )
{
hr = CoCreateInstance( CLSID_Hash, NULL, CLSCTX_INPROC_SERVER, IID_IHash, (void**)&IHash );
if ( SUCCEEDED( hr ) )
{
BSTR* szReturn = new BSTR;
IHash->Digest( szTemp.m_str, szReturn );
IHash->Release();
szTemp.AppendBSTR( *szReturn );
delete szReturn;
}
}
|
|
|
|
|
I didn't think you could create BSTR's this way. I think you have to call SysAllocString(). Or could it be that you are not freeing your BSTR? Just a guess....
|
|
|
|
|
You're handling your BSTRs wrong. When a method returns a string through a BSTR*, you pass the address of a BSTR, not a BSTR* (if that makes sense).
BSTR bsReturn;
...
IHash->Digest ( szTemp.m_str, &bsReturn );
...
SysFreeString ( bsReturn ); You can also use CComBSTR or _bstr_t which do the memory management for you.
--Mike--
http://home.inreach.com/mdunn/
The Signature, back by popular demand: Buffy. Pajamas.
|
|
|
|
|
Generally BSTR creates memory leak.Hence in order to avoid it use either _bstr_t or CComBstr.
And even instead of BSTR* use BSTR object and pass the address to the function.
And free it through SysFreeString function.
BSTR m_bstr;
IHash->Digest(szTemp.m_str, &m_bstr);
...
..
SysFreeString(m_bstr);;P
:p
|
|
|
|
|
Generally BSTR creates memory leak.Hence in order to avoid it use either _bstr_t or CComBstr.
And even instead of BSTR* use BSTR object and pass the address to the function.
And free it through SysFreeString function.
BSTR m_bstr;
IHash->Digest(szTemp.m_str, &m_bstr);
...
..
SysFreeString(m_bstr);;P
:p
|
|
|
|
|
I have just started to make my first MFC programs, and I am having a big problem. Whenever I alter the code and need to insert a heared file I recieve all kinds of errors. For example I am writing a program that contains a splitter window, with forms on both sides. In it I call splinterwnd.CreatView with a reference to the form class. But when I put the form header at the top I get errors (mainly c:\program files\microsoft visual studio\myprojects\temp\tempview.h(27) : error C2143: syntax error : missing ';' before '*')
How do I know where to put the header file?
|
|
|
|
|
This means that you need to include a header for whatever it is this line references. The header file goes in the top of the .h if it's for a member variable, otherwise the .cpp. It needs to be under the main ones (stdafx.h, the classes own header file ) and you need to make sure ( mainly by not putting it in the .h unless you need to ) that you don't create a circular reference where two headers load each other.
More than that, I cannot tell without seeing the code.
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
This is something I wish someone would write an article on - with an aim of avoiding having to nest header includes in MFC projects. The problem arises as translation units include headers you're not expecting them to, and a nice directed include graph of an MFC app would be a boon.
But here's a tip that might help - if you add a new class, include its header in the cpp file that holds the application class (MyApp.cpp) right after stdafx.h. Then, include it in whatever .cpp file will be using it, before the header for that file.
The application class is typically the first translation unit to get compiled in these projects, and often the scope of its includes (doc and view, e.g.) are what cause the kaffufle.
later...
Actually, on reading your message again, you might be able to just get by with a forward declation of the form class at the top of the header, since you are just declaring a pointer.
----
"If you would see the invisible, you must look carefully at the visible."
Santayana
|
|
|
|
|
Hi
I am starting the netmeeting application from vc++ application using
createprocess.
But it just starts the netmeeting application. But My reqmt is to start
and connect to ip address x.x.x.x. and username xxx and password xxx.
How do i achieve this. If i use netmeeting sdk can i do that...what is exact api
for this..
how do i use callto function ?
Also if i want to run a netmeeting shortcut in my desktop, how do I achieve this. i.e i want to simulate the double click of a shortcut icon, which will launch the application associated with it.
any idea..thanks in advance
raju
|
|
|
|
|
I think you want to use ShellExecute, which allows you to specify command line parameters.
Christian
I've learned that you cannot make someone love you. All you can do is stalk them and hope they panic and give in.
The early bird may get the worm, but it's the second mouse that gets the cheese.
|
|
|
|
|
In OnNewDocument in my MDI, I go out and get a bunch of information. Depending on what is retrieved, I need to use a different view, in my case a CEditView or CHtmlView. I have looked over the article "Replacing a view in a doc-view application" but that article assumes you already have a view. Specifically the lack of a AfxGetMainWnd()->MDIGetActive() causes problems.
I want to use one type of view if the CDocument data meets a certain condition and a different view if it meets another condition. Can anyone point me in the right direction?
|
|
|
|
|
Check the Paul DiLascia article that appeared in Feb'96 issue of MSJ:
http://msdn.microsoft.com/library/periodic/period96/SFFD.htm
The solution doesn't use OnNewDocument. Instead, it overrides the InitialUpdateFrame, which is a virtual method of CDocTemplate. The decision which view to use is delegated to user-defined method. This allows you to display CEditView or CHtmlView depending on context.
Tomasz Sowinski -- http://www.shooltz.com.pl
|
|
|
|
|
With a few modifications it worked like a champ. Thanks.
|
|
|
|