|
Hi,
I have an application with many tab controls (and in many of them I have other sub-tab controls) and I feel that it is heavy/troublesome to create new tabs or to maintain the existing ones.
Is there a way where I could just edit new tab controls visualy without having to create a new dialog for its content everytime?
I imaging being able to add a tab control to my dialog. Then I would simply specify the labels for my different sheets and by clicking a specific label, its content would be displayed and editable.
Now I always have to create a new dialog for every tiny sheet, then programatically set up everything and see the result only when running the application.
Thanks for your help
|
|
|
|
|
hello @all,
i have a dialogbased program.
there a two buttons (eg. button1 and button2).
if i press button1 first i get a new dialog (ID_DIALOG_COMBO) with a combobox (m_ctrlComboBox ).
if i press the button2 a CString (CString mystring ) should be enterd into the combobox from the ID_DIALOG_COMBO.
how can i do this????
thank you very much
this is only an example, to explain the real background would be take to much time
sunny
|
|
|
|
|
|
"Think about what you want the program to do. How would you do it manually ?" Christian Graus- Dec 02
ZARZOR13
|
|
|
|
|
Put button 2 on ID_DIALOG_COMBO
Kevin
|
|
|
|
|
i would be happy if i could do this, but the real program is more complicated...
i must have to different buttons, because if you have not a right password (somewhere before) you cannot see the ID_DIALOG_COMBO
thanks sunny
|
|
|
|
|
I would create the dialog in a thread, use a CStringArray for the contents of the combo box and create a function to refresh the combo.
_beginthread( ShowDialog, 0, ID_DIALOG_COMBO );
LRESULT ShowDialog( LPVOID pVoid )
{
CDialog Dlg;
Dlg.Create( pVoid );
Dlg.DoModal();
return TRUE;
}
or
CMyDialog* pDlg = new CMyDialog;
pDlg->... // initialize members
_beginthread( ShowDialog, 0, (void*)pDlg );
LRESULT ShowDialog( LPVOID pVoid )
{
CDialog* pDlg = (CDialog*)pVoid ;
pDlg->DoModal();
delete pDlg;
return TRUE;
}
The pointer method is preferable because you can store the pointer(s) and control the dialog using these pointers. Make a function to refresh your combo and call it through any initialized pointers. Maybe use a CPtrArray.
|
|
|
|
|
Why is that Visual C++'s GUI knows about sqrt yet the compiler doesn't?
As I edit my source I typed in sqrt and as I start to
type in the paramters the GUI presents me with 3 different prototypes of sqrt ... I think cool Visual C++ knows about sqrt ... so I typed sqrt( myDouble ); as per
the GUI. Yet I get a compiler error?
|
|
|
|
|
Because the IDE searchs all the headers in the include paths, but the compiler requires that you include them. It's probably math.h, or cmath ( which, if it works, is preferred ). Also cmath may require you use std::sqrt. All of this is a guess, but I am pretty sure that math.h at least will be the right one, and it's certainly a missing #include.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
My code looks kinda like this ...
#include "math.h"
#include "stdafx.h"
.
.
.
double BlahBlah::Blah_Abs ( double real, double img ) {
double rc = real * real + img * img;
return sqrt( rc );
}
.
.
.
Yet the compiler does not complain about not be able to find math.h in the include path so I must assume that VC++ knows about math.h and since the compiler errors on sqrt ( rc ); I guess that sqrt( double ) is not declared in math.h
|
|
|
|
|
include the math.h file
I bet it will work.
Kevin
|
|
|
|
|
sqrt requires #include <math.h>
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Just to reiterate and add my voice to the cacophany, the intellisense parses all include paths, but the compiler will only compile if you actually include the bits you need in your code.
I suggest that it's a wise course of action when people answer your question to try the suggested solution before arguing about it.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
I am including math.h but codeproject thinks le math.h ge is somekind of
HTML tag!
And WTF is this ...
I suggest that it's a wise course of action when people answer your question to try the suggested solution before arguing about it.
... about? I am not arguing about anything
|
|
|
|
|
My apologies - you didn't check the 'display message as is' option, nor did you use the buttons above the emoticons which would replace a < with a < and so on, making it show OK. As a result I presumed you were saying what you said in the first place, as did all the other people who replied.
I see you have edited the code now )
#include "math.h"
#include "stdafx.h"
Anything before stdafx.h is ignored. Move it down and it will work.
Christian
No offense, but I don't really want to encourage the creation of another VB developer.
- Larry Antram 22 Oct 2002
C# will attract all comers, where VB is for IT Journalists and managers - Michael
P Butler 05-12-2002
Again, you can screw up a C/C++ program just as easily as a VB program. OK, maybe not
as easily, but it's certainly doable. - Jamie Nordmeyer - 15-Nov-2002
|
|
|
|
|
Christian Graus wrote:
Anything before stdafx.h is ignored. Move it down and it will work.
As noted on page 216 of Programming Windows with MFC. I knew I had read that before and I had to look it up.
Nick Parker
You see the Standards change. - Fellow co-worker
|
|
|
|
|
DOH!
Thanks!
|
|
|
|
|
hi everybody,
i had a sdi project, based on treeview. i want to setup context popup menu in such way so that the popup menu only pops up whenever the user right click on a node of the tree, sorta like how the popup menu works in windows explorer. any suggestion is welcome.. thanx in advance.
|
|
|
|
|
you will need to setup a handler for a message that is reflected from the tree view back to the parent. Check this message, NM_RCLICK. Then you need to use the tree controls hittest functions to determine if the mouse position is on one of the nodes in question. Once you have that you can display your context menu. Hope that helps. For more info search msdn for the NM_RCLICK message and also lookup message reflection for a broader overview of the topic. Good luck.
Joseph Dempsey
joseph_r_dempsey@yahoo.com
"Software Engineering is a race between the programmers, trying to make bigger and better fool-proof software, and the universe trying to make bigger fools. So far the Universe in winning."
--anonymous
|
|
|
|
|
I've got a program that uses mail slots. My problem is that when I send a mail message to the local machine the message is recieved twice. I have narrowed this down to my sending code by changing it to send to the microsoft messenger service. The messeneger service recieves the message twice too. However, it I use net send to send the message it is only recieved once. I think net send uses the NetMessageBufferSend function, but I should still only recieve once. If I send to a remote machine with the same code, it is only recieved once. I have tested it on two machines and both have the problem. My code to send is as follows:
{
int nResult;
HANDLE pHandle;
DWORD dwBytesSent;
CString strMailslotName;
strMailslotName = _T("\\\\");
strMailslotName += m_sComputerName;
strMailslotName += _T("\\mailslot\\messngr");
pHandle = CreateFile( strMailslotName, GENERIC_WRITE, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL );
if( pHandle == INVALID_HANDLE_VALUE )
{
AfxMessageBox("Error accessing mail slot \"" + strMailslotName + "\"");
CloseHandle( pHandle );
return;
}
else
{
nResult = WriteFile( pHandle, strMsgText, ( DWORD )strMsgText.GetLength(), &dwBytesSent, NULL );
if( nResult == 0 || ( DWORD )strMsgText.GetLength() != dwBytesSent )
{
CString Error;
LPVOID lpMsgBuf;
if (!::FormatMessage(
FORMAT_MESSAGE_ALLOCATE_BUFFER |
FORMAT_MESSAGE_FROM_SYSTEM |
FORMAT_MESSAGE_IGNORE_INSERTS,
NULL,
GetLastError(),
MAKELANGID(LANG_NEUTRAL,SUBLANG_DEFAULT),
(LPTSTR) &lpMsgBuf,
0,
NULL ))
{
AfxMessageBox("An unknown error occured.");
}
else
{
Error = "Error writing to mailslot: ";
Error += (LPCTSTR)lpMsgBuf;
AfxMessageBox(Error);
}
LocalFree( lpMsgBuf );
}
}
CloseHandle( pHandle );
}
Any ideas whats wrong with this? I don't see how it could be sending two messages. m_sComputerName is the local computer's name.
Thanks for you help!
|
|
|
|
|
This is actually by design. Sending on a mailslot goes across all the available protocals installed on the machine. This means if you have both TCP/IP and IPX installed, you'd get two messages. If you peruse the documentaion more carefully you'll see that this is documented. You need to include some kind of ID with the message to you can throw out duplicates. Also note that this protocal does not ensure order of deliverly. Just because msg 1 went out before msg 2 doesn't mean you'll get msg 1 before msg 2. In testing i've found that 99% of the time you'll get them in order, but the documentation say's it this isn't guaranteed. If you need further help, let me know.
Joel Lucsy (jjlucsy@concentric.net)
|
|
|
|
|
How do I specify the Rect tangle for my new CViews?
I have tried this ...
<br />
void CMyView::OnDraw(CDC* pDC)<br />
{<br />
COragomy_IIDoc* pDoc = GetDocument();<br />
ASSERT_VALID(pDoc);<br />
<br />
CRect rect = new CRect( 0, 0, 320, 200 );<br />
pDoc->m_clientRect = rect;<br />
... but it doesn't work.
|
|
|
|
|
Actually the code looks like this ...
<br />
void CMyView::OnDraw(CDC* pDC)<br />
{<br />
COragomy_IIDoc* pDoc = GetDocument();<br />
ASSERT_VALID(pDoc);<br />
<br />
CRect rect = new CRect( 0, 0, 320, 200 );<br />
pDoc->m_clientRect = rect;<br />
<br />
|
|
|
|
|
i want to start a local process that should be started by loading the executable located on the remote computer into local memory.
i am sharing the folder on the remote machine.but it could not be started.
can any body tell the sample code of running a process at network path?
i will be very thank full to you.
r00d0034@yahoo.com
|
|
|
|
|
Try to see what exact error you've got. I used ShellExecute and it worked fine wherever the file is located
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
|
|
|
|