Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
K

Kash

@Kash
About
Posts
59
Topics
31
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Capture console output
    K Kash

    Hi Senthil, Thanks for that. This works fine for writing data within C# to the shellcontrol. However, I am trying to capture the I/O from a dll written in another language. I can usually capture this by using AllocConsole(). Is there a way to do this in your control? For example: my dll subroutine is called aTest() and is declared as a void. aTest() merely outputs data to the console.

    C# csharp com help

  • Capture console output
    K Kash

    I am trying to capture the output from a function that computes some data then draw this in a text box. The following link does this for a .exe but I would like to do this for an owner-process. http://www.codeproject.com/csharp/LaunchProcess[^] Your help is appreciated. Kash

    C# csharp com help

  • Show results in console
    K Kash

    Hi, I've read some material and tried a few things but still no success. If anyone has a snippet or small example; this would be very useful. Kash

    C# csharp winforms

  • Show results in console
    K Kash

    I want to output data to the console from a button click on my WinForms application. This is what I tried but with no call to the function aTest() was made. Process myProcess = new Process(); myProcess.StartInfo.FileName = "cmd"; myProcess.StartInfo.Arguments = "aTest()"; myProcess.StartInfo.UseShellExecute = true; myProcess.Start(); Thanks Kash

    C# csharp winforms

  • Program Structure
    K Kash

    Hi, Yes that's what I'm trying to do. The dll is written in Fortran so splitting up the routines is definitely not something I want to do. I was half-expecting the answer to be on multithreading whereby a call would be made to the main process and periodically a call would be made to the fortran routine that keeps the data with a flag so tell C# that new data has arrived. Just for interest, would this be a good idea? However, I will try as you suggest.

    C# question csharp help workspace

  • Program Structure
    K Kash

    I am calling a dll from C#. The dll is called from a single function call in C# (dllimport ...) The dll produces data, which I want to access in real-time as and when it is generated in C#. However, the single function call will obviously only return the final answer. How can I setup either the dll or the C# to give me data as I require? Do I need to make an additional function call in C# that gives me access to the data or will the dll have to setup to send data back periodically? If so, how can I do this? Your help is appreciated. -- modified at 12:30 Tuesday 6th September, 2005

    C# question csharp help workspace

  • Add reference problem ?
    K Kash

    subroutine aFunc(xi,xo) real , intent(in) :: xi real , intent(out) :: xo ! !DEC$ATTRIBUTES dllexport :: aFunc !DEC$ATTRIBUTES DEFAULT,STDCALL, DECORATE, ALIAS: 'aFunc' :: aFunc ! xo = xi*xi end subroutine aFunc

    C# help csharp c++ com question

  • Add reference problem ?
    K Kash

    The actual dll is written in Fortran and I performaed a test in C++ using a void function declaration and it worked. What I'm trying to do is do the same in C#. I'm very new to C#, sorry if this is basic. I've tried putting the code in an unsafe context but still not returning xo althought both xi and xo (xi**2) in the dll are correct. class MyClass { [DllImport(@"square.dll", EntryPoint="aFunc")] unsafe public static extern void aFunc(float xi, out float * xo); public static int Main() { float xi=20.0F; unsafe { float * xo; aFunc(xi,out xo); Console.WriteLine(*xo); } return 0; } } } thanks in advance.

    C# help csharp c++ com question

  • Add reference problem ?
    K Kash

    I managed to get it to work by putting the .lib and .dll file in bin\Release folder but now I have some new problems. This works to an extent. The number goes in OK, and does the calc inside the dll correctly but the new number is not sent back. I tried both "out" and "ref" declarations. class MyClass { [DllImport(@"square.dll", EntryPoint="aFunc")] public static extern void aFunc(float aNum); public static int Main() { float aNum=20.0F; aFunc(aNum); Console.WriteLine(aNum); return 0; } } }

    C# help csharp c++ com question

  • Add reference problem ?
    K Kash

    I have successfully called a Fortran dll from unmanaged C++ and now I'm trying this in C#. This is my attempt: class MyClass { [DllImport(@"square.dll", EntryPoint="aFunc")] public static extern void aFunc(out int aNum); public static int Main() { int aNum=20; aFunc(out aNum); Console.WriteLine(aNum); return 0; } } The dll merely squares the number and sends it back out. The error message is System.DllNotFoundException. I think the reason is that I'm not able to add reference. It keeps saying that it's not a valid .COM or .dll ! Suggestions greatly welcomed. Kash

    C# help csharp c++ com question

  • Mixed language dll
    K Kash

    I am trying to call a Fortran dll in my c++ code. The fortran bit is as follows: subroutine swap(x,y,z) real , intent(inout) :: x real , intent(inout) :: y real , intent(out) :: z real :: t ! !DEC$ATTRIBUTES dllexport :: swap !DEC$ATTRIBUTES DEFAULT, DECORATE, ALIAS: 'swap' :: swap ! t=x x=y y=t z=1.23 end subroutine swap <\code> The C++ calling code is: `#include using namespace std; extern "C" __declspec(dllimport)void swap(double &x, double &y,double &z); int main() { double x,y,z; x = 10; y = 999; swap(x,y,z); cout< There are some problems however. x and y are not swapped but they do display their original values on the console. And z has not been assigned a value. I think it's a problem with the C++ bit but I could be wrong. The good thing is that it compiles and executes. I will eventually try and do this in C# but one step at a time ;) Kash`

    C / C++ / MFC csharp c++ help

  • Call dll problem
    K Kash

    Hi, I have created a test dll in Fortran that squares an input number. Then I'm trying to call this dll from C++.NET using the following bit of code: #include using namespace std; extern "C" __declspec(dllimport)double square(double X); int main(int argc, char* argv[]) { double a=4; double asq = square(a); cout << a << " " << asq << endl; return 0; } `I get the following error: HelloWorld error LNK2019: unresolved external symbol __imp__square referenced in function _main I've added MyDll.lib as a reference from the Fortran code but no success. (I'm not able to add MyDll.dll however, is this normal?) Any ideas please? Kash`

    Managed C++/CLI help csharp c++ question

  • C#, Fortran and dll's
    K Kash

    Hi, I am trying to call a Fortran dll in my simple C# example. My Fortran bit looks like this: 'code' subroutine sumit(x,i,r) real , intent(in) :: x(i) integer , intent(in) :: i real , intent(out) :: r ! !DEC$ATTRIBUTES STDCALL, DECORATE dllexport :: sumit !DEC$ATTRIBUTES STDCALL, DECORATE, ALIAS:'sumit' :: sumit ! integer :: j r=0.0 do j=1,i r=r+x(j) end do end subroutine sumit 'code' and my C# bit looks like: 'code' using System; using System.Text; using System.Runtime.InteropServices; namespace ConsoleApplication1 { class MyClass { [DllImport("Dll1.dll", EntryPoint="sumit")] public static extern double sumit(double x,int i,double r); public static void Main() { sumit(10.0,10,0.0); } } } 'code' But I get an exception error System.NullReferenceException. I also tried to add reference but I get an error saying that the extension must be of type .dll but it is already. Can anyone help. Kash

    C# help csharp tutorial

  • Spawning
    K Kash

    Hi, My GUI is required to call a code that is a console application. The progress is displayed in the console. My GUI button calls this code fine and data is written correctly. The problem is I don't see the console from the button call and the user has no idea when the routine has completed. Would this be something to do with CreateProcess()? I know that this function can be used to call applications but what about subroutines? Thanks. Kash

    C / C++ / MFC help question

  • Compiler Error
    K Kash

    Thanks for your help. I was just thinking whilst reading half way down, that you should write an article on this subject. People will definitely benefit from this. I solved the problem using ideas from your reply and now all seems to work fine. Thanks again. Kash

    C / C++ / MFC c++ help

  • Compiler Error
    K Kash

    Simple solutions have their own beauty :) In Equation(), I will eventually need to use member variables from my CWork class so I think the first method won't fit the bill. Please elaborate on the third option. Kash

    C / C++ / MFC c++ help

  • Compiler Error
    K Kash

    Hi, I have a bit of code that works fine in non MFC C++ project. However when converting to MFC code I get the infamous C2664 compiler error. This is what I'm trying to do: double CWork::Equation(double x[]) { return (100*(x[1]-x[0]*x[0])*(x[1]-x[0]*x[0])+(1.0-x[0])*(1.0-x[0])); } double CWork::DriverFunc(double (*dblfunc)(double[]), double start[]) { min = lots of operations; return min; } void CWork::WorkIt() { double start[] = {1.,2.,3.}; double min; int i; min=DriverFunc(Equation,start); } This is the error: Work.cpp(1041) : error C2664: 'DriverFunc' : cannot convert parameter 1 from 'double (double []) const' to 'double (__cdecl *)(double [])' Any suggestions would be great. Kash

    C / C++ / MFC c++ help

  • a vector question
    K Kash

    Hi, I am declaring a std::vector vX. I am filling it up using vX.push_back(aNum). The problem is i want to put the contents of vX into DP which is defined as double DP[]; This is because an external routine requires an array that is of the form above. Any ideas would be appreciated. Thanks Kash

    C / C++ / MFC graphics data-structures help question

  • Exception Handling
    K Kash

    Good idea, cheers

    C / C++ / MFC

  • Exception Handling
    K Kash

    Hi, I am trying to catch a user exception. The user presses two buttons. But the second button should only be pressed if the first one has else i should warn the user of an incorrect action. any ideas> kash

    C / C++ / MFC
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups