|
Thanks a lot its working now
harsha
|
|
|
|
|
To use managed c++, you need to choose option Project-->Properties-->configuration properties-->c/c++-->General-->commaon language runtime support(/clr) .
|
|
|
|
|
harsh_2961 wrote: using namespace Microsoft::Win32;
better ask you CLR based question in ManagedForum[^]
|
|
|
|
|
Thanks a lot its working now
harsha
|
|
|
|
|
You said better ask on the ManagedForum but he said thanks its working now
|
|
|
|
|
WhiteSky wrote: he said thanks its working no
he he he
|
|
|
|
|
Hello friends!
I want to get body of new arrived mail. I'm the beginner. I had tried to get the same by using OnNewMail event. I'm not able to get the body of new mail. But it prompts me whenever new mail arrives.
Here is my code -
void __stdcall CAddin::OnNewMail()
{
MessageBox(NULL,"New Mail Arrived","Success",0);
CComQIPtr<outlook::_application>Application;
CComPtr<outlook::_explorer>Explorer;
Application =m_Application;
Explorer =Application->ActiveExplorer();
CComQIPtr<outlook ::_inspector=""> spInspector;
IDispatch *CurrentItem;
HRESULT hr1 = spInspector->get_CurrentItem (&CurrentItem);
if (FAILED (hr1))
MessageBox(NULL,"get_CurrentItem","ERROR",0);
CComPtr<outlook::_mailitem> MailItem;
MailItem=reinterpret_cast<outlook::_mailitem*>(CurrentItem);
BSTR strbodyofmail;
MailItem->get_Body (&strbodyofmail);
MessageBox (NULL, _com_util::ConvertBSTRToString(strbodyofmail),"Body of mail",0);
}
Is there any another way to get the body of new arrived mail?
I appreciate your immediate help.
Thanks & regards,
Shashi
Shashikant Shinde
|
|
|
|
|
Sorry about that ... I removed the message, I'll mail the code to Shashi.
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r My Blog: ^_^
|
|
|
|
|
|
Shashi,
Could you plz update your email address in your profile so that I can mail the code to you, it's vary long and it's breaking the forum. And please let me know when you have done it.
Thanx
Regards,
-- modified at 2:32 Friday 2nd March, 2007
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r My Blog: ^_^
|
|
|
|
|
Thank U very much!
Right now I'm working on a project which requires parsing of new mail. As per my knowledge, I had done what I wrote. My parser is ready, but coz of this problem I've trouble to go on.
So I request you to please update me on my email id - shashi.shinde81@gmail.com.
Thanks again!
I'm regerly waitimg for ur reply.
Shashi
Shashikant Shinde
|
|
|
|
|
Mail sent ...
The only programmers that are better than C programmers are those who code in 1's and 0's.....
Programm3r My Blog: ^_^
|
|
|
|
|
Thank U, Richard very much. I will check it.
Shashikant Shinde
|
|
|
|
|
|
Dear Sir,
Thanks for ur help.
But this code reads all the mails exist in Inbox.
But I want to get the body of newly arrived mail which is unread only.
I'm getting the message whenever new mail arrives using OnNewMail event. But not able to get body or other details of the same mail item when it arrives.
I've to do all this in outlook addin.
Is there any other solution for the same, or is it possible in C / C++?
Thanks & regards,
Shashi
Shashikant Shinde
|
|
|
|
|
The following code is simple console code. Nothing visual or rocket science about it.
Amazingly, the code prints size of A as 16 and size of B as 12. Char is 1 byte, int is
4 bytes. So both structs should be 10bytes each. Can someone please help me understand
why this is not the case? If you don't believe me, run it and see for yourself.
#include <iostream>
using namespace std;
struct
{
char c1;
int i1;
char c2;
int i2;
}a;
struct
{
int i1;
int i2;
char c1;
char c2;
}b;
int main()
{
cout<<"sizeof struct A " <<sizeof(a);
cout<<"sizeof struct B " <<sizeof(b);
getchar();
return(0);
}
Thanks in advance.
ASP - AJAX is SEXY. PERIOD.
|
|
|
|
|
In vc++ there is something call structure memeber alignment . Suppose the member alignment value is 4, Then the structure will be having a allocation size of 4 byte. Let me tell you how the struct a become 16 in your case.
first element is char c1. Since the member alignment value is 4, 4 byte will be allocated. So a remaining 3.
Second member i1 is int. Int takes 4 byte. So it will not fit in the previous 3 bytes. Hence it will allocate a new 4 bytes
and so on.. The 16 bytes is occupied as follows
1 - c1
2 - Free
3 - Free
4 - Free
5 - i1
6 - i1
7 - i1
8 - i1
9 - c2
10 - Free
11 - Free
12 - Free
13 - i2
14 - i2
15 - i2
16 - i2
you can change the member alignment setting of the project by changing the /Zp option in the compile setting ( project menu-> setting->C++-> Take Code egenration in the category menu. Now u can find a combobox "Struct member alignment")
You can also change the settings as by putting the Pragma Directives.
#pragma pack( push , 1 )//change the member alignment value to 1<br />
struct{<br />
char c1; <br />
int i1;<br />
char c2;<br />
int i2;}a;<br />
#pragma pack(pop)
-- modified at 1:14 Friday 2nd March, 2007
nave
|
|
|
|
|
Each structures member is aligned by default to a 4 byte offset within the structure.
Therefore, padding is required to adjust the offsets of each member.
In the a struct, c1 is offset 0, i1 is at offset 4, c2 is at offset 8, and i2 is at offset 12.
In the b struct, i1 is offset 0, i2 is at offset 4, c1 is at offset 8, and c2 is at offset 12, with one byte padding tacked on the end to make the total size a multiple of 4.
See "packing structures" in online help for details.
Mark
"Great job, team. Head back to base for debriefing and cocktails."
(Spottswoode "Team America")
|
|
|
|
|
Dear all,
Any body know where can I find the header file "bios.h and "perce.h" in Win 32. Thank for yuor help
|
|
|
|
|
|
I believe that the ‘bios.h’ header was Borlands equivalent of Microsofts C ‘dos.h’ header; although I think other venders provided a header with the same name. The header ‘perce.h’ sounds like a custom header (created by original developer). You need to look at the code to see where bios/dos (low level system calls) are being made, as some of these calls will no longer work and will generate a system error on modern OSs, due to security issues. Look at the code an try to figure out which functions are making BIOS calls like that require code like reg.ax = 1 , as you will have to find a way to replace those functions with an equivalent one.
Good Luck!
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
Dear all,
Now I'm writing a small program to communicate via RS232 with 3964 protocol, however Idon't understand why I cannot compile this source code. Any body please help me solve this problem.
<br />
<br />
#include <stdio.h><br />
#include <conio.h><br />
#include <io.h><br />
#include <fcntl.h><br />
#include <string.h><br />
#include <dos.h><br />
#include <bios.h><br />
#include "perce.h"<br />
<br />
#define ESC 27<br />
<br />
void interrupt(*oldvect_ser)(); <br />
extern void interrupt int_sio(); <br />
extern void restore_8250 (void); <br />
extern void init_8250 (void);<br />
extern void send_tele (char *, short);<br />
extern WORD state, receive_counter, protocol_error;<br />
extern BYTE receive_buffer[];<br />
<br />
BYTE choice,sio_eoi; <br />
BOOL receive, autosend; <br />
WORD Com_basis,len;<br />
BYTE send_buffer[BUFFER_MAX]; <br />
BYTE tmp_buffer[BUFFER_MAX]; <br />
BYTE *mode,*port;<br />
<br />
<br />
void warte (void)<br />
{<br />
long i;<br />
<br />
for (i=0;i<500000;i++) i = i;<br />
}<br />
<br />
void menue (void)<br />
{<br />
clrscr();<br />
printf ("\n\n");<br />
printf ("Final Version of KUKAVISION.EXE \n");<br />
printf ("Serial device with 3964R protocol mod. P.S. 08.08.03\n\n");<br />
printf ("[1] send teststring [4] COM 1 \n");<br />
printf ("[2] getNum [5] COM 2 \n");<br />
printf ("[3] getDat [6] reset protocol\n");<br />
printf (" [ESC] quit\n");<br />
printf ("Aktueller Port: %s\n",port);<br />
printf ("Mode : %s\n", mode);<br />
printf ("Number of elements: %d\n",numEl);<br />
printf ("Element index: %d\n",elementIndex);<br />
printf ("Element Data: %s\n---------\n", &send_buffer[0]);<br />
}<br />
<br />
void send_telegram (BYTE *buffer)<br />
{<br />
if ((len = strlen (buffer)) > 0)<br />
{<br />
send_tele (buffer, len);<br />
warte ();<br />
warte ();<br />
warte ();<br />
if (state == E1)<br />
{<br />
state = RUHE;<br />
protocol_error=2;<br />
}<br />
else protocol_error=6;<br />
}<br />
<br />
<br />
<br />
void monitoring (void)<br />
{<br />
short i;<br />
printf("-> : ");<br />
for (i=0;i<receive_counter;i++)<br />
{<br />
if(isprint(receive_buffer[i])) printf("%c", receive_buffer[i]);<br />
else printf("0x%X", receive_buffer[i]);<br />
} <br />
printf("\n");<br />
receive = FALSE;<br />
}<br />
<br />
<br />
void main ()<br />
{<br />
int sio_int_nr,i;<br />
int j;
char *fields;<br />
BOOL quit = FALSE;<br />
Com_basis = 0x3F8 ; <br />
sio_int_nr = 0xC; <br />
sio_eoi=0x<br />
port= "COM 2";<br />
oldvect_ser = getvect(sio_int_nr);<br />
setvect(sio_int_nr,int_sio);<br />
state = RUHE;<br />
choice = protocol_error = 0;<br />
receive = autosend = FALSE;<br />
mode = "ready";<br />
elementIndex=0;<br />
init_8250 ();<br />
menue ();<br />
do<br />
{<br />
if (bioskey(1))<br />
{<br />
choice = bioskey(0);<br />
switch (choice)<br />
{<br />
case ESC: <br />
quit = TRUE;<br />
break;<br />
case '1': <br />
send_telegram (&send_buffer[0]);<br />
break;<br />
case '2': <br />
strcpy(&receive_buffer[0],"getNum");<br />
receive=TRUE;<br />
mode = "getNum";<br />
menue ();<br />
break;<br />
case '3': <br />
strcpy(&receive_buffer[0],"getDat");<br />
receive=TRUE;<br />
mode = "getDat";<br />
<br />
menue ();<br />
break;<br />
case '4': <br />
Com_basis=0x3F8;<br />
sio_int_nr = 0xC; <br />
port="COM 1";<br />
menue ();<br />
break;<br />
case '5': <br />
Com_basis=0x2F8;<br />
sio_int_nr = 0xB;<br />
port="COM 2";<br />
menue ();<br />
break;<br />
case '6': <br />
state = RUHE;<br />
break;<br />
default:;<br />
}<br />
choice = 0;<br />
}<br />
if (receive)<br />
{<br />
monitoring (); <br />
if (strcmp("getNum",&receive_buffer[0]) == 0) <br />
{<br />
elementIndex=0;<br />
printf("getNum erhalten\n");<br />
if( imaqReadFile() == -1)<br />
printf("Fehler beim Lesen der Datei\n");<br />
else <br />
{<br />
numEl = imaqGetNbElements(); <br />
menue();<br />
elementIndex=1;<br />
}<br />
}<br />
if (strcmp("getDat",&receive_buffer[0]) == 0) {<br />
if(elementIndex > numEl){<br />
printf("Keine Daten mehr vorhanden\n");<br />
for (i=0;i<BUFFER_MAX;i++)<br />
sprintf(&send_buffer[i],"\0"); <br />
imaqClose();<br />
}<br />
else <br />
{<br />
dataErr = imaqGetData(elementIndex, send_buffer);<br />
if (dataErr==0)<br />
send_telegram (&send_buffer[0]); <br />
menue();<br />
elementIndex++;<br />
}<br />
}<br />
if (protocol_error)<br />
{<br />
switch (protocol_error)<br />
{<br />
case 1:<br />
printf("\nCRC-Error (NAK->) !!\n");<br />
break;<br />
case 2:<br />
printf("\nno response (DLE) !!\n");<br />
break;<br />
case 3:<br />
printf("\nno send quitt (DLE) !!\n");<br />
break;<br />
case 4:<br />
printf("\nReceive buffer overflow !!\n");<br />
break;<br />
case 5:<br />
printf("\nrepeating telegram (->NAK) !!\n");<br />
break;<br />
case 6:<br />
printf("\nno teststring defined\n");<br />
break;<br />
case 7:<br />
printf("\nSTX\n");<br />
break;<br />
default:;<br />
}<br />
protocol_error = 0;<br />
}<br />
} while (!quit);<br />
restore_8250 ();<br />
setvect(sio_int_nr,oldvect_ser);<br />
}<br />
|
|
|
|
|
It would be nice that you tell us at least what the exact error message is and to paste only relevant code. I'm sure if you did that, you would already have an answer (I seriously doubt that anybody wants to go to your complete source and hunt for your problem).
Man, the error messages supplied by your compiler ARE usefull.
|
|
|
|
|
Hi guys!
Has anyone tried to port a desktop application in Visual C++ to
embedded/DSP? What should be considered or steps to take in
porting?
|
|
|
|
|
apoc83 wrote: a desktop application in Visual C++
What does that mean exactly ? Is it a console application, a Win32 app, does it use MFC ? ...
apoc83 wrote: embedded/DSP?
Is there even an OS running on your DSP ? What compiler are you using ? ...
Your question is too vague to be able to give you a correct answer.
|
|
|
|