Force A Specific Processor Affinity On An Unmanaged DLL Call From .NET?

Jan 23, 2012

I am calling a function from a VB.NET webserver to a custom written unmanaged DLL.If we call this DLL via a webservice on a multi-core server we run into problems and it always crashes.If I reboot the server and make it only use a single-core, it always runs fine and never crashes.I know the DLL call is responsible for the crash as I have outputted debugging code just before and after the DLL call.I can force the processor affinity of the .NET code to 1 core but this doesn't apply to the unmanaged DLL.How can I force the unmanaged DLL to only run on a single core as I am sure this will solve the problem?

View 1 Replies


ADVERTISEMENT

Setting Processor Affinity Mask?

Jun 14, 2011

For setting my processor affinity mask and I need my process handle for this. How do I get it?

View 3 Replies

Reg Search At Specific Processor Usage

Mar 9, 2012

I was wondering is it possible to search the registry for a string containing "shutdown" but as a proccess wich takes about 20% processor power instead of the 50% i cant quite afford. Its a nasty joke going around school atm to stick a shutdown command on computer startup, was gonna see if i could do something about it.

View 4 Replies

Call Function From An Unmanaged DLL?

Feb 17, 2010

I have an unmanaged DLL and need to call one of its functions. Here's the [code]...

View 5 Replies

Call Unmanaged Mobile CE Dll From Full .Net Framework (Run On Desktop)

Jul 15, 2010

I have an Unmanaged Lib compiled for Windows Ce. I am trying to call this dll from VB.net Full Framework .Net 4 Client Profile Windows application. I am trying to use the same code that I use in the Compact Framework application. It compiles without errors and runs but when Invoking a function I get error ex = {"An attempt was made to load a program with an incorrect format. (Exception from HRESULT: 0x8007000B)"} Is it possible to use the Mobile Unmanaged Dll on the Desktop ? Here is the Wrapper code I use to call the Dll:

Imports System
Imports System.Runtime.InteropServices
Module modM300CF

[Code].....

View 1 Replies

C# - Force Application To Use A Specific IP Address From Running Computer?

Dec 4, 2011

I have a server (server A) that has several public IP addresses. I am building a desktop application that will run on server A to fetch data from another server (server B) using the httpwebrequest class.

What I would like to do is be able to programatically direct the application to use a specific IP address from the one the server (A) has.

View 2 Replies

Text Box Formatting - Force User To Use Specific Type Of Input

Dec 16, 2009

I have a text box labled QTY, which feeds the QTY column on a datatable. the table then is ran through a function that takes the data and converts it to a string which my production machine can read. My problem is this, and its probably really simple (these problems usually are) how to i force the user to use a specific type of input on the txtbox so they would have to put the QTY in the format of 01 02 03 etc etc, i have it set to default to 00 but i want to force the user to haver to input 2 chars.

View 5 Replies

Import And Call Unmanaged C Dll With Ansi String "char *" Pointer String From .net?

Mar 11, 2010

I have written my own function, which in C would be declared like this, using standard Win32 calling conventions:int Thing( char * command, char * buffer, int * BufSize);I have the following amount of VB figured out, which should import the dll and call this function, wrapping it up to make it easy to call Thing("CommandHere",GetDataBackHere).UPDATE:This code is now a working solution, as shown here:

Imports Microsoft.VisualBasic
Imports System.Runtime.InteropServices
Imports System
Imports System.Text

[Code]...

Updates: I got the code to build by following the help received here, and then I had forgot the As Return Type (which got me a MarshalDirectiveException PInvokeRestriction). Then I had an assertion failure inside my DLL, which lead to an SEHException. Once fixed, this works BEAUTIFULLY. There are newsgroups where people are saying this can not be done, that VB only loads managed dll assemblies (which I guess is the normal thing most VB users are used to).

View 2 Replies

Set CPU Affinity For 4 Cores Machine?

Nov 5, 2009

In my application I has a feature to set CPU application affinity for the application. I have a combo box with the following items:

Item 0: "ALL" -> It's point that if select the application will use all available CPUs
Item 1: "1" -> For set application to use first core
Item 2: "2" -> For set application to use second core
...
Item N....

Where N is the total numbers of CPUs/cores available in the system.

Now when the user click in one of this I execute this

