Using A C++ Function In A .NET Code?
Nov 4, 2009
I found a function in C++ that I would like to call in VB.NET, but I don't know how to do it. I was reading some forums and they said you had to create some sort of wrapper or something like that :8-0:This is the function I need to use, and it comes from microsoft's page here. Basically, it returns all the loaded DLLs for a given process ID.
I wanted to to something like this:Code:Dim myProcessId As String = '1234'Dim myModules As New List(Of String)myModules = getProcessModules(myProcessId)' ^ I know right now the C++ function doesn't return anything (it only prints) but I don't know C++ so I'll have to try to change that later.
Code:#include <windows.h>#include <tchar.h>#include <stdio.h>#include <psapi.h>
void PrintModules(DWORD processID){ HMODULE hMods[1024]; HANDLE hProcess; DWORD cbNeeded; unsigned int i;
//Get a list of all the modules in this process. hProcess = OpenProcess( PROCESS_QUERY_INFORMATION
[code]....
don't use ACCESS, EXCEL, or a TEXT FILE as a database. If you want your program to use a "local database", without any of the hassle of setting up a MS SQL or MySQL server, just click this link: >>> SQLite <<< Seriously.
View 4 Replies
ADVERTISEMENT
Jun 14, 2012
Possible Duplicate:
calling ASP function from javascript
okay running this code :
<script type="text/javascript">
[code].....
View 2 Replies
Jul 3, 2011
This is my first time writeing a program and i am stuck. i am just looking for were i should go next. i can't figure out how to write in code for the days in the getDay function.
Write a program that computes the cost of a long-distance call. The cost of the call is determined according to the following rate schedule:
a. Any call started between 7:00 A.M. and 9:00 P.M., Monday through Friday, is billed at a rate of $0.30 per minute.
b. Any call started before 7:00 A.M. or after 9:00 P.M., Monday through Friday, is billed at a rate of $0.15 per minute.
c. Any call started on a Saturday or Sunday is billed at a rate of $0.10 per minute.
The inputs will consist of (1) the day of the week, (2) the start/end time of the call, and (3) the length of the call in minutes. The output will be the cost of the call. Input will come from the user and outputs will be displayed via the console window.
Module program1
Sub Main()
Dim day As String
day = GetDay()
[CODE]...
View 5 Replies
Sep 3, 2010
I have an access database merged with my form.
I created a menu with next back ect,
with code for the next menu button to go to next, back, first, last record in attached database
View 5 Replies
Sep 30, 2010
I need to call this from the code behind if there is a certain value read in from a query string variable ie
x as string = request.querysting("Var")
if x = 'Hide" then
function guestHide()
[Code].....
View 1 Replies
Dec 27, 2010
I remember that C# editor has a powerful option that when we are developing in code and type a new method (operation) name for a class, we can create its body by clicking on ALT+Shift+F10 and immediately, it will be created for it's own class.
what about in VB.NET 2008 editor?
View 1 Replies
Oct 20, 2010
i use this code many times on all my applications.but now i'm on windows 7 and changed the framework to 3.5 and the code does not do what it supose to do.If File.Exists(Application.StartupPath & "downloaded" & ListViewEx1.SelectedItems.Item(0).Text & "ar.exe") Then
[Code]...
View 3 Replies
Mar 19, 2011
Private Function ViewPropertyCast(ByVal type As String) As String
Select Case type
Case "smallint"
Return "Short"
Case "nvarchar"
Return "String"
[Code]...
View 3 Replies
Jun 11, 2012
In my project, there are 3 user controls; BasicContact, BasicDetail and ActionTime. They are in EditOrder.aspx page. There is "ReportDate" property (Date type) in BasicContact, RadioButtonList "rdl_Priority" (with integer value from "prio_id" field) in BasicDetail and "CheckDate" property in ActionTime. The ReportDate value is derived from txt_ReportDate and txt_ReportTime and CheckDate value is derived from txt_CheckDate and txt_CheckTime.
[Code]...
View 1 Replies
Feb 10, 2012
I have a function that is responsible for populating an SSRS report. The user presses a button and I go out and check to see if there is data. If no data, I provide a NO DATA message. If there is data I call the SSRS report which I would like to open in a new window.
<script type="text/javascript">
function openWindow(url) {
document.forms[0].target = "_blank";
}
</script>
View 4 Replies
May 27, 2011
I have a MustInherit class with some MustOveride Methods in it. When i inherit form that class, I automatically get the MustOveride Methods or properties. My question is, I want to be able, to inherit from a class, get my MustOveride functions and methods, but then with some code already in it. I've once seen a .net class that did it, when I inherited from that class, I got the methods, with some comments in it.
View 4 Replies
Mar 26, 2009
I have ShowValue working. Now, on the last line I need to call the function newFunction to repopulate the dropdownlist object on the onClick event.
I am getting errors when I click the dropdownlist down arrow.
How do I get the two to hand shake with each other?
My code:
Public Sub ShowValue(ByVal sender As Object, ByVal e As System.EventArgs)
lblupdatePanel.Text = DropDownList1.SelectedValue.ToString
Dim LocationDescription2 As DropDownList =
[Code].....
View 3 Replies
Mar 15, 2012
I wants to ask about how to call the javascript function/method in .aspx file from code behind(or server code)?[code]...
View 3 Replies
Aug 3, 2009
I need to call a VBA Function (accepting parameters and returning values) from a VSTO Add In Code base. The macro code base in the .xlsm file is as follows[code]...
View 7 Replies
May 21, 2012
I have a problem with my vb.net program. Some parts of the code dissapeard but i still can run the program normaly. Even if i add a new button it doesnt appear.I have a button that uploads some files to mysql database but then i double click that button a new sub appears with nothing in it..
View 5 Replies
Oct 12, 2009
I have just downloaded Visual Basic Express 2008, I have previously only ever used access and I have a rather stupid and basic question to ask! I have a button and am trying to enter the very simple code so that when it is clicked it opens Form2, I am unsure as to how this is written as the "expression" I would have used in access obviously doesnt work.
View 2 Replies
Mar 31, 2009
I have some C# code I'm trying to convert to VB.NET. There are some external dependencies I'm referencing in each project. The C# line is
TWriteFileCommand writeFile = (TWriteFileCommand)CommunicationLink.CreateCommand(TOPKernel.TCommand.CommandType.WriteFile);
I don't really understand what the TWriteFileCommand in parathesis after the equal sign is for in that statement. When I try to do it in VB.NET, I keep getting errors because I can't get a reference to the CreateCommand function. The closest I've gotten is this:
Dim MyAppBase As OPSupport.App.AppBase
Dim writeFile As TWriteFileCommand
writeFile = MyAppBase.CommunicationLink.CreateCommand(TOPKernel.TCommand.CommandType.WriteFile)
However, I have a green underline after the equal sign @ MyAppBase that flags an error "Variable MyAppBase is used before it has been assigned a value. A null reference exception could result at runtime."What am I missing? Why in the C# code is the instance fine and what do I need to get the equivalent instance in VB.NET?
View 7 Replies
Mar 6, 2010
I am new to vb.net and would like to be able to convert the following code to it's own function - either inside the current module or better yet in a seperate class.This code currently runs in the KEYPRESS event and ensures only numbers, decimal point, 2 decimals etc. are entered and not letters. Works exactly how I want it but would now like it in a function.I need this code in numerous text box controls but I would rather just call it somehow with a function.
View 3 Replies
Oct 11, 2009
Function can't return a value on all code paths.[cde]...
View 2 Replies
Nov 20, 2011
I am getting the warning that the function doesn't return a value on all code paths.
Function newgradelevel(ByVal valscore As Integer, ByVal strgradelevel As String) As String
If valscore >= 70 Then
If strgradelevel = "Freshman" Then
newgradelevel = "Sophomore"
ElseIf strgradelevel = "Sophomore" Then
[Code] .....
View 1 Replies
Jan 16, 2010
I am looking for a function like this:Function(Line x) must return the line x as a string (where Line x is a line of code from Form1 I specify)
Example:
Function(Line 10) returns the code (instructions) from line 10 as a string
If Line 10 from Form1 is: "if a=b+c then...."
Function(Line 10) returns "if a=b+c then...."
View 3 Replies
Sep 2, 2009
I must be doing something wrong here (because really, what are the chances of me tripping over another bug in the Vb.net compiler?)I have a static generic function in .net 2.0 Vb code, I thought it was time to "upgrade" it to be an extension method, but the compiler complains with Extension method 'AddIfUnqiue' has type constraints that can never be satisfied.
Here's a trivial example that displays the same problem. The old static version (which works fine) followed by the extension method
Public Class MyStaticClass
Public Shared Sub AddIfUnqiue(Of T, L As {List(Of T)})(ByVal this As L, ByVal item As T)
If this.IndexOf(item) < 0 Then
[code].....
View 1 Replies
Jan 14, 2010
In using the IDisposable Interface, the two subroutines are displayed in my code from Microsoft when coded. How do I do the same with an Interface that I write? Is it possible or is this a feature that only Microsoft can do? I am using Visual Studio 2005!
View 7 Replies
Jan 4, 2011
"'I'm having an issue sorting out why my code isnt working. When I "step into" it line by line i can get it all to work exactly how I want, however when I actually run the macro i get an subscript error 9. The code basicly sets a .CSV url to a variable "CurrentURL". The code then launches this url which opens a .csv window called table.csv. I want to copy 2 columns off this window and paste it to another document called "MPT_CAPM_v1", then close table.csv. Here is my code the red line is where I believe I'm running into my error.'This macro opens a URL, copies and pastes the price data into the sheet
[Code]...
I think the error may be caused by the fact it takes about 4-5 seconds to open table.csv in excel, and my line of code is trying to select a window that isnt currently open. After I get the error message, table.csv opens up. I've tried Loops & Sleep functions to try to input a delay, but regardless it seems that table.csv will not open until the end of said loop or delay.
View 6 Replies
Jun 7, 2011
I have a modal/dialog with two buttons, "OK" and Cancel. When I hit "OK" I want to send these data to a function on the server. How can I accomplish this? Can anyone give me some information/example? I belive I would have to use "$.post" but again, how would I send it to a particular page's function?
UPDATED ... still cannot reach code behind function.
$('#dialog').dialog({
modal: true,
[code].....
View 3 Replies
Sep 21, 2011
i want to do this:when user click save button, the form must be check first..if user did not insert the required data, user are not allow to save form..
the code:
Private Sub AssetMasterBindingNavigatorSaveItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles AssetMasterBindingNavigatorSaveItem.Click
'if group code is null, user are not allow save...
[code]....
what is the code in order to have the same function as e.cancel?e.cancel is used in formclosing event. which is to stop the form from closing
dp.SyntaxHighlighter.ClipboardSwf = '/dp.SyntaxHighlighter/Scripts/clipboard.swf'
dp.SyntaxHighlighter.HighlightAll('643bb21f2cc945e88ed0d584c122bc17')
View 3 Replies
Apr 19, 2012
I have the following code which assigns values to a datarow and and adds to the datatable. I want to write function which returns a datarow which enables me to write less code.
objRow = dtTODO.NewRow
objRow.Item("Item") = "Test"
objRow.Item("Message") = "Test"
[code].....
View 1 Replies
Mar 10, 2010
How can I transform this code to a function (anyone can do it for me?)? Otherwise I have to use this long code again and again..
[Code]...
View 8 Replies
Apr 28, 2009
I need to write a function to select a text file.also let me know if i need to add any thing from references or from components window.is file browser and folder browser the same?
View 2 Replies
Nov 6, 2011
I would like to pass a value and add to it with the previous value thats what I want.The below code doesn't work...I can't understand the problem..Actually its for rdlc - total purpose I need it.My Code
public MyValue as Decimal=0
public Function AddToSum(ByVal quantity as Decimal) as Decimal
MyValue=AddToSum+quantity
AddToSum=MyValue
return AddToSum
[Code]...
View 1 Replies