Имя: Пароль:
IT
 
Как не показывать окно консоли в VB.NET?
0 Armando
 
20.02.13
00:16
Создал утилиту на бейсике.
При выполнении появляется консольное окно. Оно мне не надо. Как сделать, что бы оно не появлялось?
1 Armando
 
20.02.13
09:27
^
2 ДенисЧ
 
20.02.13
09:31
Как запускаешь? И вообще - зачем ты сделал там это окно?
3 Armando
 
20.02.13
09:35
>> Как запускаешь?
Ентером нажимаю

>> И вообще - зачем ты сделал там это окно?
Я его не делал.
Вот модуль:
Module Module1

   Sub Main(ByVal Args() As String)

       If Args.Length = 1 Then
           If Not System.Windows.Forms.Clipboard.GetDataObject() Is Nothing Then
               Dim oDataObj As System.Windows.Forms.IDataObject = System.Windows.Forms.Clipboard.GetDataObject()
               If oDataObj.GetDataPresent(System.Windows.Forms.DataFormats.Bitmap) Then
                   Dim oImgObj As System.Drawing.Image = oDataObj.GetData(System.Windows.Forms.DataFormats.Bitmap, True)
                   oImgObj.Save(Args(0), System.Drawing.Imaging.ImageFormat.Png)
               End If
           End If
       End If

   End Sub

End Module

Компилирую вот так:
vbc.exe c:\temp\1.vb
4 oleg_km
 
20.02.13
09:40
Значит не нужно было делать консольное приложение, сделай обычное оконное, которое на старте не будет показывать окно
5 Armando
 
20.02.13
09:45
(4) Как? Помню в студии выбираешь при создании проекта. Сейчас у меня студии нет. Только блокнот.
6 oleg_km
 
20.02.13
11:11
(6) Могу создать пустой оконный проект на VB и выслать, а ты посмотришь какой ключик подправить. Там вроде конфигурационные файлы текстовые
7 oleg_km
 
20.02.13
11:12
Бляха, соврал не могу, стоит только Си++ и Си-шарп
8 Armando
 
20.02.13
11:52
(7) давай на шарпе хотя бы) разберусь.
на помойку какую-нибудь положи, пожалуйста
9 oleg_km
 
20.02.13
12:42
Не дружу я с помойками, лови так:

Файл .csproj

