|
Hi,
I have the following code:
protected void Page_Load(object sender, EventArgs e)
{
MailMessage myMessage = new MailMessage();
myMessage.Subject = "Test Message";
myMessage.Body = "Hello world ";
myMessage.From = new MailAddress("you@example.com", "Sender Name");
myMessage.To.Add(new MailAddress("you@example.com", "Receiver Name"));
SmtpClient mySmtpClient = new SmtpClient();
mySmtpClient.Send(myMessage);
}
I put in web.config the following code:
system.net>
<mailSettings>
<smtp deliveryMethod="Network" from="Your Name &lt;you@example.com&gt;">
<network host="smtp.example.com" />
</smtp>
</mailSettings>
</system.net></pre>
but the result fail to send email???
why???
|
|
|
|
|
|
You need a "real" SMTP / mail server to send to; including a user id and password for sending via that server.
Do you have an account with "smtp.example.com"?
|
|
|
|
|
|
|
Please help me build VB.NET Skype commercial Calls recording.
I Don't know much about SKYPE4COMLib
Imports SKYPE4COMLib
Public Class Form1
Public WithEvents skype As New SKYPE4COMLib.Skype
Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
If Not skype.Client.IsRunning Then
skype.Client.Start()
End If
End Sub
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Try
skype.Attach()
MessageBox.Show("Succesfully Connected!", "Connected", MessageBoxButtons.OK, MessageBoxIcon.Information)
Label4.Text = ("Connected!")
Label2.Text = ("Welcome: " + skype.CurrentUserProfile.FullName)
Catch ex As Exception
MessageBox.Show("Unable to connect", "Connected", MessageBoxButtons.OK, MessageBoxIcon.Information)
Label4.Text = ("Disconnected")
Label2.Text = "Welcome: Unknown"
End Try
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
End Sub
End Class
|
|
|
|
|
You haven't spelled out any kind of problem at all. We have no idea what you need help with. Frankly, from the small code snippet you posted, it doesn't look like you have any idea what you're doing or what you're target application is even supposed to be doing.
|
|
|
|
|
That is why im asking a help... I don't know much about Skype commercial API.
|
|
|
|
|
You're NEVER going to get a tutorial on using the API in a forum. There's just too much information to convey.
Also, nobody is going to write your code for you. YOU have to do the research on this and YOU have to teach yourself how to use the API. What good would someone writing your app for you do? You still really wouldn't know how it works or why.
|
|
|
|
|
Please help me create simple. Skype commercial call recorder and save as .mp3 ..
|
|
|
|
|
|
Done with that.. But still no luck...
|
|
|
|
|
It is not a matter of luck.
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
Luck has nothing to do with it. You need to use your brain.
|
|
|
|
|
What's a "commercial" call?
Is that different from a "private" call?
How is it different?
|
|
|
|
|
hello. Looking for friends here.
|
|
|
|
|
The Term Papers wrote: Looking for friends here. OK. I'll tell them you're here. Please have a seat.
There are only 10 types of people in the world, those who understand binary and those who don't.
|
|
|
|
|
I fear it is the wrong place.
You'd rather try at the lounge.
The Lounge[^]
Patrice
“Everything should be made as simple as possible, but no simpler.” Albert Einstein
|
|
|
|
|
I am witnessing something odd with the COM object/s I import. Before the lectures, I am importing the objects as a private member, using their functionality, and then, in the Dispose method of the class, attempting to get rid of them.
If I import the COM object as an RCW object, it all looks fine. I keep the reference while I need it, and calling Marshal.ReleaseComObject in Dispose brings its reference count back to zero - all nicely as expected.
However, if I import the COM object as a pointer to IUnknown in an IntPtr, when I use Marshal.Release on that pointer, it tells me there are still 3 references to it. Not only do I not know what it is that has a hold of these references, it strikes me as a probable memory leak, as I can't see how the GC will locate them just from a pointer. Perhaps I should be looping through Marshal.Release until the reference count gets to zero?
Thoughts anyone?
Cheers,
Mick
------------------------------------------------
It doesn't matter how often or hard you fall on your arse, eventually you'll roll over and land on your feet.
|
|
|
|
|
Here is some code that demos exactly what I am talking about, except in the demo, the Marshal.Release is returning only one extraneous reference. You'll just have to believe me when I say the code is pretty much the same in my project, except that I only have the one dll import and I just modify the signature for the method to use, and it tells me that the pointer has 3 references when I use that signature.
If you copy and paste the code below into a console application, it should just work. The output I get is
Release COM pointer = 1
Release COM object = 0
Release COM object = 0
Release COM pointer = 1
Release COM object = 0
Release COM pointer = 1
[ComImport, Guid("ca724e8a-c3e6-442b-88a4-6fb0db8035a3")]
interface IPropertySystem {
void GetPropertyDescription(
[In] IntPtr propkey,
[In] IntPtr riid,
[Out] out IntPtr ppv);
void GetPropertyDescriptionByName(
[In, MarshalAs(UnmanagedType.LPWStr)] string pszCanonicalName,
[In] IntPtr riid,
[Out] out IntPtr ppv);
void GetPropertyDescriptionListFromString(
[In, MarshalAs(UnmanagedType.LPWStr)] string pszPropList,
[In] IntPtr riid,
[Out] out IntPtr ppv);
void EnumeratePropertyDescriptions(
[In] int filterOn,
[In] IntPtr riid,
[Out] out IntPtr ppv);
void FormatForDisplay(
[In] IntPtr propkey,
[In] IntPtr propvar,
[In] int pdff,
[Out] IntPtr pszText,
[In] uint cchText);
void FormatForDisplayAlloc(
[In] IntPtr propkey,
[In] IntPtr propvar,
[In] int pdff,
[Out] out IntPtr ppszDisplay);
void RegisterPropertySchema([In, MarshalAs(UnmanagedType.LPWStr)] string pszPath);
void UnregisterPropertySchema([In, MarshalAs(UnmanagedType.LPWStr)] string pszPath);
void RefreshPropertySchema();
}
class PropertySystem : IDisposable {
[DllImport("Propsys.dll", CharSet = CharSet.Unicode)]
public static extern int PSGetPropertySystem(
[In] ref Guid riid,
[Out, MarshalAs(UnmanagedType.Interface)] out IPropertySystem ppv);
[DllImport("Propsys.dll", CharSet = CharSet.Unicode)]
public static extern int PSGetPropertySystem(
[In] ref Guid riid,
[Out] out IntPtr ppv);
public void Dispose() {
if (_pPropSystem != null) {
WriteLine("Release COM object = {0}", Marshal.ReleaseComObject(_pPropSystem));
_pPropSystem = null;
}
if (_ppv != IntPtr.Zero) {
WriteLine("Release COM pointer = {0}", Marshal.Release(_ppv));
_ppv = IntPtr.Zero;
}
}
IPropertySystem _pPropSystem = null;
IntPtr _ppv = IntPtr.Zero;
static Guid IID_IPropertySystem = typeof(IPropertySystem).GUID;
public PropertySystem(bool asPointer) {
if (asPointer) {
int hr = PSGetPropertySystem(ref IID_IPropertySystem, out _ppv);
if (hr < 0)
Marshal.ThrowExceptionForHR(hr);
}
else {
int hr = PSGetPropertySystem(ref IID_IPropertySystem, out _pPropSystem);
if (hr < 0)
Marshal.ThrowExceptionForHR(hr);
}
}
public void CreatePointerFromObject() {
_ppv = Marshal.GetIUnknownForObject(_pPropSystem);
}
public void CreateObjectFromPointer() {
_pPropSystem = (IPropertySystem)Marshal.GetObjectForIUnknown(_ppv);
}
}
class Program {
static void Main(string[] args) {
PropertySystem ps;
ps = new PropertySystem(true);
ps.Dispose();
WriteLine();
ps = new PropertySystem(false);
ps.Dispose();
WriteLine();
ps = new PropertySystem(true);
ps.CreateObjectFromPointer();
ps.Dispose();
WriteLine();
ps = new PropertySystem(false);
ps.CreatePointerFromObject();
ps.Dispose();
ReadKey(true);
}
}
Cheers,
Mick
------------------------------------------------
It doesn't matter how often or hard you fall on your arse, eventually you'll roll over and land on your feet.
|
|
|
|
|
This is my first message so Hello Every One
I'm writing software for Intermec CK3X mobile barcode collector, I use the Intermec reference dll files (Intermec.DataCollection.CF2.dll). When a barcode is read the bcr_BarcodeRead method is executed. The problem is that when some error appear inside this method, for example format exception in line:
int x = Convert.ToInt16("some text");
then in Visual Studio 2008 in debug mode I get "No symbols are loaded for any call stack frame. The source code cannot be displayed". But when I put those line in onButtonClick() method then VS can show me exactly a line with the error.
Why VS can't show me error line in bcr_BarcodeRead method?
I hope it will be understandable
Best regards
Andrew
|
|
|
|
|
I'm a C++ programmer but the answer should be the same for .Net.
To debug code located in a DLL, you need a PDB file for the DLL. To show also the source code it must be off course present. For your code the PDB files are generated when building the application.
If you have access to the source code you can build your own debug version of the DLL which creates the PDB file. If not, you have to ask the author for a PDB file.
If you have the PDB file but it is not located in the directory of your DLL or the executable, you can specify the path. See How to: Specify a Symbol Path[^] (link is for VS 2008).
See also Debugging with Symbols (Windows)[^].
|
|
|
|
|
I was looking for a way to write unicode characters to an INI file. I stumbled upon some solutions which were not satisfactory: they involved ANSI/UTF-8 files. So here is a workaround.
Module INI
Private Declare Ansi Function WritePrivateProfileString _
Lib "kernel32.dll" Alias "WritePrivateProfileStringA" _
(ByVal lpApplicationName As String, _
ByVal lpKeyName As String, ByVal lpString As String, _
ByVal lpFileName As String) As Integer
Private Declare Auto Function GetPrivateProfileString Lib "kernel32" (ByVal lpAppName As String, _
ByVal lpKeyName As String, _
ByVal lpDefault As String, _
ByVal lpReturnedString As StringBuilder, _
ByVal nSize As Integer, _
ByVal lpFileName As String) As Integer
Public Function GetPrivateProfileStringUnicode(ApplicationName As String, KeyName As String, FileName As String) As String
Dim sb As New StringBuilder(500)
GetPrivateProfileString(ApplicationName, KeyName, "", sb, sb.Capacity, FileName)
Dim Value As String = sb.ToString
If InStr(Value, "#") = 0 Then
'No #-character found, so there is nothing to convert back
Return Value
Else
Dim i As Integer
Dim Parts() As String = Split(Value, "#") 'Split value to array
For i = 1 To UBound(Parts) Step 2 'If i is an odd number Parts(i) always contains a integer which should be converted back
Parts(i) = Trim(ChrW(CInt(Parts(i))))
Next
Return Join(Parts, "") 'Return the joined array Parts
End If
End Function
Public Sub WritePrivateProfileStringUnicode(ApplicationName As String, KeyName As String, Value As String, FileName As String)
'First escape the #-character
Dim NewValue As String = Replace(Value, "#", "#" & Asc("#") & "#")
If IsUnicode(NewValue) Then
'Value has unicode characters; we convert them to integer value preceded and followed by a #-character
Dim i As Integer
Dim ValueUnicode As String = ""
For i = 1 To Len(NewValue)
Dim strChar As String = Mid(NewValue, i, 1)
If AscW(strChar) > 255 Or AscW(strChar) < 0 Then
strChar = "#" & AscW(strChar) & "#"
End If
ValueUnicode = ValueUnicode & strChar
Next
'Write converted string to INI file directly
WritePrivateProfileString(ApplicationName, KeyName, ValueUnicode, FileName)
Else
'No unicode characters, so write to INI file directly
WritePrivateProfileString(ApplicationName, KeyName, NewValue, FileName)
End If
End Sub
Private Function IsUnicode(input As String) As Boolean
Dim asciiBytesCount = Encoding.ASCII.GetByteCount(input)
Dim unicodBytesCount = Encoding.UTF8.GetByteCount(input)
Return asciiBytesCount <> unicodBytesCount
End Function
End Module
|
|
|
|
|
If this is supposed to be a Tip, then please post it in the proper place. This forum is for technical questions.
|
|
|
|
|
Yes. It is a tip and I marked it as a 'Sugestion' (and isn't that the same), so why the barking? BTW: I posted it also as an article. Cheer up man!
|
|
|
|
|