Click here to Skip to main content
15,916,949 members
Home / Discussions / C#
   

C#

 
GeneralRe: ADO and C# (simple question) Pin
Kant6-Jun-03 12:16
Kant6-Jun-03 12:16 
GeneralRe: ADO and C# (simple question) Pin
James T. Johnson6-Jun-03 13:11
James T. Johnson6-Jun-03 13:11 
GeneralRe: ADO and C# (simple question) Pin
Daniel Turini6-Jun-03 21:46
Daniel Turini6-Jun-03 21:46 
GeneralRe: ADO and C# (simple question) Pin
Kannan Kalyanaraman8-Jun-03 0:10
Kannan Kalyanaraman8-Jun-03 0:10 
GeneralRe: ADO and C# (simple question) Pin
Daniel Turini9-Jun-03 6:52
Daniel Turini9-Jun-03 6:52 
GeneralRe: ADO and C# (simple question) Pin
jspano7-Jun-03 17:12
jspano7-Jun-03 17:12 
Generalform event hierarchy Pin
albean6-Jun-03 8:55
albean6-Jun-03 8:55 
Generalapplication's path Pin
rabidDog6-Jun-03 5:35
rabidDog6-Jun-03 5:35 
GeneralRe: application's path Pin
Kannan Kalyanaraman6-Jun-03 5:44
Kannan Kalyanaraman6-Jun-03 5:44 
GeneralRe: application's path Pin
gek_at6-Jun-03 7:55
gek_at6-Jun-03 7:55 
GeneralRe: application's path Pin
dynamic7-Jun-03 13:07
dynamic7-Jun-03 13:07 
GeneralCause validation of Textbox control when a menu item is clicked Pin
DionChen6-Jun-03 5:20
DionChen6-Jun-03 5:20 
GeneralRe: Cause validation of Textbox control when a menu item is clicked Pin
leppie6-Jun-03 7:19
leppie6-Jun-03 7:19 
Generalauto-documentation Pin
Le centriste6-Jun-03 4:52
Le centriste6-Jun-03 4:52 
GeneralRe: auto-documentation Pin
Daniel Turini6-Jun-03 5:27
Daniel Turini6-Jun-03 5:27 
GeneralRe: auto-documentation Pin
Kannan Kalyanaraman6-Jun-03 5:29
Kannan Kalyanaraman6-Jun-03 5:29 
GeneralTx for both answers Pin
Le centriste6-Jun-03 5:42
Le centriste6-Jun-03 5:42 
Generalxlat MFC to C# (Thread question) Pin
albean6-Jun-03 3:04
albean6-Jun-03 3:04 
GeneralTurn off computer Pin
yarns5-Jun-03 20:49
yarns5-Jun-03 20:49 
GeneralRe: Turn off computer Pin
J. Dunlap5-Jun-03 20:57
J. Dunlap5-Jun-03 20:57 
GeneralRe: Turn off computer Pin
Member 128221435-Jun-03 21:18
Member 128221435-Jun-03 21:18 
GeneralRe: Turn off computer Pin
Nathan Blomquist6-Jun-03 2:33
Nathan Blomquist6-Jun-03 2:33 
GeneralRe: Turn off computer Pin
Bo Hunter6-Jun-03 5:43
Bo Hunter6-Jun-03 5:43 
GeneralPassing array of strings to unmanaged code Pin
Anonymous5-Jun-03 20:03
Anonymous5-Jun-03 20:03 
Does anyone know how to pass an array of strings using unmanaged code? I'm attempting to use unmanaged code to execute an external application with arguments, for example:

c:\matlab\bin\matlab.exe arg1 arg2

The code works fine when arg1 is substitued for a single space character, and matlab executes as if no arguments were passed in. However when arg1 and arg2 are string objects (containing meaningful arguments) in an array of strings, an exception is raised, stating:

"Object reference not set to an instance of an object"

The code which makes the call to the unmanaged code is basically:

public class Win32Wrapper
{
[DllImport("PFA_Win32.dll", EntryPoint="RunExternalApplication", CharSet=CharSet.Ansi)]
private static extern int RunExternalApplication(String application, String[] arguments);

public int RunApplication(String application, String[] arguments)
{
int result = RunExternalApplication(application, arguments);

return result;
}
}


The unmanaged code, written in C++, looks something like:

extern "C" PFA_WIN32_API int __stdcall RunExternalApplication(const char *app, const char *const *argv)
{
return _spawnv(_P_NOWAIT, app, argv);
}


I'd be most appreciative if anyone has done anything similar to this, or can see any flaws in the code.

Thanks
Ash
GeneralMemory Usage...(RSS Bandit) Pin
Kant5-Jun-03 18:16
Kant5-Jun-03 18:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.