|
This is a non question. Did you just read the term 'API' on the toilet ? WPF has an API, ADO.NET has an API, GDI+ has an API. What the hell are you trying to ask ?
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
no actual i want create an API for chart. but I don't know to do so I want API. Already one chart control in vb.net but it is not suitable for my application and i tried some 3rd party chart tool but i can't get suitable control i want to know abt API control. and some of other customize control also need so i need some article or note etc... plzzz send the link..
|
|
|
|
|
non-bugging Errors wrote: i want create an API for chart
Wow - one has wonder how you think your question to do this would be helped by answers to the question you asked.
non-bugging Errors wrote: i want to know abt API control. and some of other customize control also need so i need some article or note etc... plzzz send the link..
I'll be honest. None of this makes any sort of sense. Certainly your first question was useless. There's tons of charting controls out there, there's nothing built in, although I think MS are giving away a charting library nowadays, you'll need to search to find out if this is so.
I recommend you read one of the many articles on how to ask reasonable questions because I guarentee you, no-one stood any chance of knowing what you wanted from your first question.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Christian Graus wrote: Wow - one has wonder how you think your question to do this would be helped by answers to the question you asked.
C isn't that hard: void (*(*f[])())() defines f as an array of unspecified size, of pointers to functions that return pointers to functions that return void
"Always program as if the person who will be maintaining your program is a violent psychopath that knows where you live." - Martin Golding
|
|
|
|
|
I'm saying that he asked his first question, and his first question didn't contain ANY info that related to what he actually wanted to do, as shown in his response. So, if people had just answered his OP, no way he'd have got any help, b/c he didn't actually ask about what he wanted to know.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Don't know why you got voted down. Your response was reasonable considering the vagueness of the OP's request.
|
|
|
|
|
I guess because I didn't provide code to copy and paste ? :P
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hi,
this link[^] explains API and provides some examples.
|
|
|
|
|
Hello,
I am struggling with API calls from VB.net. Basically, it is fine but a problem occurs when I try to call API which needs arrays to be passed.
API specification:
Public Declare Function spssGetVarNValueLabels Lib "spssio32.dll" Alias "spssGetVarNValueLabels@20" (ByVal handle As Integer, ByVal varName As String, ByRef values() As Double, ByVal labels() As String, ByRef numofLabels As Integer) As Integer
VB.NET call:
Dim handle As Integer = 0
Dim varname As String = "subject"
Dim numvallabs As Integer
Dim values(10) As Double
Dim labels(10) As String
erro = spssGetVarNValueLabels(handle, varname, values, labels, numvallabs)
No problems: handle, varname, numvallabs. In addition, I get correct value via "numvallabs".
But routine should return two arrays via values (double) and labels (string) and this is the problem. I have tried other similar API calls (integers or strings only) and everything was fine. But arrays are pain.
Since I read some topics how bridge the differences between C and VB, I have also tried to replace string variable for byte() or pass only the first element of array - but nothing helped. Current version return first element of doubled-array and nothing for string-array.
Full working code is enclosed: http://dev.zizkovi.name/anxiety.zip
Many thanks for any help in advance.
Petr
P.S. Background info: sav file is binary file used by SPSS Application. This DLL library is designated to read those files, etc.
Here is the sample code of mentioned call in C++ - published by vendor of used API:
#include <stdio.h>
#include "spssdio.h"
void func()
{
int fH;
int error;
int numL;
double *nValuesL;
char **labelsL;
...
error = spssOpenRead("bank.sav", &fH);
...
error = spssGetVarNValueLabels(fH, "SEX",
&nValuesL, &labelsL, &numL);
if (error == SPSS_OK)
{
int i;
printf("Value labels for SEX\n");
for (i = 0; i < numL; ++i)
{
printf("Value: %g, Label: %s\n", valuesL[i], labelsL[i]);
}
spssFreeVarNValueLabels(nValuesL, labelsL, numL);
}
}</stdio.h>
|
|
|
|
|
This sounds like a problem with how .NET is marshalling the arrays between the Managed and Unmanaged code. You'll need to research .NET Marshalling (Interop). There are generally some attributes that you can apply to the parameters that will instruct the Marshaller how to work with them correctly.
Keep It Simple Stupid! (KISS)
|
|
|
|
|
One thing that I have noticed with any API call that I use in my applications: Integer does not work properly with WinAPI; use Int32 as the default data type for integer objects.
Regards,
Thomas Stockwell
Programming today is a race between software engineers striving to build bigger and better idiot-proof programs, and the Universe trying to produce bigger and better idiots. So far, the Universe is winning.
Visit my Blog
|
|
|
|
|
Hi I need to convert HTML into RTF.
becourse I did not find a nice solution I let word do it
Sub HTML2RTF(ByVal oWord As Microsoft.Office.Interop.Word.Application, ByVal sHTMLFileName As String)
Const wdStory = 6
Const wdLine = 5
Const wdExtend = 1
Const wdCharacter = 1
Const wdFormatRTF = 6
With oWord
.Documents.Open(FileName:=sHTMLFileName)
.Selection.EndKey(Unit:=wdStory)
.Selection.MoveUp(Unit:=wdLine, Count:=2, Extend:=wdExtend)
.Selection.EndKey(Unit:=wdLine, Extend:=wdExtend)
.Selection.Delete(Unit:=wdCharacter, Count:=1)
Dim fi As New IO.FileInfo(sHTMLFileName)
Dim sRTFFileName As String = fi.FullName.Substring(0, fi.FullName.Length - fi.Extension.Length) & ".rtf"
.ActiveDocument.SaveAs(FileName:=sRTFFileName, FileFormat:=wdFormatRTF)
.ActiveWindow.Close()
End With
End Sub
However this in not the way to do it! Has someone a good idee
|
|
|
|
|
Word seems like a good way to me. There's nothing build in anywhere, your other option is to write your own conversion code.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Thanks
Again MS failed to do something usefull
Jan
|
|
|
|
|
jan212r wrote: Again MS failed to do something usefull
Really?? Useful to how many people?? That number determines if it's going to be worth the effort or not. When dealing with RTF and HTML, it usually gets converted from RTF to HTML, not the other way around.
|
|
|
|
|
Hi, thanks for looking
Im having a little problem here
I have a website, in this website i have a webservice with a few webmethods, i dont want anyone calling these methods unless the have permisions (In fact, im calling them from a win app)
In my site im using forms authentication
So, before calling any webmethod i call the SignIn Method
I am currently using the first method because the second one doesnt work when called from win app
I dont know why, i saw examples that stated that it works as well
Method that works either when called from win app or with my browser
<WebMethod()> _
Public Function SignIn(ByVal Nick As String, ByVal Password As String) As Boolean
If Not Membership.ValidateUser(Nick, Password) Then Return False
Dim ticket As New FormsAuthenticationTicket(1, Nick, Now, Now.AddYears(1), True, "")
Dim strEncryptedTicket As String = FormsAuthentication.Encrypt(ticket)
Dim cookie As New HttpCookie(FormsAuthentication.FormsCookieName, strEncryptedTicket)
Context.Response.Cookies.Add(cookie)
Return True
End Function
Method that only works when i use it with my browser
<WebMethod()> _
Public Function SignIn(ByVal Nick As String, ByVal Password As String) As Boolean
If Not Membership.ValidateUser(Nick, Password) Then Return False
FormsAuthentication.SetAuthCookie(Nick, True)
Return True
End Function
Example of method that i can call only after ive called the SignIn method (with true as result)
<WebMethod()> _
Public Function HelloWorld() As String
If Not User.Identity.IsAuthenticated Then Return ""
Return "Hello World"
End Function
In my win app i am using the cookiecontainer
As i told you, it works with the first singin method but not with the second
I used this page as a reference:
http://blog.webgear.co.nz/archive/2007/11/23/forms-authentication-in-web-services.aspx[^]
Im not quite sure, but i think that since i added this webservice, ive started to receive the following error (This error is causing all autenthicated users (Users of the web portal as well as users of the webservice) to be logout and have to log in again):
System.Security.Cryptography.CryptographicException: Padding is invalid and cannot be removed.
at System.Security.Cryptography.RijndaelManagedTransform.DecryptData(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount, Byte[]& outputBuffer, Int32 outputOffset, PaddingMode paddingMode, Boolean fLast)
at System.Security.Cryptography.RijndaelManagedTransform.TransformFinalBlock(Byte[] inputBuffer, Int32 inputOffset, Int32 inputCount)
at System.Security.Cryptography.CryptoStream.FlushFinalBlock()
at System.Web.Configuration.MachineKeySection.EncryptOrDecryptData(Boolean fEncrypt, Byte[] buf, Byte[] modifier, Int32 start, Int32 length, Boolean useValidationSymAlgo)
at System.Web.UI.Page.DecryptString(String s)
at System.Web.Handlers.AssemblyResourceLoader.System.Web.IHttpHandler.ProcessRequest(HttpContext context)
at System.Web.HttpApplication.CallHandlerExecutionStep.System.Web.HttpApplication.IExecutionStep.Execute()
at System.Web.HttpApplication.ExecuteStep(IExecutionStep step, Boolean& completedSynchronously)
Thanks in advance for any feedback
Alexei Rodriguez
|
|
|
|
|
i am new to vb.net.
i would like to create a class for sending emial . i tried the script online but i failed to send.
So i got this code below from the hosting server.
May i know how do i simplify the below script to just receive
FromEmail, Subject, Message ?
why it needs the mailerpath?mailerport? and errText? isn't we can check those error in the form instead of class ?
Please kindly advice. thanks
<pre>
' **** MailerPath = Your SMTP path (for eg: mail.[domain].com) ***
function CDOSYS_Mailer(Message, FromEmail, ToEmail, FromName, ToName, Subject, MailerPath, MailerPort, errText, searchURL)
on error resume next
dim Mailer
set Mailer = server.createobject("CDO.Message")
if err.number <> 0 then
errText = displayError("CDOSYS", searchURL, err.Number, err.Source, err.Description)
CDOSYS_Mailer = false : set Mailer = nothing : err.clear() : err = 0
exit function
end if
Mailer.From = FromName & " <" & FromEmail & ">"
Mailer.To = ToName & " <" & ToEmail & ">"
Mailer.TextBody = Message
Mailer.Subject = Subject
with Mailer.Configuration
.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = MailerPath
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = MailerPort
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")=1
.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername")="test@yourdomain.com"
.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword")="youremailpassword"
.Fields.Update
end with
Mailer.Send
if err.number <> 0 then
errText = displayError("CDOSYS", searchURL, err.Number, err.Source, err.Description)
CDOSYS_Mailer = false : set Mailer = nothing : err.clear() : err = 0
exit function
end if
set Mailer = Nothing
CDOSYS_Mailer = true
end function</pre>
|
|
|
|
|
.NET has its own built in ways of sending mail.
You want to read MSDN and look up the System.Net.Mail namespace and specifically the SmtpClient[^] class.
|
|
|
|
|
Dim message As New MailMessage("sender@address", "from@address", "Subject", "Message Text")<br />
Dim emailClient As New SmtpClient("Email Server Name")<br />
emailClient.Send(message)
That will do the job.
However, this code is one of the snippets in Visual basic, so how you didnt find it I dont know . And its not that hard to search google for this, and for possibly more reliable results try MSDN.
Lloyd J. Atkinson
|
|
|
|
|
You won't learn VB.NET by trying to copy code snippets off the web that you don't understand. This is a TERRIBLE way to send mail, as others said, the mail classes are built in. I would recommend reading my article on how to use google, it actually uses sending an email as an example. I would also recommend buying a book and working through it, learning how to program VB.NET incrementally instead of trying to learn how to copy and paste other people's code that is above your head.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
|
i am new to vb.net.
i would like to create a class for sending emial . i tried the script online but i failed to send.
So i got this code below from the hosting server.
May i know how do i simplify the below script to just receive
FromEmail, Subject, Message ?
why it needs the mailerpath?mailerport? and errText? isn't we can check those error in the form instead of class ?
Please kindly advice. thanks
' **** MailerPath = Your SMTP path (for eg: mail.[domain].com) ***
function CDOSYS_Mailer(Message, FromEmail, ToEmail, FromName, ToName, Subject, MailerPath, MailerPort, errText, searchURL)
on error resume next
dim Mailer
set Mailer = server.createobject("CDO.Message")
if err.number <> 0 then
errText = displayError("CDOSYS", searchURL, err.Number, err.Source, err.Description)
CDOSYS_Mailer = false : set Mailer = nothing : err.clear() : err = 0
exit function
end if
Mailer.From = FromName & " <" & FromEmail & ">"
Mailer.To = ToName & " <" & ToEmail & ">"
Mailer.TextBody = Message
Mailer.Subject = Subject
with Mailer.Configuration
.Fields("http://schemas.microsoft.com/cdo/configuration/sendusing") = 2
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserver") = MailerPath
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = MailerPort
.Fields("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate")=1
.Fields("http://schemas.microsoft.com/cdo/configuration/sendusername")="test@yourdomain.com"
.Fields("http://schemas.microsoft.com/cdo/configuration/sendpassword")="youremailpassword"
.Fields.Update
end with
Mailer.Send
if err.number <> 0 then
errText = displayError("CDOSYS", searchURL, err.Number, err.Source, err.Description)
CDOSYS_Mailer = false : set Mailer = nothing : err.clear() : err = 0
exit function
end if
set Mailer = Nothing
CDOSYS_Mailer = true
end function
|
|
|
|
|
your posts have an edit button and a delete button. Please, please, ask your questions once only. Edit them if you need to change them, don't repost.
Christian Graus
Driven to the arms of OSX by Vista.
|
|
|
|
|
Hello;
This seems to rather be VBScript and not VB.Net - which do you require help with?
VB.Net:
Public Shared Sub SendMail(ByVal mailTo As MailAddressCollection, ByVal mailFrom As String, _
ByVal mailSubject As String, ByVal mailPriority As System.Net.Mail.MailPriority, _
ByVal isHtmlFormat As Boolean, ByVal mailBody As String, _
Optional ByVal mailCC As MailAddressCollection = Nothing, _
Optional ByVal mailBcc As MailAddressCollection = Nothing, _
Optional ByVal mailFromDisplayName As String = Nothing)
Dim msg As New System.Net.Mail.MailMessage
For Each m As MailAddress In mailTo
msg.To.Add(m)
Next
If mailFromDisplayName Is Nothing Then
msg.From = New MailAddress(mailFrom)
Else
msg.From = New MailAddress(mailFrom, mailFromDisplayName)
End If
msg.Subject = mailSubject
msg.Priority = mailPriority
msg.IsBodyHtml = isHtmlFormat
If Not mailCC Is Nothing Then
For Each m As MailAddress In mailCC
msg.CC.Add(m)
Next
End If
If Not mailBcc Is Nothing Then
For Each m As MailAddress In mailBcc
msg.Bcc.Add(m)
Next
End If
msg.Body = mailBody
Dim smtpServer As New System.Net.Mail.SmtpClient()
smtpServer.Port = 25
smtpServer.Host = Convert.ToString(ConfigurationManager.AppSettings("SiteSMTP"))
Try
smtpServer.Send(msg)
Catch ex As Exception
Throw New Exception(String.Format("An error occurred sending an e-mail. The error recorded was {0}", ex))
End Try
End Sub
|
|
|
|
|
Hello,
How can I enable and disable modem via code?
Thanks
|
|
|
|
|