C# - Arguments For CloseHandle() Winapi Call In .net
Aug 26, 2009When accessing the winapi method CloseHandle() via .net P/Invoke, should the argument be IntPtr or HandleRef, and why?
View 2 RepliesWhen accessing the winapi method CloseHandle() via .net P/Invoke, should the argument be IntPtr or HandleRef, and why?
View 2 RepliesI have a method written in VB.NET. It looks like this:
Shared Sub SomeMethod(ByVal Id As Guid,
Optional ByVal str1 As String = "foo",
Optional ByVal str2 As String = "")
I want to call this method from C# 3.0 and I want it to use its default arguments. I tried passing System.Reflection.Missing.Value, but I cannot cast it as String. Is there any way to do that?
I build two programs, 1 - bootstrap and 1 - mainprogram
now, mainprogram has 2 constructors, the default and the one which i defined and it accepts an integer the default constructor checks the variable named iscalled a type of integer to have a value of 1 or zero, if its zero then it should shows a message saying "Improper initialization" then exits..
What I mean here is, mainprogram should only run if its called by the bootstrap program.
How to call exe with multiple arguments from VB.Net Source. Now, I can call exe file with mmyProcess.StartInfo.FileName ="....exe" and pass parameters with myProcess.StartInfo.Arguments but i can't pass multiple parameters with it.
View 1 RepliesIm trying to call a procedure to run into a thread..But this procedure requires two arguments. How can I pass these arguments in to the function when the thread call:
Dim myThread As New Threading.Thread(New Threading.ThreadStart(AddressOf PopulateTermList myThread.Start()
addressof PopulateTermList should only be called without parenthesis(the VB tells me this)
I have a whole slew of database access functions which assume a particular connection string. Within my application I call
[Code]...
I am using Oracle 10.2.0.1 and working on a web application using MS VS 2005. Here it is my oracle code :
CREATE OR REPLACE PACKAGE rollsearch AS
TYPE t_cursor IS REF CURSOR;
Procedure rol_cursor(c_rol in varchar2,c_cnm in varchar2,c_fnm in varchar2,
[code].....
Is it possible to pass multiple arguments to a delegate method from a list(Of T).ForEach call?So, I'd like to pass a listbox object to the delegate routine below:
Sub test()
Dim names As New List(Of String)
names.Add("Bruce")
names.Add("Alfred")
[code]....
So I've recently been vexed by problems similar to this one: Oracle .NET error - Wrong number or type of arguments. I know oracle is famous for its terrible error reporting, but this is a giant pain to debug -- if you have ten parameters, that's twenty things to check by hand (types and names,) not to mention the actual number of parameters, and if they're actually legitimate values.
Is there some way to get better diagnostics on stored procedure calls to oracle?
I must be missing something obvious here:
Private Class ListItem
Public Delegate Function ToStringDelegate() As Func(Of Encoding, String)
Public ReadOnly Encoding As Encoding[code]....
The error message is: "Too many arguments for ListItem.ToStringDelegate". I don't get it; it expects one argument of type Encoding and returns a String.
I am Automating IBM iSeries Emulators using VB.net, created GUI that embeds the external iSeries Emulator Window in a WindowsForm Panel using the "SetParent" API .. To communicate with the iSeries Window I use the SendMessage API to send Key's to the Screen. I am aware of the sendkeys.keys in .net, but this way I dont have to SetForegroundWindow and reactivate my Form.
[Code]...
I want to wait for and close a modal form (a popup) from another application, as soon as it appears. I want to do this from VB.NET, but suggestions in C# should be easily translateable.
I can hard-code the modal popup's caption in my app, since it's long and unique. What I want to do is simulate either the user clicking on the close ("X") button on the form, or a click on the defeault, tab-order 0 button of the form. Either would work.
Maybe I need more info about the modal popup other than the title bar's caption? In any case, it's safe to use it as an unique identifier of that modal form. I also want that code to terminate checking as soon as the first event of closing the popup happens.
I believe it's trivial, but I can't find any ready info on that. Microsoft says I should not send WM_CLOSE to the modal popup, since it will call DestroyWindow() instead of EndDialog(), but to be honest I don't even know what "sending WM_CLOSE" to the "window" means =/
I have been trying to build a game bot in vb.net.One of the main problems is getting access to the text the game prints on the screen so I have been trying to hook the games calls to the windows api drawtext and textout functions.I have been hunting for examples of how to set up a hook in vb.net for a long time without any luck.I have found it impossible to translate examples in old school vb, C++, and C#.For convenience's sake I would like to use the freely available deviare and/or easyhook libraries.
View 2 RepliesI have written some C/C++ code that uses the winapi functions CreateFile WriteFile SetFilePointer etc. to read & write some large (>4 GB) binary files. Some colleagues who are more familier with Visual basic than C, want to modify some of their existing code to call my C code functions.
I have turned my code into DLLs that I have successfully called from other C programs. I have also created a small C DLL that doesn't use the winapi functions & called it from a small VB program.
What I haven't so far been unable to do is pass the HANDLE type variable between a C function that uses the winapi functions & the VB program that call it so the VB can call another of my functions & pass the HANDLE.
In my attempt to do this, the declarations in the header file for two of the functions in the C DLL are:
[Code]...
When I step through the VB code in debug mode there is no problem with calling OpenSegyRW, but at WriteToSegy I get the error message:System.Runtime.InteropServices.MarshalDirectiveException was unhandled
Message=PInvoke restriction: cannot return variants.So what am I doing wrong & is there any way to pass the winapi HANDLE type between VB & C code? BTW indents etc. get lost when I paste my message into the forum. I hope this is decipherable.
I want to make a function to record the sound and then to play the record,like the telephone. I have ever download some articles,but they were all too complex,or they have too many unassociate code,so I can not understand the courses of the recording and playing.I want to get some code here?
View 2 RepliesI have a timer in winforms that looks for a specific OK dialog on my server (it clicks OK on a third party application that runs out of memory, then restarts it -- there is no other work around). So, when I remote desktop the server and the remote desktop window is active (the actual remote desktop window is active, not the actual window that has the OK that has to be clicked. I can have a window that has nothing to do with the OK, and it works), the program works as it should. It finds the window of the OK, then clicks the OK button fine. When I am not in remote destop, or when the remote desktop window is not active (or selecte) it finds the window and finds the OK button, but cannot click the OK button.
[Code]...
I'm trying to undersatnd the syntax of calling a funciton and it seem confusing when I'm using a web service in ASP.net. Maybe this question should be in an ASP forum, but it is a VB question. This simple web service allows you to type in your name and it response with an alert box with you name.
My question is, How can you call a function with 2 arguments when the function is only defined for one. I understand that the second argument is actually a method that handling the respons, but how can you interchange function arguments for methods and how do you know that there are methods for
Here's my call:
<script type="text/javascript">
function HelloWorld()
{
var yourName = $get('txtYourName').value;
[CODE]...
I connected to the Informix server using RazorSQL, created a stored procedure and tested it, getting the expected answer, so the procedure exists in the database in some form.
I then run the following code:
If ConnectToInformix() Then
Dim cmd As New IfxCommand("dc_routeHasOutstandingQuantity", conn)
cmd.CommandType = CommandType.StoredProcedure
[Code]....
This error does not occur when calling the stored procedure from a live SQL connection.
I want to create an ExpressionTree where a Func(of Vector, Vector, Vector, Vector, Double, Double, Vektor) should be called. So I use
Expression.Call(Forces(0).Function.Method, {Vec1, Vec2, Vec3, Vec4, Double1, Double2})(Vec1-4, Double1-2 are declared as ParameterExpression and Forces(0).Function as Func(of Vector, Vector, Vector, Vector, Double, Double, Vector). But I get an AgrumentException, because Forces(0).Function.Method has seven Arguments. (System.Runtime.CompilerServices.Closure as seventh argument at Index 0).
I am trying to build a web page that call an exe with some arguments. It's working perfectly when i launch it on the ASP.NET development server but it's not working well when I deploy it under IIS. He is the VB code source.The log text file is created in both cases but the exe is just launched from Visual Web developer 2008.[code]
View 5 RepliesI am listing the following three subrointines....
Private Sub OutPut(ByVal Offset As Long, ByRef path As String) 'Orig
If Not cbFiles.Checked Then
item1 = New ListViewItem(Offset)
[Code]....
They have the same name but a) different types of aguments or different numbers of arguments. This is legal in VB.
Visual Studio 2010
Windows 7 X64
I'm making a multipurpose tool. In with I need to run some DOS commands with arguments.So, Ex. of what I have now.
Private filepath As String = "C:UsersTTGToolToolG5.5.0pluginscom.zend.guard.core.resources.win32.x86_5.5.0
esources"
Private Sub Button1_Click(sender As System.Object, e As System.EventArgs) Handles Button1.Click[code]....
So it should be "like I like cats" or what ever it is in the textboxes in the command prompt.
Suppose I have two exes WindowsApplication1.exe WindowsApplication2.exe..On the form load of WindowsApplication2.exe,I m calling WindowsApplication1.exe & sending the command line arguements..I copy the WindowsApplication1.exe into the debug folder of WindowsApplication2.exe.
[Code]...
Suppose I have two exes WindowsApplication1.exe WindowsApplication2.exe..On the form load of WindowsApplication2.exe,I m calling WindowsApplication1.exe & sending the command line arguements..I copy the WindowsApplication1.exe into the debug folder of WindowsApplication2.exe.WindowsApplication2.exe
Code:
Private Sub Form1_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Process.Start(Application.StartupPath & "" & "WindowsApplication1.exe", "one" & "two")
End Sub
WindowsApplication1.exe
[Code]...
On form load of WindowsApplication2.exe,WindowsApplication1.exe is started & arguments are sent.Now I want to check on form load of WindowsApplication2.exe,I do not want to start WindowsApplication1.exe, i just want to send the arguments to the WindowsApplication1.exe. Is is possible? To send the command line arguments to the ruunning exe.
I have a problem and stuck on it here is my code it produce the following error "Too many arguments to Public Sub New()"
Dim con As New OleDbConnection("Provider=MSDAORA.1;Data Source=(DESCRIPTION=" _
+ "(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=196.111.116.205)(PORT=1521)))" _
+ "(CONNECT_DATA=(SERVER=DEDICATED)(SERVICE_NAME=Dummy)));" _
[code]....
it produces error on this line
Dim frm As frmworkodr = New frmworkodr(dt)
I am working on someone elses code, and this is in a Public Class I have the following code (same error msg both procedures):
Protected Sub New(ByVal info As SerializationInfo, ByVal context As StreamingContext)
MyBase.New(info, context) <<<------ Line With Error
End Sub
[code]....
and get the error message "Too many arguments to 'Public Sub New()'"This is the first time I have seen this type of code in a class?
[code]
Public Class Printing_CopyFrm
Private quer As String="select * form cust_details"
Public Sub New(ByVal query As String)
[CODE]...
I have a console application which reads .txt files. I want to be able to drag a txt file over my app and it would automatically open my app and show the text files contents. I think I have to use command line arguments like this:
Sub Main(ByVal cmdArgs() As String)
End Sub
Sub ReadFile(FilePath as String)
End Sub
But how can I pass the text files path to my ReadFile sub?
At the moment i'm creating a remote object instance by:
Dim serverURI = String.Format("{0}://localhost:{1}/{2}", IPC.Protocol, IPC.port, IPC.Channel_name)
Me.Server = CType(Activator.GetObject(GetType(RemotebaleServiceCommands), serverURI), RemotebaleServiceCommands)
I need to pass some constructor arguments to RemotebaleServiceCommands call.
I'm writing a class-library in VB.Net and one of the subs that are being called from the application which is using my library has more or less the following syntax:
Public Sub LoadDict(ByVal PhoneticType As String, ByVal strDict As String)
where PhoneticType can be phonSoundex, phonDoubleMetaphone or noPhonetic
I want to give the application-developer a possibility to select the PhoneticType from a list when writing the call of above sub (I think it's called attribute-arguments). This would make it easier for the developer since spelling-errors can be avoided and which will avoid errors when using the library. I think it's all about attributes but I haven't managed to get it to work despite trying.