Private Sub comboCPUAffinity_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles comboCPUAffinity.SelectedIndexChanged
Dim num As Integer = comboCPUAffinity.Items.Count - 1

[Code]....

This works well in my vista 2-cpu machine, and also in 1 core machines. The problem is that I have release the application and has a user who has a 64bits vista 4 cores machine, and when execute the above code the application causes a buffer overflow. This is maybe because I have something bad in the code which can not test because I have not the machine to test.

View 6 Replies

Call Specific Cell From BindingSource?

Nov 15, 2011

visual studio 2010 (vb.net window forms) access 2010 databasemultiple formstab controls (2 tabs) groupboxesI have a BindingSource bound to a single row of a dataset.tableThe question is how to call and check the information of a single cellthe cells are bound to textbox.text however on load when i call for information for those on tabpage2, they don't seem to populate fast enough to call from form_Load.I was wondering if there was a way to call they bound data directly from the biding source

for example:
Private Sub frmEditCust_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load

[code].....

View 6 Replies

Office Automation And Process Affinity

Apr 2, 2012

I am doing a bit of Office Automation and when printing a .doc file using VB.NET Office reference DLLs it causes great CPU load so I want to limit those processes to only use a single virtual core. I haven't been able to find anything in Microsoft's documentation about this.

This is the code I am using to print
Dim oWordApp As Word.Application
Dim oTargetDoc As Word.Document
oWordApp = New Word.Application
Select Case SQLdr("Priority")
[Code] .....

View 1 Replies

VS 2010 Set Program's Affinity To Be Able To Run On All Cores?

Jun 22, 2012

How do I set my program's affinity to be able to run on all cores?

Yes, I know the default is all cores, but I want to know how to set it in code.

Currently, I use:

Process.GetCurrentProcess.ProcessorAffinity = CType(Environment.ProcessorCount + 1, IntPtr)

View 2 Replies

Creating An Application To Control Affinity Of Processes

Jun 11, 2009

I am trying to create an application that will identify a process using over 50% of the CPU and set its affinity to run only on core 0. How should I go about creating this? P.S. I am trying to create this application because my PC has been creating this really anoying screaching sound when a process randomly uses over 50% of my CPU. (I have a dual-core, AMD sadly.)

View 2 Replies

Thread Affinity In Multi-core System?

Nov 29, 2011

I was going to hijack another, related, thread to ask this, but I figured it derserved its own thread.The question I have is whether or not anybody has done sufficient testing to show whether a mutlithreaded program running on a multi-core system will spread the threads across all available cores, or whether it has some affinity for the core used by the main process (UI thread, or whatever it may be)? The reason I ask is because I remember a discussion over in General Computing where somebody showed that, for at least one case, all the threads were splitting time on a single core of a multi-core processor. I am wondering if that is the typical behavior, or an isolated case?

View 23 Replies

How To Call On The File From Another Form And Use Specific Pieces Of Data For Login Verification

Feb 23, 2010

i can get this program to read the file but i now want to be able to call on the file from another form and use specific pieces of data for login verification and balance handling purposes.

[code..]

above is the contents of my txtfile but how do i reference anything in it?
[code...]

View 4 Replies

Get Motherboard Or Processor Id?

Aug 15, 2010

hi all is there any code to get motherboard or processor id?

View 2 Replies

Connect Other Pc And Need Use This Pcs Processor?

Aug 15, 2011

i have 1 old and 1 new pc and i want to use old pcs processor :D (it need for my experiments :icon_evil: lol just joking ) i know i dont need this pcs power but i dont want to junk my other pc is there any way to do it.i just need how can i connect them?i ll write a library for other pcs and i give a order to use bla bla functions and i want it says return information to my new pc. i know we have network delay. but for example network rendering its accelerates the process too much.i want working in partnership this two pcs for my programs?

View 1 Replies

Asp.net - Setting Up A Custom Pre-processor In IIS?

Apr 23, 2012

I am looking at developing a pre-processor and wanted to know how to configure IIS to pass the requesting page to it before it is returned. For example, the user would navigate to a page with a ".app" extension and IIS would send the file to a console program I wrote to be interpreted, before sending the page back to the user.

View 1 Replies

Get Processor Speed And Memory Of Ram ?

Jul 9, 2009

I am currently doing the project using vb.net which require me to find the proccesor speed and memory of ram....now i am searching the code from internet ....so currently, i havnt done anything.....i think i should use WMI or windows API to get those Info ....

