473,320 Members | 1,580 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

Problem with dual mode executable (.exe)

I am trying to create a Dual mode tool (runs in both console and GUI mode)
similar to ILDASM.
This is my progra
---------------------------------------------------------------------------------------
using namespace winforms;
using namespace System::Runtime::InteropServices;

[DllImport("kernel32.dll")]
extern "C" bool FreeConsole(void);

[STAThreadAttribute]
int Main()
{
if ( 1 == (Environment::GetCommandLineArgs())->Length){
FreeConsole();
Application::EnableVisualStyles();
Application::EnableRTLMirroring();
Application::Run(gcnew Form1());
}
else {
Console::WriteLine(Environment::GetCommandLineArgs ()[1]);
}
return 0;

----------------------------------------------------------------------------------------
I also run a post build event to disguise this as a console app
editbin /subsystem:CONSOLE "$(TargetDir)$(TargetName).exe"

The .exe works fine so long as I execute it via explorer or put a command
line argument to it when I call it from the command console.

However, when I give no parameters while calling it at the command window
there is a hitch. The Window shows up as it should, but the console window is
not released even though FreeConsole returns true and GetLastError rerturns 0.

I am using managed C++ on VS.net 2005 beta along with, Microsoft.net
framework 2.

If you could provide some pointers, it would be very helpful. Thanks a lot
for your time and attention.

---------------------
Thanks
Rajiv Das
Nov 17 '05 #1
0 1021

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Pradeep | last post by:
DB2ers, I am a newbie to DB2 but have enough experience with other database servers. Many database servers such as SQLServer offer a dual-mode authentication mechanism, that is, either you can...
0
by: Rob | last post by:
Hi Visual Studio.NET 2002 v7.0 Windows XP (all service packs up to date) Working on Clearcase MVFS mapped drive. When compiling my ATL control, I always have to hit Rebuild Solution. If I...
2
by: Phil Atkin | last post by:
Hi, I'm currently wrapping my "legacy" COM component with a managed layer, to create a dual-mode component. The structure is very like the JrnlPost sample and the "Exploring COM...
2
by: John Suru | last post by:
When I try to run a vb.net exe from our Win2000 server, the "Just In Time Debugging" titled form pops up and reads, "An exception 'System.Security.SecurityException' has occured in...
2
by: zawpai | last post by:
Hello, I have a problem for creating the exe file. I can create it, but it shows "Run time error '76' " and "path not found". I don't know how I can solve that problem. Could anyone please show...
2
by: psbasha | last post by:
Hi, I have created a Executable ( Exe) of an Python application using Py2Exe.I have implemented for Batch or Interactive application run in the source code.But I able run the interactive...
2
by: aircraft | last post by:
Hi All, Is it possible to give a strong name to a mixed-mode executable? If it is not, can I sign only the managed part? How? Thanks AC
1
by: Manish | last post by:
Hi friends, Iam new to this group. I have problem with executing the output(exe) file in an another system. I have created and compiled in a VS 2005 tool. when i run the exe file in a new system....
5
by: veer | last post by:
Hi i am getting probleum in running the exe on any other location on my computer except bin\debug when i execute the exe file which is in bin\debug folder it works fine and when i copy this exe and...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.