|
How do I tell at runtime if am in an sdi/mdi or dlg app?
i.e are there some #defines I can use.
If so - what are they?
-cheb
|
|
|
|
|
I wonder why you thought it was an easy question
Anyway first do this
AfxGetMainWnd
to get a pointer to the main window
now call this function on the CWnd* returned
GetRuntimeClass
you'll get the class name using the m_lpszClassName member
now use IsDerivedFrom and pass the CRuntimeClass* for CDialog, CFrameWnd and CMDIFrameWnd till one of them matches
got it?
Nish
p.s. I haven't tried it out yet, so there might be somethin I missed...
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Sounds good.
I thought it would be easy as I assumed that there would be #defines buried in MFC some where for sure.
I just did not know where.
Anyway, thanks this is a good robust solution.
-cheb
|
|
|
|
|
I don't know if there are any #defines, but you might try:
AfxGetMainWnd()->IsKindOf( RUNTIME_CLASS(CDialog) );
AfxGetMainWnd()->IsKindOf( RUNTIME_CLASS(CFrameWnd) );
AfxGetMainWnd()->IsKindOf( RUNTIME_CLASS(CMDIFrameWnd) );
I haven't, though, given this a try, so I can't guarantee it will work.
------------------------
Derek Waters
derek@lj-oz.com
|
|
|
|
|
Hello!!
I am building a TAPI application in which there is one server and many clients.i.e. N client machines would be connecting and communicating with 1 server machine. Once the connection is established, server would be accepting the data sent by the clients and then the same data would be again sent back to the same client who sent it to the server, through modem. The application should have the capability to do data transmission and receive simulnateously with n-clients.
The application is supposed to run on Win 98,WinNT, WIN 2000 and Win XP. I am using C programming and TAPI 2.0. I do not want to use COM/DCOM. Can you please tell me if it is possible to build an application of n-clients and 1 server using language C, TAPI 2.0 and without COM/DCOM.
I already have built an application for data communication between single client and single server.
Data transmission is done through the COM port to which the modem is connected.
Can anyone please help and advise as to how I could go on to build a n-client 1 server TAPI application.
Any help would be higly appreciated.
Thanks
Sandeep
|
|
|
|
|
Hi,
Sorry, i don't have an answer for ur problem. Actually i wanted ur help. i'm trying to create an application with TAPI to send data between a single client and a single server. Can u guide me through that. I'm new to this TAPI programming , so can u pls list me the various TAPI functions which can be used.
Pls help.
vini
|
|
|
|
|
I am trying to do this:
...
CString strMsg;
...
char *pBuffer = new char[nLen+1];
...
strcpy(pBuffer,(const char*)strMsg);
...
I get error C2440: 'type cast' : cannot conver from 'class CString' to 'const char *'.....
How do I get this to work?
Thanks
-Matt Newman
-Politically Correct Sensoring Service
-We make sure you don't f*** up in public
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
If you're using UNICODE, then why not use a TCHAR instead of a char?
CString strMsg = _T("Test me");
TCHAR *pBuffer = new TCHAR[100];
_tcscpy(pBuffer, (LPCTSTR) strMsg);
cout << pBuffer << endl;
HTH,
Jon Sagara
"There are lies, damned lies and statistics."
-- Mark Twain.
|
|
|
|
|
This Worked. Thanks for the help.
- Matt Newman
-Sonork ID: 100.11179:BestSnowman
|
|
|
|
|
try using wcscpy [the wide version of strcpy]
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
I assume you're doing this in a Unicode build? CString holds TCHARs, so in your case it's got WCHARs (wide characters, a.k.a. Unicode chars), and CString has no facility for converting between character sets.
Use one of ATL's conversion macros:
USES_CONVERSION;
strcpy ( pBuffer, T2CA((LPCTSTR) strMsg) ); T2CA() converts from a TCHAR string (Unicode string in Unicode builds) to a const ANSI string.
--Mike--
My really out-of-date homepage
"Not our fault we are intellectually superior to the rest of the office." -- Paul Watson in the Lounge, 12/12/2001
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Hey, I was looking at all the sample programs on this site and even downloaded a few. When I try looking at them in my C++ program all the folders appear on the right hand side of the screen with nothing on the left side. There is no DSW or DSP files in these samples. Is there anything that I can do to try these programs?
|
|
|
|
|
If the zip contains only cpp and h files you prolly downloaded some CPP class source. Just add the cpp and h files to your existing project. The article would explain how to use the class.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Thanks a lot, I appreciate it!
|
|
|
|
|
OK code snippet:
void CPro1WinTUSDlg::OnMainButton()
{
if(OnSearchforRadio()){
CSearchingDlg SearchingDlg;
SearchingDlg.DoModal();
}
else{ //if(OnEnterdataRadio()){
CSureToEnterDlg SureToEnterDlg;
SureToEnterDlg.DoModal();
}
}
I want my button to invoke dialog 1 if radio 1 is selected and dialog 2 if radio 2 is selected. I changed the OnEnterdataRadio() and OnSearchforRadio() functions from type to void to BOOL. Everything compiles but when the button is pressed, regardless of which radio is selected the button is invoking the Seaching dialog.
I'm a newbie at all of this, so please be gentle with the flames.
Digital Khaos
"Every problem has a solution" -unknown
|
|
|
|
|
Digital Khaos wrote:
I'm a newbie at all of this, so please be gentle with the flames.
Really ?
Anyhow, I can't see what you're saying here - you've not shown us the functions that matter, OnSearchForRadio and OnEnterDataRadio, but I presume they are functions added through the Resource Editor and relate to radio buttons ? If so, you need to create an integer variable for the first radio button in your group, it will be a 0 indexed number that indicates which button is checked. You'll need to call UpdateData() first.
My advice may be totally wrong based on the absence of enough info, so if it doesn't seem right, just post the rest of the code and I'll try again....
BTW BOOL is a typedef'd int, created for C programmers ( C does not have type bool ). Use bool if that's what you want, or int if you want an int.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
I am assuming that CPro1WinTUSDlg is a dialog with a button and some radio buttons on it. You're expecting the user to pick one of the radio buttons, then click the normal button. And you want to launch one of two dialogs, depending on which radio button is selected.
Although without you posting more code, I can't be sure, it looks like you're calling message handler functions ( OnSearchforRadio() and OnEnterdataRadio() ). This is a big no-no. Those functions should be called only by the framework, when it receives a particular message.
There are at least a million ways to achieve this, but here is one that is both easy and good. Not necessarily the best though.
void CPro1WinTUSDlg::OnMainButton()
{
CButton *p_Radio1 = (CButton *) GetDlgItem(IDC_RADIO1);
if (p_Radio1->GetCheck()) {
CSearchingDlg SearchingDlg;
SearchingDlg.DoModal();
} else {
CSureToEnterDlg SureToEnterDlg;
SureToEnterDlg.DoModal();
}
}
That should do the job for you.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
I'm writing an add-in for VS.NET, but I think this is really a COM question - I'm quite a novice with COM.
I've started from the ToolWindow add-in sample. It is implemented as an add-in that hosts an ActiveX control. The add-in retrieves a pointer to the DTE object, like this:
pApplication->QueryInterface(__uuidof(EnvDTE::_DTE), (LPVOID*)&m_pDTE);
But how do I get that pointer in the control? I guess I want to pass that pointer from the add-in to the control, but I don't know how to do this.
I guess I could export a function from the control's DLL and pass the pointer to that, but that doesn't seem appropriate in a COM object.
Thanks,
Tom.
|
|
|
|
|
Can any one save me from tearing my hair out?
I'm trying to write a copy constructor for a templatized class, but I'm kind of new to both copy constructors /and/ template classes, so it's not going too well.
When I try my app with the following copy constructor:
<bold>
template <class TYPE>
C4DList<TYPE>::C4DList( const C4DList &rValue )
{
Element *pCurrElement;
pCurrElement = rValue.m_pHead;
while( pCurrElement )
{
AddTail( pCurrElement->pData );
pCurrElement = pCurrElement->next;
}
}
Visual C++ (6.0sp5) refuses to insert a breakpoint anywhere in the code, and when I execute
<bold>
CImageProcessing::GetBlobList( C4DList<CImageProcessing::Blob> *pBlobList )
{
ASSERT( pBlobList );
*pBlobList = m_BlobList;
}
and try to step into the assignment (which I think should call the copy-constructor) VC won't let me step in.
I have a feeling I've either got completely the wrong end of the stick, or I've made an elementary mistake, but I can't figure it out for the life of me. And I have been RTFMing as much as I can!
TIA,
Pete
|
|
|
|
|
moredip wrote:
*pBlobList = m_BlobList;
That calls operator=, not the copy constructor. It sounds like VC is optimizing out the copy constructor since it is never called, that would explain why you can't set breakpoints in it. (And yes, that can happen in Debug builds, I've seen it happen myself.)
--Mike--
My really out-of-date homepage
"Not our fault we are intellectually superior to the rest of the office." -- Paul Watson in the Lounge, 12/12/2001
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Hi mike,
Thanks for your help, you were right on the money! I wrote a little TestCopy( C4DList<blob> test ) function, and this /did/ use the copy constructor and therefore VC allowed me the honour of placing breakpoints etc. I wonder if MS view the 'optimising debug build' as a bug or a feature?
now I just have to learn about operator=...
Thanks again,
Pete
|
|
|
|
|
I am porting some code from C++ 1.5 to 6.0. The
combox would let me drop down other combo boxes
when one box was asked to be dropped. The new
version does not let this happen. In the message handler
ON_CDN_DROPDOWN, I would call "ShowDropDown" for
the other ComboBoxed. If I do this now, the requested
box will drop then after making the call to "ShowDropDown",
the request box will close. The new box will drop and then
immediately close, too.
Any insight would be appreciated.
Eldon Zacek
Czech-Mate Enterprises, LLC
|
|
|
|
|
This is a little off topic, but I can't think of a better group of people to ask this question.
I've recently been evaluating a debugging suite of products from Mutek. The principle product of interest is called Bug Trapper.
It attaches to one or more processes and captures all the activity (can be filtered). Then you can play it back in a session similar to live debugging, except you can look at anything as of anytime.
A couple of key features are that you can attach to any running process, it does not have to be compiled in debug mode, just need a pdb. It identifies the thread that is executing each piece of code and can be played back in time sequence or on a thread by thread basis. (Helps my multithreaded service debugging immensely).
1. Has anyone had experience with this product?
2. How did you use it? (what types of apps)
3. Was it worth it (its not clear yet what this will cost, but it aint cheap!)
4. Are there other similar/better products out there?
5. Any other comments?
As always, thanks for any help I get with this.
As always, thanks for any help I get with this,
Bill
|
|
|
|
|
In WinXP many new programs have very cool checkboxes (with an hoover effect), buttons & controls...
I woluld like to know how to use these new controls... I think that some stiles should exist.... someone has any idea about that?
|
|
|
|
|
To get the whole XP look in your programs ( the buttons, menus, toolbars, etc. ), you need something like the Xtreme Toolkit ( www.codejock.com ), which gives you those styles as well as wizartds to create GUIs such as Outlook and Visual Studio.
Christian
After all, there's nothing wrong with an elite as long as I'm allowed to be part of it!! - Mike Burston Oct 23, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|