Click here to Skip to main content
15,890,882 members
Home / Discussions / C#
   

C#

 
GeneralRe: string Pin
simworld23-Jan-08 5:19
simworld23-Jan-08 5:19 
QuestionHow to send parameters to a running application? Pin
Gene Arnold22-Jan-08 8:19
Gene Arnold22-Jan-08 8:19 
AnswerRe: How to send parameters to a running application? Pin
Gene Arnold22-Jan-08 8:32
Gene Arnold22-Jan-08 8:32 
Generalget a BSTR from a vc++ dll to a c# string Pin
Calvin Streeting22-Jan-08 7:45
Calvin Streeting22-Jan-08 7:45 
GeneralRe: get a BSTR from a vc++ dll to a c# string Pin
led mike22-Jan-08 8:15
led mike22-Jan-08 8:15 
GeneralRe: get a BSTR from a vc++ dll to a c# string Pin
Calvin Streeting22-Jan-08 8:36
Calvin Streeting22-Jan-08 8:36 
GeneralRe: get a BSTR from a vc++ dll to a c# string Pin
led mike22-Jan-08 11:34
led mike22-Jan-08 11:34 
GeneralRe: get a BSTR from a vc++ dll to a c# string Pin
Calvin Streeting22-Jan-08 13:45
Calvin Streeting22-Jan-08 13:45 
Hi... I think i got it now..

here is a more complete code...

vc++ dll

//----------------------------------------------
//header
SSFILEDLL_API BSTR __stdcall GetEmailSubject();
SSFILEDLL_API BSTR __stdcall GetEmailData(char *szString);


//----------------------------------------------
//code
SSFILEDLL_API BSTR __stdcall GetEmailSubject(){
return GetEmailData("__substg1.0_0037001E");

}
SSFILEDLL_API BSTR __stdcall GetEmailData(char *szString){
BSTR Message;
COleStreamFile osf;
if (myCSS.OpenStream(szString, osf)) {
DWORD dwLength = osf.GetLength();
LPSTR buffer=(LPSTR)_alloca(dwLength+1);
osf.Read(buffer,dwLength);
buffer[dwLength]='\0';
Message = SysAllocStringByteLen(buffer, lstrlen(buffer));
return Message;
}
else {
char *buff = "False";
Message = SysAllocStringByteLen(buff, lstrlen(buff));
return Message;
}
}

and then in c#
I used

//----------------------------------------------
//header

[DllImport("ssFileDLL.dll")]
private static extern IntPtr GetEmailSubject();


IntPtr ptr = GetEmailSubject();
string s = Marshal.PtrToStringAnsi(ptr);
if (s!="False")
pvarData="" + s;
else
pvarData="";

and that seems to work... the code is a two part affair.. the first vc++ dll deals with outlook msg files parsing them and getting the mapi properties...

the second part is a explorer shell extention that shows the mapi properties for folders that contain archived (saved out of outlook) folders containing msg files...

after a bit of frigging around i now have form,to,subject,attachment count, and i am working on the sent/recived date... that are returned as a FILETIME

so onward i march and many thanks for your help...

calvin

ps any comments on code are always apreciated as i am new to the language (vb is far mote forgiving than c,c#,c++ etc...)
GeneralRe: get a BSTR from a vc++ dll to a c# string Pin
led mike23-Jan-08 4:46
led mike23-Jan-08 4:46 
GeneralRe: get a BSTR from a vc++ dll to a c# string Pin
Calvin Streeting23-Jan-08 7:44
Calvin Streeting23-Jan-08 7:44 
GeneralRe: get a BSTR from a vc++ dll to a c# string Pin
led mike23-Jan-08 8:17
led mike23-Jan-08 8:17 
Questionwhat is the difference between delegate and events Pin
netJP12L22-Jan-08 7:42
netJP12L22-Jan-08 7:42 
AnswerRe: what is the difference between delegate and events Pin
PIEBALDconsult22-Jan-08 8:00
mvePIEBALDconsult22-Jan-08 8:00 
Generalmy app icon lost, in setup application in vs2005. Pin
hdv21222-Jan-08 5:59
hdv21222-Jan-08 5:59 
GeneralRe: my app icon lost, in setup application in vs2005. Pin
Skippums22-Jan-08 7:06
Skippums22-Jan-08 7:06 
GeneralRe: my app icon lost, in setup application in vs2005. Pin
hdv21222-Jan-08 7:20
hdv21222-Jan-08 7:20 
GeneralRe: my app icon lost, in setup application in vs2005. Pin
Skippums22-Jan-08 7:27
Skippums22-Jan-08 7:27 
GeneralRe: my app icon lost, in setup application in vs2005. Pin
hdv21222-Jan-08 7:30
hdv21222-Jan-08 7:30 
GeneralRe: my app icon lost, in setup application in vs2005. Pin
Skippums22-Jan-08 7:39
Skippums22-Jan-08 7:39 
GeneralReflection error for System.Version property Pin
hairy_hats22-Jan-08 5:46
hairy_hats22-Jan-08 5:46 
Generalpicturebox dilemma Pin
damianrda22-Jan-08 5:43
damianrda22-Jan-08 5:43 
GeneralRe: picturebox dilemma Pin
Luc Pattyn22-Jan-08 7:21
sitebuilderLuc Pattyn22-Jan-08 7:21 
Generalwrite into .csv Pin
arkiboys22-Jan-08 5:41
arkiboys22-Jan-08 5:41 
GeneralRe: write into .csv Pin
Justin Perez22-Jan-08 5:50
Justin Perez22-Jan-08 5:50 
GeneralRe: write into .csv Pin
arkiboys22-Jan-08 5:57
arkiboys22-Jan-08 5:57 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.