|
As already said, spin controls send WM_H/VSCROLL messages.
Sliders = Trackbar controls send TB_LINEUP etc.
Look in the Platform SDK under User Interface Services > Windows Common Controls.
OK?
|
|
|
|
|
A spinbutton control sends UDN_DELTAPOS to its parent window when it's spun. lParam is the address of "an NMUPDOWN structure that contains information about the position change" (to quote MSDN).
Sliders send WM_HSCROLL and WM_VSCROLL messages.
|
|
|
|
|
How can I receive those messages? ClassWizard doesn't show them. Should I add them to the message map manually?
|
|
|
|
|
You can get ClassWizard to add handlers for UDN_DELTAPOS messages , but I can't remember how I think you just select the spinner control and add a message handler for it. Have a look at my article at http://www.codeproject.com/dialog/CRHChildDialog.asp . Although it's not specifically about spinner controls, it does use them. So if you search the source files for DELTAPOS you'll see what happens.
|
|
|
|
|
DaFrawg wrote:
ClassWizard doesn't show them
Right-click on the Dialog class that contains the spin control. In the window that appears, select the IDC of the control you want to receive notifications about, in the "Class or object to handle" listbox.
UDN_DELTAPOS should appear, along with NM_OUTOFMEMORY, in the "New Windows messages/events" listbox on the left hand side.
There you go!
Sliders receive both the WM_HSCROLL and WM_VSCROLL messages. You can either handle them in the control itself, or through the parent dialog.
The kindest thing you can do for a stupid person, and for the gene pool, is to let him expire of his own dumb choices.
[Roger Wright on stupid people]
We're like private member functions
[John Theal on R&D]
We're figuring out the parent thing as we go though. Kinda like setting up Linux for the first time ya' know...
[Nitron]
|
|
|
|
|
hi,
my application is using mysql as backend. for database connection i am using mysql files from mysql site.i try to build exe in release mode. i got linker error "unresolved external symbol" for mysql class member. in debug mode i got warning only.
thanks in advance.
|
|
|
|
|
Have you added a .LIB file to the build, and only added it in the debug build?
Steve S
|
|
|
|
|
Hi,
Thanks For Ur Help.
Murali.M
|
|
|
|
|
Hi,
I want to create 4 radio buttons of which two form one group and other two form another group on a dialog.I should be able to select one button from each group(i..e two buttons in total).How can I do this?
Karteek
|
|
|
|
|
You need to set the windows style WS_GROUP on the first radio button in each group, and make sure that the tab order has each pair together.
Steve S
|
|
|
|
|
Lay out your dialog.
Select every control on the dialog.
Set the WS_GROUP flag.
Set the tab order so that the buttons in each grouping follow each other.
Select all the buttons in one group, except the first.
Clear their WS_GROUP style.
Repeat for second grouping.
Test, Enjoy, read up on WS_GROUP.
Iain.
|
|
|
|
|
Hallo!
I have to export analysis-data from a MFC-application to an Excel-Sheet. I use Excel 2000 (Version 9) and have created several classes to make data-exchange within C++. To write the data into the sheet is not the problem, I´ve got the problem to send an Excel-formula from the application to the Excel-Sheet in several ranges. I tried to send a simple formula with the code below. The result ist that the string appears in the cells in Excel but isn´t executed automatically. I tried other ways, too but nothing happened or errors were given. Has someone experience in sending and executing formulas from MFC/C++ to an Excel-sheet? I would be very happy! Thank you.
VARIANT vVar;
long index[2];
DWORD numFields[2];
COleSafeArray saCell;
m_oBooks=m_oExcel.get_Workbooks();
m_oBook=m_oBooks.get_Item(COleVariant((short)1));
m_oSheets=m_oBook.get_Worksheets();
m_oSheet=m_oSheets.get_Item(COleVariant((short)1));
...
m_oRange=m_oSheet.get_Range(COleVariant("A3"),COleVariant("D3"));
m_oRange=m_oRange. get_Resize(COleVariant((short)1),COleVariant((shor
t)(4)));
numFields[0]=1;
numFields[1]=4;
saCell.Create(VT_BSTR,2,numFields);
index[0]=0;
index[1]=0;
vVar.vt=VT_BSTR;
csStr.Format("=WENN(A2=0;1;99)");
vVar.bstrVal=csStr.AllocSysString();
saCell.PutElement(index,vVar.bstrVal);
m_oRange.put_Formula(COleVariant(saCell));
|
|
|
|
|
When I'm using a class derived from CSocket in a class derived from CWinThread
the CMyClass::OnReceive(nErrorCode); does not triger.
Can someone explain the reason in some other projects it trigers.
Thank you in andvance
Seval YILMAZ
|
|
|
|
|
|
Hi,
I just want to know how to change the font size and color of the fonts in an edit box.
Thanks
Deepak Samuel
|
|
|
|
|
WM_SETFONT, WM_CTLCOLOREDIT
Steve S
|
|
|
|
|
Hello,
I want to save a Message(such as an EMail or maybe it must be an EMail) in the Inbox(or in a folder that is under the inbox) of Outlook whithout sending it as an EMail.
I have to do it in C++.
I have created wrapper-classes by using the typlibraries from outlook 2000...
Please send me help.
Thanks a lot,
JohnX
|
|
|
|
|
Since you've created a wrapping, I'm assuming you have looked through what's available. Basically, just create a new item of the appropriate type (any type of item, be it standard or custom with the correct form associated). Get a reference to the Inbox folder (several ways are possible using the namespaces). Then just add the item. This is possible with any folder.
I don't have any code samples since I haven't done this in a long time but the idea is still the same and it works. The Inbox is still just a folder, so just add the item to it.
-----BEGIN GEEK CODE BLOCK-----
Version: 3.21
GCS/G/MU d- s: a- C++++ UL@ P++(+++) L+(--) E--- W+++ N++ o+ K? w++++ O- M(+) V? PS-- PE Y++ PGP++ t++@ 5 X+++ R+@ tv+ b(-)>b++ DI++++ D+ G e++>+++ h---* r+++ y+++
-----END GEEK CODE BLOCK-----
|
|
|
|
|
To create an new item is not the problem.
My problem is who can I get a reference to the inbox folder.
There are no documentations ! How can I do this ?
|
|
|
|
|
Using Outlook's type library:
COleVariant vtOptional((long) DISP_E_PARAMNOTFOUND, VT_ERROR),
vtTrue((short) TRUE);
_Application app;
_NameSpace ns;
MAPIFolder folderInbox;
if (app.CreateDispatch("Outlook.Application") == TRUE)
{
ns = app.GetNamespace("MAPI");
ns.Logon(vtOptional, vtOptional, vtOptional, vtTrue);
folderInbox = ns.GetDefaultFolder(6);
}
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
the following is a c++ program written to access the mailbox of the defaulkt mail client and read the mails ...
i experimented te code only with outlook...as that is only configured in my machine..the code works only iff outlook window is opened ..also it displays only 1 read mail for 1 execution of thios code...i want to dispaly all unread mails at a time when i run this program once..what are hte necessary changes to be made in the program..can someone plzz kindly help me in this!
#include<stdio.h>
#include<stdlib.h>
#include<iostream.h>
#include<conio.h>
#include<windows.h>
#include<mapi.h>
#include<mapidefs.h>
#include<winbase.h>
//assumption::character interface being used.
//the Simple MAPI functions for reading messages can't
//log on implicitly and require an explicit session handle.
/*the client application defines needed variables and
logs on to get a session handle */
/*ULONG ReadNextUnreadMsg(void);*/
ULONG ReadNextUnreadMsg()
{
ULONG err;
CHAR rgchMsgID[513]; // Message IDs should be >= 512 CHARs + a null.
MapiMessage *lpMessage; // Used to get a message back from MAPIReadmail
ULONG i; // Ubiquitous loop counter.
int totalLength;
int length;
int LINE_WIDTH = 0;
// Number of characters printed on a line.
LHANDLE m_lhSession; // Need a session for MAPIFindNext.
HINSTANCE hlibMAPI = LoadLibrary ( "MAPI32.DLL" );
LPMAPILOGON m_MAPILogon = (LPMAPILOGON)GetProcAddress(hlibMAPI,
"MAPILogon");
LPMAPIFINDNEXT m_MAPIFindNext = (LPMAPIFINDNEXT) GetProcAddress (hlibMAPI, "MAPIFindNext");
LPMAPIREADMAIL m_MAPIReadMail = (LPMAPIREADMAIL) GetProcAddress (hlibMAPI, "MAPIReadMail");
LPMAPIFREEBUFFER m_MAPIFreeBuffer = (LPMAPIFREEBUFFER) GetProcAddress (hlibMAPI, "MAPIFreeBuffer");
LPMAPILOGOFF m_MAPILogoff = (LPMAPILOGOFF) GetProcAddress (hlibMAPI, "MAPILogoff");
err =m_MAPILogon(0L, // ulUIParam; 0 always valid.
"Microsoft Outlook Internet Settings",// profile name to use when logging on
NULL, // No password needed.
0L, // Use shared session.
0L, // Reserved; must be 0.
&m_lhSession); // Session handle.
if (err != SUCCESS_SUCCESS) // Make sure MAPILogon succeeded.
{
printf("Error: could not log on\r\n");
return(err);
}
//next..the client searches for the first unread message in the
//default folder in the store - probably the user's Inbox.
//Since there might not be any unread messages in the folder,
//the client first tests the return value from the MAPIFindNext
//function against MAPI_E_NO_MESSAGES before checking against
//SUCCESS_SUCCESS. If the call is successful, the client will have
///a valid message identifier to use to retrieve the first
// unread message
// find the first unread message
err = m_MAPIFindNext(m_lhSession, // explicit session required
0L, // always valid ulUIParam
NULL, // NULL specifies interpersonal messages
NULL, // seed message ID; NULL=get first message
MAPI_LONG_MSGID | // needed for 512 byte rgchMsgID.
MAPI_UNREAD_ONLY, // only get unread messages.
0L, // reserved; must be 0
rgchMsgID);// buffer to get back a message ID.
if (err == MAPI_E_NO_MESSAGES) // make sure a message was found
{
printf("No unread messages.\r\n");
return(err);
}
if (err != SUCCESS_SUCCESS) // make sure MAPIFindNext didn't fail
{
printf("Error while searching for messages\r\n");
return(err);
}
//The client can now be sure it is safe to retrieve the message.
//However, it is a good idea to check the return value from
//the MAPIReadMail function. If the call fails, the memory pointed
//to by the client's lpMessage pointer will not be accessible by
//the client. The client should not try to display a message at
//that location. Note that this example sets the
//MAPI_SUPPRESS_ATTACH flag so the returned message will not
//have any attachments in it and Simple MAPI will not create any
//temporary files for them.
// retrieve the message
err = m_MAPIReadMail(m_lhSession, // Explicit session required.
0L, // Always valid ulUIParam.
rgchMsgID, // The message found by MAPIFindNext.
MAPI_SUPPRESS_ATTACH, // TO DO: handle attachments.
0L, // Reserved; must be 0.
&lpMessage); // Location of the returned message.
if(err != SUCCESS_SUCCESS) // Make sure MAPIReadMail succeeded.
{
printf("Error retrieving message %s\r\n",rgchMsgID);
return(err);
}
/*Now, the client can display the message. As expected,
it begins by displaying the addressing information attached
to the message before displaying the subject line and message text.
When displaying the addressing information, it is best if you
can display friendly names. However, since friendly names are
not always available, you must verify that each recipient
structure's lpszName member points to a valid string,
and that the string is not a null string.
Display the sender's name or address; use the friendly name
if it is present.*/
if((lpMessage->lpOriginator->lpszName != NULL) &&
lpMessage->lpOriginator->lpszName[0] != '\0')
printf("From: %s\r\n",lpMessage->lpOriginator->lpszName);
else
printf("From: %s\r\n",lpMessage->lpOriginator->lpszAddress);
/*Displaying the recipients' addresses is complicated by the
need to avoid breaking a recipient's name or address across
two lines. This code can be further improved by differentiating
between recipients based on their ulRecipClass members so that
they can be properly displayed as To, CC, or BCC recipients.
As this code shows, handling recipient data can be the most
complex part of reading a message.// Display the recipients'
names or addresses. To Do: enhance
this code to separate the recipients into lists of MAPI_TO,
MAPI_CC, and MAPI_BCC recipients for separate display.*/
if(lpMessage->nRecipCount == 0)
printf("Warning: no recipients present for this message\r\n");
else
for(i = 0; i<lpmessage->nRecipCount; i++) // For each recipient...
{
/* This code uses lstrlen to calculate the length of strings and
// to validate that the strings have some content, since the
// length is needed anyway. This avoids the more verbose checks
// as were done for lpMessage->lpOriginator->lpszName earlier.
// lpszT references a name or address; simplifies later code.
// length is the length of the name or address*/
LPSTR lpszT;
lpszT = lpMessage->lpRecips->lpszName;
length = lstrlen(lpszT);
if(i == 0) // First recipient; need to do some initialization.
{
printf("Recipients:");
totalLength = 11; // since strlen("Recipients:") = 11.
}
// Decide whether to use the friendly name or the address.
if(length == 0)
length = lstrlen(lpszT=lpMessage->lpRecips->lpszAddress);
// Verify that the line has room for this name or address. If
// not, print a CR LF pair to go to the next line.
if(totalLength + length + 1 > LINE_WIDTH)
{
printf("\r\n");
totalLength = 0;
}
printf(" %s",lpszT); // Finally, print the name or address.
totalLength += length + 1;// Maintain the line length.
// If there are more addresses, separate them with semicolons.
if(i < (lpMessage->nRecipCount - 1))
{
printf(";");
totalLength++;
}
}
//Now, the client displays the subject line and message text if
//they are present. Note that the message text can be printed
//with a simple call to the C library function printf. Since
//the message was read with the MAPI_SUPPRESS_ATTACH flag set,
//there will be no attachments in it.// Display the subject
//and message body. Not printing anything
//for the subject is fine, but something should always be
//printed for the message body since it is the last thing
//that this function displays.
if(lpMessage->lpszSubject != NULL && // Standard validity check
lpMessage->lpszSubject[0] != '\0')
printf("Subject: %s\r\n",lpMessage->lpszSubject);
if(lpMessage->lpszNoteText != NULL && // Standard validity check
lpMessage->lpszNoteText[0] != '\0')
printf("Message Text:\r\n%s",lpMessage->lpszNoteText);
else
printf("No message text.\r\n");
//Finally, the client releases the memory that the MAPIReadMail
//function allocated for the message, closes the session,
//and returns a successful return value.
m_MAPIFreeBuffer(lpMessage);
m_MAPILogoff(m_lhSession, // The session.
0L, // 0 always valid for ulUIParam.
0L, // No logoff flags.
0L); // Reserved; must be 0.
return SUCCESS_SUCCESS; // Inform the caller of our success.
} // End of ReadNextUnreadMsg
void main()
{
HINSTANCE hlibMAPI = LoadLibrary ( "MAPI32.DLL" );
ReadNextUnreadMsg();
}
ranjani
|
|
|
|
|
ranjjj wrote:
the code works only iff outlook window is opened
Take a look at MAPILogon() . Its parameters govern whether to use an existing session, or create a new one.
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
how to create a new one..
i tried doing it..
but didn't work out..
after reading the message,
the message is deleted from the inbox!
ranjani
|
|
|
|
|
ranjjj wrote:
how to create a new one..
MAPILogon(0, NULL, NULL, MAPI_LOGON_UI, 0, &m_lhSession);
Five birds are sitting on a fence.
Three of them decide to fly off.
How many are left?
|
|
|
|
|
i don't want a dialog box to be displayed..
logon_ui does that right??
and...
the only problem now is..
it doesn't work out if the outlook window is not opened..
how to solve it..i tried using new sesion also..anddd..logon ui also..
it doesn't work!
ranjani
|
|
|
|
|