View 5 Replies

Take Advantage Of 64bit Processor?

Jul 29, 2010

Well how can I do this? So my app is faster?

View 5 Replies

VS 2008 Processor ID Or Bios ID?

Feb 22, 2010

In my applications, for improving my registry system, I wanna get the serial number (or ID) of the processor or main board.

View 1 Replies

Add Word Processor Controls To Form?

Jun 15, 2009

Im creating an application to create rich text documents. As a part of of I have to add a text input field that can produce MS Word like features so that I can do word processing on the writing text.

At the moment VS studio provides, only Rich Text Box . But it doesnt provide that kind of features of the word processor.

Is it possible to add a word processor control to the Form if possible how can I do it? (I need to do this using the features of VS 2008 TS)

View 1 Replies

DB/Reporting :: MS Access Under 64bit Processor

Jul 26, 2009

I developed my application using vs2008 on a 32bit XP machine using ms access. My new machine is Vista 64bit using vs2008. Ms access has stopped working. It is looking for a 64bit software. Is there any? how do I work around this? will this hurt me when deploying to non 64bit machines?

View 3 Replies

Legitimate Unique Processor Identifier?

Aug 10, 2009

how to determine this? I know how to get the "processor ID" etc. but this is apparently not a unique identifier.This is for an intel i7 975. My boss has asked us to make sure that no-one tampers with several parts of a process control computer.

View 6 Replies

VS 2008 How To Determine Processor Load

Mar 9, 2010

I have a multi-processing application that kicks off up to 4 threads at a time to process data into a SQL-Server database. It seems to work okay, except at times the processors are pegged at 100% and all threads slow down a bit.

So, what I want to do is conditionally fire a thread based upon the processor load... if they're already running at 100%, it makes no sense to kick off another thread.

Is there a way to determine what the processor load is? Task manager shows processor load, so there probably is... but how do I do it?

View 2 Replies

VS 2010 Targets A Different Processor Than Application

Mar 3, 2012

I get this warning message when I run my project. Can someone explain to me what this means and how I can remove it, or if I need to worry about it.
[code]

View 9 Replies

Use Unmanaged C++ Dll In .net?

Jan 8, 2010

i need to pass commands through a C++ dll to vb.net and the other way around. is there some code that needs to be in the C++ dll to make it work? im not good at C++ at all,

View 5 Replies

Close Button On Word Processor For Class

Mar 14, 2011

I'm creating a simple word processor for class but I'm having some trouble on the close button. The Close button is supposed to close the file that the user is working on but not the word processor itself. How would I go about closing the document that the user is working on?

Here is what I have so far:
Private Sub CloseToolStripMenuItem_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CloseToolStripMenuItem.Click
Dim intfile As Object
rtbDocument.Text = ""
FileClose(intfile)
End Sub

This gives me an error message "Option Strict On disallows implicit conversions from 'Object' to 'Integer'." When I'm not using Option Strict On the code seems to work but VS gives me a warning message, "Variable 'intfile' is used before it has been assigned a value. A null reference exception could result at runtime. I'm not sure what value to assign the 'intfile' Object.

View 25 Replies

MultiThreading-Insuring A Thread Starts On Each Processor?

Apr 20, 2011

How do I ensure that a process has a thread on each processor?

What I am asking is how do I address processors to ensure a thread is running on it?

View 8 Replies

Simulating Multiple Instances Of An Embedded Processor

Jan 10, 2012

I'm working on a project which will entail multiple devices, each with an embedded (ARM) processor, communicating. One development approach which I have found useful in the past with projects that only entailed a single embedded processor was develop the code using Visual Studio, divided into three portions:[code]Feeding the embedded compiler/linker the code from parts 1 and 3 yields a hex file that can run on the target system. Running parts 1 and 2 together yields code which can run on the PC, with the benefit of better debugging tools and more precise control over I/O behavior (e.g. I can make the simulation code introduce certain types of random hiccups more easily than I can induce controlled hiccups on real hardware). Target code is written in C, but the simulation environment uses C++ so as to simulate I/O registers. For example, I have a PortArray data structure; the header file for the embedded compiler includes a line like unsigned char LATA @ 0xF89; and my header file for simulation includes #define LATA _IOBIT(f89,1) which in turn invokes a macro that accesses a suitable property of an I/O object, so a statement like LATA |= 4; will read the simulated latch, "or" the read value with 4, and write the new value. To make this work, the target code has to compile under C++ as well as under C, but this mostly isn't a problem. The biggest annoyance is probably with enum types (which behave as integers in C, but have to be coaxed to do so in C++).

