|
Hi all,
this is the code i am using to open the address book (using MAPI)
USES_CONVERSION;
LPADRLIST lpadrlist = NULL;
LPTSTR rglpszDestTitles[1];
ULONG rgulDestComps[1];
ULONG ulUIParam = 0;
rglpszDestTitles[0] = (LPWSTR) T2A(_T("To"));
rgulDestComps[0] = MAPI_TO;
ADRPARM adrparm;
adrparm.cbABContEntryID = 0;
adrparm.lpABContEntryID = NULL;
adrparm.ulFlags = (DIALOG_MODAL | AB_SELECTONLY | AB_RESOLVE);
adrparm.lpReserved = NULL;
adrparm.ulHelpContext = 0;
adrparm.lpszHelpFileName = NULL;
adrparm.lpfnABSDI = NULL;
adrparm.lpfnDismiss = NULL;
adrparm.lpvDismissContext = NULL;
adrparm.lpszCaption = (LPWSTR) T2A(_T("Select Outlook contacts"));
adrparm.lpszNewEntryTitle = (LPWSTR) T2A(_T("For this dialog"));
adrparm.lpszDestWellsTitle = (LPWSTR) T2A(_T("Selected Recipients:"));
adrparm.cDestFields = 1;
adrparm.nDestFieldFocus = 0;
adrparm.lppszDestTitles = rglpszDestTitles;
adrparm.lpulDestComps = rgulDestComps;
adrparm.lpContRestriction = NULL;
adrparm.lpHierRestriction = NULL;
HRESULT hr = (pAdrBook->Address( &ulUIParam, &adrparm, &lpadrlist));
the address book opens ok, but sometimes, it failed and the hresult is 0x8007000E....
haven't seen any documentation on this error, or what it means....
can any1 help?
thanks
Yaron
Interface basics click here :
http://www.codeproject.com/com/COMBasics.asp
don't forget to vote
|
|
|
|
|
YaronNir wrote: it failed and the hresult is 0x8007000E
If you use the "Error Lookup" tool that comes with VS (Usually listed under the 'Tools' menu) you can find out what the error code means. For 0x8007000E it returns "Not enough storage is available to complete this operation."
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Hello all. I have posted what i have done so far
But that is not what i want it to do. i am a newbie to C++ so it would be great if you help me
What i want to do is to add records to the end of file. that is the records in the file must be like :
David,kurek,Omalley park,566645
Sandra,pegan,John st,5666898
:
:
and so on. the problem is that in this program it does not add the new record to the next line. when i enter the new record it places on the previouse record in the file so u always have one Record being saved on the file
and the next problem is that i want it to receive spaces as well but i cant go it with Get and cin :?
and i hope i can write the rest by knowing what to use from this part :-> cant promise myself
Please dont write something too complex that i dont underestand cause in that case it would be same as not knowing my answer ... i am still in the beginning of course
Thanx and i am waiting
#include<iostream.h>
#include<fstream.h>
#include<conio.h>
#include<stdio.h>
#include<ctype.h>
#include<string.h>
#include<stdlib.h>
#include <io.h>
#include<iomanip.h>
#include<cstdlib.h>
char menu_select();
class stInfo{
public:
char name[80];
char family[80];
char address[80];
char stID[40];
};
// Functions
class functions{
public:
// list of functions
void add_rec();
};
void functions::add_rec(){
stInfo student;
//char *p = student.name;
char ch;
ifstream out_stream("f:rec.dat",ios::out| ios::binary);
out_stream.seekg (0, ios::end);
if(!out_stream) cout<<"cannot open file";
do{
out_stream.get(ch);
if (ch=='$')
{
cout<< "name: ";
cin>>student.name;
cout<<"\n";
cout<< "Family name: ";
cin>>student.family;
cout<<"\n";
cout<< "Address: ";
cin>>student.address,80;
cout<<"\n";
cout<< "student ID: ";
cin>>student.stID;
cout<<"\n";
//out_stream.seekg(eof);
ofstream out_stream("f:rec.dat");
out_stream<
|
|
|
|
|
Some problems I see are:
You're reading from and writing to rec.dat at the same time.
You have more than one variable called out_stream
Each time you write to the file inside the loop, it's replacing the contents of the file with the one record.
|
|
|
|
|
Dear all
Because of one unknown exception my multi threaded program closes sometimes.
I should find the reason of error.
I use the Dr watson capability of windows 2000 for this purpose.
But following instruments will make me more powerfull to find the reason of error.
1. How can I set symbolic name to my threads in Visual C++.
2. How can I set symbolic name to methods and functions in Visual C++.
3. How DbgHelp.dll help me for this purpose.
Regards
Mahdi
|
|
|
|
|
I want to know if a user clicked in an edit box. And I want to know which edit box was clicked. I thought a handler for WM_LBUTTONDOWN might work. Unfortunately, I haven't gotten very far. Here is the direction I am headed. Is there a way to determine which edit box was clicked? Is that info in the message? Does point tell me anything about it? Thanks.
void CExoSliderDlg::OnLButtonDown(UINT nFlags, CPoint point)
{
if(nFlags == MK_LBUTTON)
{
if IDC_EDIT1 was clicked...do something
if IDC_EDIT2 was clicked...do something
if IDC_EDIT3 was clicked...do something
}
CDialog::OnLButtonDown(nFlags, point);
}
-- modified at 1:26 Sunday 29th October, 2006
|
|
|
|
|
Your dialog will not get the WM_LBUTTONDOWN message when a user clicks on an edit control on the dialog. But what you can do is remove the WS_EX_NOPARENTNOTIFY style from the edit controls and then they will send a WM_PARENTNOTIFY message to the dialog when they are clicked on. You can pass the point provided with the WM_PARENTNOTIFY message to the ChildWindowFromPoint() function to find out which control was clicked on.
|
|
|
|
|
How does one remove WS_EX_NOPARENTNOTIFY from an edit control? Is that the same as choosing Notify in the properties?
|
|
|
|
|
What are you going to do when the edit control is clicked on?
Depending on what you're doing, it may be easier to just responde to the EN_SETFOCUS notification
for the edit control.
ON_EN_SETFOCUS( IDC_EDIT1, OnEdit1SetFocus )
...
void OnEdit1SetFocus()
{
Edit control IDC_EDIT1 received focus...do something
}
Just a thought....maybe not specific enough for your needs.
Mark
|
|
|
|
|
I have a quick question. What does "Owner Drawn" mean? I see it all over the place but I have no idea what it means. Does it mean that the graphics are drawn by you?
Any help would be greatly appreciated.
Thanks,
BP
|
|
|
|
|
BlitzPackage wrote: Does it mean that the graphics are drawn by you?
Yes, by handling the erase background and paint events.
Christian Graus - Microsoft MVP - C++
Metal Musings - Rex and my new metal blog
|
|
|
|
|
Thanks. I always wondered what that meant.
|
|
|
|
|
Christian Graus wrote: by handling the erase background
All the win32 controls I can think of, only provides a hook to WM_PAINT. Are you mistaking owner draw for subclassing?
--
Now with chucklelin
|
|
|
|
|
Specifically, it means that the owner window (usuall the parent) draws the item(s).
This allows you to change the appearance of child controls (like list/combo boxes) without subclassing the child controls themselves.
It is also used to draw custom menus (where subclassing isn't possible)
For Common Controls (comboboxex, treeview, list view control etc.), Owner Draw is replaced by Custom Draw, which provides a more granular control over what you (have to) do and what can remain default.
We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
Linkify! || Fold With Us! || sighist
|
|
|
|
|
I'm getting an access violation in my code when I'm creating a dial entry in the default phonebook. I've tried so many different ways to load the data into the operators that are being passed to the RaasSetEntryProperties that I think I've gotten to buried in the problem and need to post it for some help. I'm a rookie, so if there is other portions of my code below, please feel free to school me. I've debugged enough with stop point that I know that the RasSetEntryProperties call is causing the error within the RASAPI. I am calling the funtion from the constructor of a class I'm creating, if that helps.
LPRASENTRY myRasEntry = new RASENTRY;
myRasEntry->dwSize = sizeof(RASENTRY);
lstrcpy(myRasEntry->szLocalPhoneNumber, "6479008" );
lstrcpy(myRasEntry->szDeviceName, TheDeviceName);
lstrcpy(myRasEntry->szDeviceType, "RASDT_Modem");
myRasEntry->dwFramingProtocol = RASFP_Ppp;
myRasEntry->dwfNetProtocols = RASNP_Ip;
myRasEntry->dwfOptions = 0;
myRasEntry->dwfOptions = RASEO_IpHeaderCompression | RASEO_ModemLights | RASEO_SwCompression;
myRasEntry->dwType = RASET_Phone;
//Create Phonebook entry called "Remote"
//DWORD dwAnotherBufferSize = sizeof(RASENTRY);
DWORD dwAnotherBufferSize = 0;
char ConnectionName[7] = "Remote";
(void) RasGetEntryProperties(NULL, NULL, NULL, &dwAnotherBufferSize, NULL, NULL);
dwErr = RasSetEntryProperties(NULL, &ConnectionName[7], myRasEntry, dwAnotherBufferSize, NULL, 0);
Thank you,
Chuck Foster
|
|
|
|
|
cfo5ter wrote: lstrcpy(myRasEntry->szDeviceType, "RASDT_Modem");
RASDT_Modem is a macro defined in Ras.h #define RASDT_Modem TEXT("modem") so do not put it in quotes.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
Also I noticed that you are not setting all the RASENTRY variables that you are not using to zero. They will have random values in them and that could also be the cause of your problem.
LPRASENTRY myRasEntry = new RASENTRY;
memset (myRasEntry, 0, sizeof(RASENTRY);
...
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
That was the ticket. Thank you so much. Lesson learned. memset enterred into my mind for use everywhere. Oddly it does not create an entry titled "Remote" but I will figure this out.
By the way, I changed the string problem as well.
Thanks again,
Chuck
|
|
|
|
|
cfo5ter wrote: Oddly it does not create an entry titled "Remote" but I will figure this out.
dwErr = RasSetEntryProperties(NULL, &ConnectionName[7],
Why are you passing in the address of the terminating NULL when you want the address of the string?
dwErr = RasSetEntryProperties(NULL, ConnectionName,
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
It did want the address of the string. The 7 index was a rookie mistake of mine. The final line that created the entry I wanted with the name I wanted was:
dwErr = RasSetEntryProperties(NULL, &ConnectionName[0],
I'm good to go,
Thank you,
Chuck
|
|
|
|
|
In C/C++ using the name of an array, ConnectionName in this case, is the same as using the address of it's first element, &ConnectionName[0]. So the standard way is to just use the array name.
You may be right I may be crazy -- Billy Joel --
Within you lies the power for good, use it!!!
|
|
|
|
|
hey all,
So I am reading a file into a char buffer[] and need to combine two of the values in the buffer into an int value. The Documentation for my device says that values 5 and 6 in the array are one value with MSB first. How can I put these values into an int?
thanks
- legit
|
|
|
|
|
lets assume that u have a buffer of type (char *) called charbuffer
you can convert it like this (I havent tested it but it should work):
short *intbuffer = (short*)charbuffer;
now every consecutive two chars in charbuffer will be treated as 1 short (16-bit) integer in intbuffer.
regards
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|
|
Mohammad A Gdeisat wrote: short *intbuffer = (short*)charbuffer;
now every consecutive two chars in charbuffer will be treated as 1 short (16-bit) integer in intbuffer.
FYI that won't work on an Intel x86 machine in his case because the most significant byte is
FIRST in the char array.
Mark
|
|
|
|
|
then u can use masking and shifting to swap between hi-order and low-order bytes.
Regards,
Mohammad
And ever has it been that love knows not its own depth until the hour of separation
|
|
|
|