|
Thqanks Brad
works great
|
|
|
|
|
If by 'recover' you mean get the currently selected item in the combobox, I use GetWindowText() .
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
sorry some code went missing when I pasted.. here it is again
void Control::DoDataExchange(CDataExchange* pDX)
{
Sheet* pSheet = ((C_App*)AfxGetApp())->getSheet();
MyPropertyPage::DoDataExchange(pDX);
//{{AFX_DATA_MAP(Control)
DDX_Control(pDX, IDC_OTHER_COMBO, m_otherCombo); // IDC_OTHER_COMBO is the CComboBox ID:
//}}AFX_DATA_MAP
}
//-----------------------------------------------------------------
Sheet::PopulateOtherCombo()
{
int i;
int entry=0;
int index=0;
CString name;
for (i=0;i<max_count;i++)
{
=""
="" some="" code="" that="" constructs="" the="" string="" 'name'
=""
="" write="" 'name'="" to="" ccombobox
="" index="getControl()-">m_otherCombo.AddString(name);
if (index != CB_ERR)
{
getControl()->m_otherCombo.SetItemData(index, entry++);
}
}
}
//---------------------------------------------------------------------------
//So far I have built a list of strings stored sequentially by 'index' but how do I recover a string ??
// When I click on the CComboBox, the list opens and I can select one of the entries
int index = getControl()->m_otherCombo.GetCurSel();
// Gets the index # of the currently selected CComboBox entry.
// Now I want to copy the text of the currently selected entry somewhere else.
// I have the index but there is no GetString(index) function
// HELP!
|
|
|
|
|
what function would take
int i = 36;
to a char c?
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
|
as suggested, char c = (char)i; is correct but can cause a warning as you could lost some data.
char (which mean signed char ) can contain values from -128 to +127, so any value of your int that is out of bound would be truncated...
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote:
as suggested, char c = (char)i; is correct but can cause a warning as you could lost some data.
char (which mean signed char) can contain values from -128 to +127, so any value of your int that is out of bound would be truncated...
Since an int is 4 times the size of a char, the value will always be truncated! One way to make sure that your value has the same sign bit as the previous int variable is:
c = (i & 0x80000000) ? c | 0x80 : c & 0x7F
Here your test the sign bit i & 0x80000000 . Depending on it is set, you set or remove the sign bit from the char.
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
when you copy a signed integer (either char , short , int or long ), the sign bit is copied too...
so, making this will work without any data loss :
int i = -2;
char c = (char) i;
ASSERT(c == -2);
TOXCCT >>> GEII power [toxcct][VisualCalc]
|
|
|
|
|
toxcct wrote:
when you copy a signed integer (either char, short, int or long), the sign bit is copied too...
I just verified it and shame on me...
Thanks for pointing that out!
Behind every great black man...
... is the police. - Conspiracy brother
Blog[^]
|
|
|
|
|
Hi,
You can Use ltoa function.
//////////////////////////
char ch[256];
ltoa(1234,ch,10);
//////////////////////////
cheers.
|
|
|
|
|
I have a scenario where the size and position of a warning dialog is inconsistent depending on what is done with a modeless dialog that produces it. I have a modeless dialog that has a combo box that fires a kill focus event. If I tab out of the combo box the warning pops as expected centered over the parent modeless dialog centered both horizontally and vertically.
If I highlight the combo box, then click and drag the modeless dialog by its caption bar the kill focus fires as expected. However, the popup warning is now half the size and off to the left of the modeless dialog that produced it. It appears to be centered on the Windows desktop instead of my application dialog.
I have tried it as MessageBox, AfxMessageBox, and as a custom dialog we use for warnings and errors (Just a MessageBox with some custom bells and whistles). All produce the same weird positioning behavior.
Is this a quirk with MFC or Windows?
Is there any way for me to obtain a handle to a pop up dialog, such as AfxMessageBox and position it myself?
Is there some simple reason/solution I am just not seeing?
The app is written in VC++ 6. This is just an annoyance and does not effect the functionality of the app, it is just bugging me, help.
Thanks,
Troy
|
|
|
|
|
Vector but I would to define a foreach statement
std::vector<cworddata*>::iterator itNum = this->_arrWords.begin();
for(; itNum < this->_arrWords.end();itNum++ )
how would I change it to said like so
foreach( myObject obj in this->_arrWords )
I know I would use a define but what else>
please help.
Nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
No, why would you do such an abomination ? Someone has done it as an article already, if you must try to force the issue. Instead, you should use for_each[^], which will allow you to write a function object to define the action you want to take on each object, using C++ instead of trying to hack it into looking like C#.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
sorry I didn't know. But this looks perfect.
I'm glad I asked.
Nick
I'm not an expert yet, but I play one at work. Yeah and here too.
|
|
|
|
|
Ista wrote:
I'm glad I asked.
*grin* Glad to help. Sorry if I seemed rude, I just hate overuse of macros
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi!
How to change the screen cursor with a custom cursor?
I don't want to change the cursor into my main window, but for all applications, wherever the cursor is.
Thks in advance!
Appstmd
http://www.atlence.com
|
|
|
|
|
Atlence wrote:
...but for all applications, wherever the cursor is.
Wouldn't you need SetCapture() for this?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
This function doesn't work, because it changes only the cursor when it is over my application. I want to change the cursor even if the cursor is out of my window application!
Thks in advance!
Appstmd
http://www.atlence.com
|
|
|
|
|
Normally, only the window under the mouse receives WM_SETCURSOR messages. SetCapture() ensures that your window receives WM_SETCURSOR messages without regard to the position of the mouse cursor. That said, is your window receiving WM_SETCURSOR messages even when the mouse is over other windows?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
I call SetCursor () function in my OnInitDialog. But my window only receives WM_SETCURSOR messages when the cursor is over it. Even the controls into my window doesn't receive this message!
Thks in advance!
Appstmd
http://www.atlence.com
|
|
|
|
|
This is just a guess but I think you would call SetCursor() in response to each WM_SETCURSOR received. Doing it once in OnInitDialog() is not sufficient. Have you searched CP and Googled for examples?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi all,
I wrote an SMTP sink based on Microsoft's KB288098 sample ("How to use SMTP Transport Events to Add a Disclaimer to Outgoing SMTP Messages"). I've now successfully modified the sample so my sink gets called when a new email comes in (via IMailTransportSubmission::OnMessageSubmission). I started off creating a small log file in the otherwise empty function--I can confirm my sink gets called.
Now...the function receives a pointer to an IMailMsgProperties. I need to get to any attachment to save it/them locally to the hard drive (as well as retrieve the sender's name and email address). I don't care about getting the subject line or the message body.
I'm afraid my ATL/COM knowledge is severely limited at this point. Given nothing but this interface (IMailMsgProperties), how do I get to these values?
|
|
|
|
|
...what I must add is that I've managed to save the raw content of the email with IMailMsgProperties::CopyContextToFile(), but this gives me the exact same content as the .eml file that gets created under c:\inetpub\mailroot\drop...
Is there anything that will let me retrieve individual properties like sender name and email, and (in particular) the *decoded* version of any MIME or Base64 attachment?
|
|
|
|
|
For future reference (for anyone who might come across this):
The solution to retrieving the subject line, sender, etc lies in GetStringA(). Getting the decoded attachments, if any, lies in IBodyParts/IBodyPart->SaveToFile().
|
|
|
|
|
Hello:
I need to mux two mono audio pcm inputs into one stereo output. Does anyone have a simple DirectShow sample code that I can follow? Many Thanks.
Best Wishes,
Taiwu
|
|
|
|