Previously, I've used two approaches to making the simulation interactive:Compile and link a DLL with target-application and simulation code, and have VB code in the same project which interacts with it.Compile the target-application code and some simulation code to an EXE with instance of Visual Studio, and use a second instance of Visual Studio for the simulation-UI. Have the two programs communicate via TCP, so nearly all "real" I/O logic is in the simulation program. For example, the aforementioned `LATA |= 4;` would send a "read port 0xF89" command to the TCP port, get the response, process the received value, and send a "write port 0xF89" command with the result.I've found the latter approach to run a tiny bit slower than the former in some cases, but it seems much more convenient for debugging, since I can suspend execution of the unmanaged simulation code while the simulation UI remains responsive. Indeed, for simulating a single target device at a time, I think the latter approach works extremely well. My question is how I should best go about simulating a plurality of target devices (e.g. 16 of them).The difficulty I have is figuring out how to make each simulated instance get its own set of global variables. If I were to compile to an EXE and run one instance of the EXE for each simulated target device, that would work, but I don't know any practical way to maintain debugger support while doing that. Another approach would be to arrange the target code so that everything would compile as one module joined together via #include. For simulation purposes, everything could then be wrapped into a single C++ class, with global variables turning into class-instance variables. That would be a bit more object-oriented, but I really don't like the idea of forcing all the application code to live in one compiled and linked module.What would perhaps be ideal would be if the code could load multiple instances of the DLL, each with its own set of global variables. I have no idea how to do that, however, nor do I know how to make things interact with the debugger. I don't think it's really necessary that all simulated target devices actually execute code simultaneously; it would be perfectly acceptable for simulation instances to use cooperative multitasking. If there were some way of finding out what range of memory holds the global variables, it might be possible to have the 'task-switch' method swap out all of the global variables used by the previously-running instance and swap in the contents applicable to the instance being switched in. Although I'd know how to do that in an embedded context, though, I'd have no idea how to do that on the PC.

Is there any nicer way to allow simulation logic to be paused and examined in VS2010 debugger, while keeping a responsive UI for the simulator front-end, than running the simulator front end and the simulator logic in separate instances of VS2010, if the simulation logic must be written in C and the simulation front end in managed code? For example, is there a way to tell the debugger that when a breakpoint is hit, some or all other threads should be allowed to keep running while the thread that had hit the breakpoint sits paused?If the bulk of the simulation logic must be source-code compatible with an embedded system written in C (so that the same source files can be compiled and run for simulation purposes under VS2010, and then compiled by the embedded-systems compiler for use in real hardware), is there any way to have the VS2010 debugger interact with multiple simulated instances of the embedded device? Assume performance is not likely to be an issue, but the number of instances will be large enough that creating a separate project for each instance would be likely be annoying in the absence of any way to automate the process. I can think of three somewhat-workable approaches, but don't know how to make any of them work really nicely. There's also an approach which would be better if it's possible, but I don't know how to make it work.Wrap all the simulation code within a single C++ class, such that what would be global variables in the target system become class members. I'm leaning toward this approach, but it would seem to require everything to be compiled as a single module, which would annoyingly affect the design of the target system code. Is there any nice way to have code access class instance members as though they were globals, without requiring all functions using such instances to be members of the same module?Compile a separate DLL for each simulated instance (so that e.g. if I want to run up to 16 instances, I would include 16 DLL's in the project, all sharing the same source files). This could work, but every change to the project configuration would have to be repeated 16 times.Compile the simulation logic to an EXE, and run an appropriate number of instances of that EXE. This could work, but I don't know of any convenient way to do things like set a breakpoint common to all instances. Is it possible to have multiple running instances of an EXE attached to a single debugger instance?Load multiple instances of a DLL in such a way that each instance gets its own global variables, while still being accessible in the debugger. This would be nicest if it were possible, but I don't know any way to do so.If I use one VS2010 instance for the front-end, and another for the simulation logic, is there any way to arrange things so that starting code in one will automatically launch the code in the other?

View 2 Replies







Copyrights 2005-15 www.BigResource.com, All rights reserved