 |
 |
Apologies for the shouting but this is important.
When answering a question please:
- Read the question carefully
- Understand that English isn't everyone's first language so be lenient of bad spelling and grammar
- If a question is poorly phrased then either ask for clarification, ignore it, or mark it down. Insults are not welcome
- If the question is inappropriate then click the 'vote to remove message' button
Insults, slap-downs and sarcasm aren't welcome. Let's work to help developers, not make them feel stupid.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
 |
For those new to message boards please try to follow a few simple rules when posting your question.- Choose the correct forum for your message. Posting a VB.NET question in the C++ forum will end in tears.
- Be specific! Don't ask "can someone send me the code to create an application that does 'X'. Pinpoint exactly what it is you need help with.
- Keep the subject line brief, but descriptive. eg "File Serialization problem"
- Keep the question as brief as possible. If you have to include code, include the smallest snippet of code you can.
- Be careful when including code that you haven't made a typo. Typing mistakes can become the focal point instead of the actual question you asked.
- Do not remove or empty a message if others have replied. Keep the thread intact and available for others to search and read. If your problem was answered then edit your message and add "[Solved]" to the subject line of the original post, and cast an approval vote to the one or several answers that really helped you.
- If you are posting source code with your question, place it inside <pre></pre> tags. We advise you also check the "Encode "<" (and other HTML) characters when pasting" checkbox before pasting anything inside the PRE block, and make sure "Use HTML in this post" check box is checked.
- Be courteous and DON'T SHOUT. Everyone here helps because they enjoy helping others, not because it's their job.
- Please do not post links to your question into an unrelated forum such as the lounge. It will be deleted. Likewise, do not post the same question in more than one forum.
- Do not be abusive, offensive, inappropriate or harass anyone on the boards. Doing so will get you kicked off and banned. Play nice.
- If you have a school or university assignment, assume that your teacher or lecturer is also reading these forums.
- No advertising or soliciting.
- We reserve the right to move your posts to a more appropriate forum or to delete anything deemed inappropriate or illegal.
cheers,
Chris Maunder
The Code Project Co-founder
Microsoft C++ MVP
|
|
|
|
 |
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("[email protected]", "Sender Name");
myMessage.To.Add(new MailAddress("[email protected]", "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;[email protected]&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.
|
|
|
|
|
 |
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
|
|
|
|
|