<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
 <PropertyGroup>
   <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
   <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
   <ProductVersion>8.0.30703</ProductVersion>
   <SchemaVersion>2.0</SchemaVersion>
   <ProjectGuid>{F68496D1-BBD9-448D-B105-FFD5F4D0F0EF}</ProjectGuid>
   <OutputType>WinExe</OutputType>
   <AppDesignerFolder>Properties</AppDesignerFolder>
   <RootNamespace>_1CRunEx</RootNamespace>
   <AssemblyName>1CRunEx</AssemblyName>
   <TargetFrameworkVersion>v2.0</TargetFrameworkVersion>
   <TargetFrameworkProfile>
   </TargetFrameworkProfile>
   <FileAlignment>512</FileAlignment>
   <IsWebBootstrapper>false</IsWebBootstrapper>
   <PublishUrl>publish\</PublishUrl>
   <Install>true</Install>
   <InstallFrom>Disk</InstallFrom>
   <UpdateEnabled>false</UpdateEnabled>
   <UpdateMode>Foreground</UpdateMode>
   <UpdateInterval>7</UpdateInterval>
   <UpdateIntervalUnits>Days</UpdateIntervalUnits>
   <UpdatePeriodically>false</UpdatePeriodically>
   <UpdateRequired>false</UpdateRequired>
   <MapFileExtensions>true</MapFileExtensions>
   <ApplicationRevision>0</ApplicationRevision>
   <ApplicationVersion>1.0.0.%2a</ApplicationVersion>
   <UseApplicationTrust>false</UseApplicationTrust>
   <BootstrapperEnabled>true</BootstrapperEnabled>
 </PropertyGroup>
 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
   <PlatformTarget>x86</PlatformTarget>
   <DebugSymbols>true</DebugSymbols>
   <DebugType>full</DebugType>
   <Optimize>false</Optimize>
   <OutputPath>bin\Debug\</OutputPath>
   <DefineConstants>DEBUG;TRACE</DefineConstants>
   <ErrorReport>prompt</ErrorReport>
   <WarningLevel>4</WarningLevel>
   <UseVSHostingProcess>false</UseVSHostingProcess>
 </PropertyGroup>
 <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
   <PlatformTarget>x86</PlatformTarget>
   <DebugType>pdbonly</DebugType>
   <Optimize>true</Optimize>
   <OutputPath>bin\Release\</OutputPath>
   <DefineConstants>TRACE</DefineConstants>
   <ErrorReport>prompt</ErrorReport>
   <WarningLevel>4</WarningLevel>
 </PropertyGroup>
 <PropertyGroup>
   <TargetZone>LocalIntranet</TargetZone>
 </PropertyGroup>
 <PropertyGroup>
   <GenerateManifests>false</GenerateManifests>
 </PropertyGroup>
 <PropertyGroup>
   <ApplicationManifest>Properties\app.manifest</ApplicationManifest>
 </PropertyGroup>
 <ItemGroup>
   <Compile Include="FormMain.cs">
     <SubType>Form</SubType>
   </Compile>
   <Compile Include="FormMain.Designer.cs">
     <DependentUpon>FormMain.cs</DependentUpon>
   </Compile>
   <Compile Include="Program.cs" />
   <Compile Include="Properties\AssemblyInfo.cs" />
   <EmbeddedResource Include="FormMain.resx">
     <DependentUpon>FormMain.cs</DependentUpon>
   </EmbeddedResource>
   <EmbeddedResource Include="Properties\Resources.resx">
     <Generator>ResXFileCodeGenerator</Generator>
     <LastGenOutput>Resources.Designer.cs</LastGenOutput>
     <SubType>Designer</SubType>
   </EmbeddedResource>
   <Compile Include="Properties\Resources.Designer.cs">
     <AutoGen>True</AutoGen>
     <DependentUpon>Resources.resx</DependentUpon>
     <DesignTime>True</DesignTime>
   </Compile>
   <None Include="app.config" />
   <None Include="Properties\app.manifest" />
   <None Include="Properties\Settings.settings">
     <Generator>SettingsSingleFileGenerator</Generator>
     <LastGenOutput>Settings.Designer.cs</LastGenOutput>
   </None>
   <Compile Include="Properties\Settings.Designer.cs">
     <AutoGen>True</AutoGen>
     <DependentUpon>Settings.settings</DependentUpon>
     <DesignTimeSharedInput>True</DesignTimeSharedInput>
   </Compile>
 </ItemGroup>
 <ItemGroup>
   <BootstrapperPackage Include=".NETFramework,Version=v4.0,Profile=Client">
     <Visible>False</Visible>
     <ProductName>Microsoft .NET Framework 4 Client Profile %28x86 and x64%29</ProductName>
     <Install>true</Install>
   </BootstrapperPackage>
   <BootstrapperPackage Include="Microsoft.Net.Client.3.5">
     <Visible>False</Visible>
     <ProductName>.NET Framework 3.5 SP1 Client Profile</ProductName>
     <Install>false</Install>
   </BootstrapperPackage>
   <BootstrapperPackage Include="Microsoft.Net.Framework.3.5.SP1">
     <Visible>False</Visible>
     <ProductName>.NET Framework 3.5 SP1</ProductName>
     <Install>false</Install>
   </BootstrapperPackage>
   <BootstrapperPackage Include="Microsoft.Windows.Installer.3.1">
     <Visible>False</Visible>
     <ProductName>Windows Installer 3.1</ProductName>
     <Install>true</Install>
   </BootstrapperPackage>
 </ItemGroup>
 <ItemGroup>
   <Reference Include="System" />
   <Reference Include="System.Drawing" />
   <Reference Include="System.Windows.Forms" />
 </ItemGroup>
 <ItemGroup>
   <Content Include="KB.txt" />
 </ItemGroup>
 <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
 <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
      Other similar extension points exist, see Microsoft.Common.targets.
 <Target Name="BeforeBuild">
 </Target>
 <Target Name="AfterBuild">
 </Target>
 -->
</Project>

Вроде ключевой параметр:
   <OutputType>WinExe</OutputType>
10 djekting
 
20.02.13
12:46
ShowWindow(hwndClosole,SW_HIDE);
Программист всегда исправляет последнюю ошибку.