|
|
|
Hi everyone!
I want to customize MFC's CTreeCtrl. I need to place a command button for the parent items(side to the text) and a progress bar(side to the text) for the child items.
Is this possible by extending CTreeCtrl?
If possible please give an idea. otherwise please give the alternative ways to do this.
Thanks,
Sivaji Reddy
|
|
|
|
|
You can do this by creating the buttons and progress windows as child windows of the tree control and placing them properly next to the items.
-Atul, Sky Software http://www.ssware.com
Shell MegaPack For ActiveX & .Net - Windows Explorer Like Shell UI Controls
|
|
|
|
|
Hi every1, am just a beginer in app. development using VC++ v6...
want to develop a very simple application that would connect a pc to mobile phones so they could communicate...
what steps do i need to go through using a VC++ v6.0???
any hints appreciated!
tmcc
|
|
|
|
|
Hi.
Your project doesn't seem to me as a "very simple application".
I would suggest you to:
1.
Decide in what way the app will commmunicate with the phone (IR or/and USB).
2.
Do your homework about communication. Study and learn.
3.
Decide what software parts you will need.
4.
Design the parts from step3.
5.
Start coding your app. And when you get specific problems, send them here.
Good luck.
|
|
|
|
|
this doesn't mean anything... there are so many ways to communicate with a periph (here, a mobile phone).
do you expect to use BlueTooth, IrDA, RS232, cable connection, user defined protocol ?
first point that out, and learn for it. after that only, think about how you're going to implement that.
if you want a "very simple application", console mode should be the right project to choose. this way, you'll be able to establish a connection between the PC and the phone.
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
oh my god !! i thought "simplest Application"s'd start with CDialog and CButton
V
|
|
|
|
|
Indeed this is one of the most non-simple beginner projects I'm seen requested. Any reason why you aren't starting with something a little less involved? I'm not even sure where I would start with such a project.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
I have design a Dialog but not a Dos to type my message in edit box and a click button to send the message. I dont' know how to design the receive dialog. My design are same with the server and client that can send and receive message. But most of the example I can found are in Dos application, can someone give me some example that it is in dialog application.
|
|
|
|
|
The core code will be the same, the samples are console apps to keep them simple.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
How to design for the receive dialog when I send a message to it? My send dialog can send a message but the receive side is a Dos application, how do I design a dialog that I can receive and see the message I send?
|
|
|
|
|
1983ttj wrote:
but the receive side is a Dos application, how do I design a dialog that I can receive and see the message I send?
I repeat - the code in your DOS app will work in an MFC app.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
((int)((int)(r+100000.5f)-100000))
((int)((int)(r+0.5f))
Is the former one better? Why?
|
|
|
|
|
Rnd, Floor or Ceil from math.h is the way to go.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
There is no rnd in math.h.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
(int) (r+0.5f) is the way to go if you are rounding to the nearest integer with ?.5 always rounding up.
The second version avoids overflow problems. My question would be why would someone think adding 100000 would improve the rounding function. When dealing with floating point numbers, you really have to be careful when adding and subtracting values.
(NOTE: this only works for positive numbers, negative numbers must use -0.5f and not 0.5f)
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
-- modified at 10:26 Friday 9th September, 2005
|
|
|
|
|
Oh dear god, I just realized what they are doing.
(int) (f) does a truncation of the floating point number. In otherwords, it rounds to zero.
2.5 -> 2
0.3 -> 0
-4.5 -> -4
The "(int) (r+0.5f)" trick only works for positive values.
2.3 -> 2
2.7 -> 3
-0.2 -> 0
-0.7 -> 0 (WRONG - should be -1)
By doing 100000.5f, they AVOID (not remove) the negative problem.
Example, but we use 10.5f instead of 100000.5f
-0.2 + 10.5f = 10.3f -> 10 -> 0
-0.7 + 10.5f = 9.8f -> 9 -> -1
But dear god, WHAT A HACK.
The proper way of doing it is:
int i = (int) (r + (r > 0.0f ? 0.5f : -0.5f));
This is why Christian wants people to use math.h because it is easy to create things that sort of work, but often they don't always work.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
please, somebody could publish a simple example on SNMP in C++?
Thanks!
Sorry for my english
|
|
|
|
|
Search CP articles for SNMP. There are several examples.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
sebastianos wrote:
somebody could publish a simple example on SNMP in C++?
here is list :-
SNMP ARTICLE[^]
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Friends,
I want to develop a ActiveX control container,and save data in flat(uncompound) document.
My document CxxDoc is derived from COleDocument,and the constructor as following:
CxxDoc::CxxDoc()
{
// EnableCompoundFile();
// ^^^^^^^^^^^^^^^^^^^^^^^^^^I need a flat (uncompound) file.so i delete it.
...
}
Firstly, Is it OK????Can i save data in flat document?
Secondly,my client item is CxxClientItem,
class CxxClientItem : public COleClientItem
The WriteItem and ReadItem function (copied from the sample program of ActiceX control test container in Visual C++) as follows. They can work correctly in compound document. Please tell me how to change them from compound document to flat(uncompound) document. I'm a new and I really need your help.
void CxxClientItem::WriteItem( CArchive& ar )
{
USES_CONVERSION;
IStoragePtr pStorage;
IStreamPtr pStream;
IPersistStreamInitPtr pPSI;
TCHAR szItemName[64];
HRESULT hResult;
IPersistStoragePtr pPersistStorage;
CxxDoc* pDoc;
CLSID clsid;
(void)ar;
pDoc = GetDocument();
ASSERT_VALID( pDoc );
ASSERT( pDoc->m_lpRootStg != NULL );
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^It is wrong in uncompound document
ASSERT( pDoc->m_bCompoundFile );
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^It is wrong in uncompound document
ASSERT( m_lpStorage != NULL );
ASSERT( !ar.m_bForceFlat );
GetItemName( szItemName );
if( !pDoc->m_bSameAsLoad )
{
hResult = pDoc->m_lpRootStg->CreateStorage( T2COLE( szItemName ),STGM_CREATE|STGM_READWRITE|STGM_TRANSACTED|STGM_SHARE_EXCLUSIVE, 0, 0, &pStorage );
// ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^It is wrong in uncompound document
if( FAILED( hResult ) )
{
AfxThrowOleException( hResult );
}
m_lpNewStorage = pStorage;
m_lpNewStorage->AddRef();
m_bNeedCommit = TRUE;
}
else
{
pStorage = m_lpStorage;
}
......
}
void CxxClientItem::ReadItem( CArchive& ar )
{
USES_CONVERSION;
BOOL tUsedStream;
IStoragePtr pStorage;
IPersistStreamInitPtr pPSI;
IStreamPtr pStream;
TCHAR szItemName[64];
HRESULT hResult;
BOOL tQuickActivated;
IPersistStoragePtr pPersistStorage;
CLSID clsid;
(void)ar;
CxxDoc* pDoc = GetDocument();
ASSERT_VALID(pDoc);
ASSERT(pDoc->m_lpRootStg != NULL);
// ^^^^^^^^^^^^^^^^^^^^^^^^^^It is wrong in uncompound document
ASSERT(pDoc->m_bCompoundFile);
// ^^^^^^^^^^^^^^^^^^^^^^^^^^It is wrong in uncompound document
ASSERT(m_lpStorage == NULL);
ASSERT(m_lpLockBytes == NULL);
ASSERT( !ar.m_bForceFlat );
// get item name
GetItemName( szItemName );
// open storage for this item
hResult = pDoc->m_lpRootStg->OpenStorage( T2COLE( szItemName ), NULL,
STGM_READWRITE|STGM_TRANSACTED|STGM_SHARE_EXCLUSIVE, 0, 0, &pStorage );
// ^^^^^^^^^^^^^^^^^^^^^^^^^^It is wrong in uncompound document
if( hResult != S_OK )
{
TRACE1( "Warning: unable to open child storage %s.\n", szItemName );
// upon failure throw file exception (item will be cleaned up)
AfxThrowOleException( hResult );
}
ASSERT(pStorage != NULL);
// remember the storage
m_lpStorage = pStorage;
ASSERT(m_lpStorage != NULL);
m_lpStorage->AddRef();
......
}
|
|
|
|
|
Hi folks,
how can I get the ascii code (0-255) from the wParam of the WM_KEYDOWN message (virtual-key code) ?
Thanks in advance,
Achim Klein
We can do no great things, only small things with great love. - Mother Theresa
|
|
|
|
|
According to MSN[^], that's all that's in there. So I expect you just need to cast the value to throw off the extra bits you don't need.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi Christian,
thanks for your instant feedback.
I've already tried to copy the bits according to this article, but unfortunately it doesn't work.
For example:
- the the Num-Pad keys returns lowercase characters
- the '+' and '-' keys haven't the normal ascii code
- all alphabetical keys from the keyboard are uppercase characters
It's a bit confusing...
We can do no great things, only small things with great love. - Mother Theresa
|
|
|
|