Код: Выделить всё
[DllImport("coredll.dll")]
private extern static void GetSystemTime(ref SYSTEMTIME lpSystemTime);
Код: Выделить всё
System.BadImageFormatException не обработано
Message="Была сделана попытка загрузить программу, имеющую неверный формат. (Исключение из HRESULT: 0x8007000B)"
Source="dyakov_2"
StackTrace:
в dyakov_2.Form1.GetSystemTime(SYSTEMTIME& lpSystemTime)
в dyakov_2.Form1.textBox1_KeyDown(Object sender, KeyEventArgs e) в c:\Documents and Settings\BattleMage\Мои документы\Visual Studio 2008\Projects\dyakov_2\dyakov_2\Form1.cs:строка 38
в System.Windows.Forms.Control.OnKeyDown(KeyEventArgs e)
в System.Windows.Forms.Control.ProcessKeyEventArgs(Message& m)
в System.Windows.Forms.Control.ProcessKeyMessage(Message& m)
в System.Windows.Forms.Control.WmKeyChar(Message& m)
в System.Windows.Forms.Control.WndProc(Message& m)
в System.Windows.Forms.TextBoxBase.WndProc(Message& m)
в System.Windows.Forms.TextBox.WndProc(Message& m)
в System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
в System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
в System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
в System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
в System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32 dwComponentID, Int32 reason, Int32 pvLoopData)
в System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
в System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
в System.Windows.Forms.Application.Run(Form mainForm)
в dyakov_2.Program.Main() в C:\Documents and Settings\BattleMage\Мои документы\Visual Studio 2008\Projects\dyakov_2\dyakov_2\Program.cs:строка 18
в System.AppDomain._nExecuteAssembly(Assembly assembly, String[] args)
в System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
в Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
в System.Threading.ThreadHelper.ThreadStart_Context(Object state)
в System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
в System.Threading.ThreadHelper.ThreadStart()
InnerException:
код такой:
Код: Выделить всё
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Runtime.InteropServices;
namespace dyakov_2
{
public partial class Form1 : Form
{
[DllImport("coredll.dll")]
private extern static void GetSystemTime(ref SYSTEMTIME lpSystemTime);
private struct SYSTEMTIME
{
public ushort wYear;
public ushort wMonth;
public ushort wDayOfWeek;
public ushort wDay;
public ushort wHour;
public ushort wMinute;
public ushort wSecond;
public ushort wMilliseconds;
}
public Form1()
{
InitializeComponent();
}
private void textBox1_KeyDown(object sender, KeyEventArgs e)
{
SYSTEMTIME stime = new SYSTEMTIME();
GetSystemTime(ref stime);
MessageBox.Show("Current Time: " + stime.wHour.ToString() + ":" + stime.wMinute.ToString());
}
private void textBox1_KeyUp(object sender, KeyEventArgs e)
{
SYSTEMTIME stime = new SYSTEMTIME();
GetSystemTime(ref stime);
MessageBox.Show("Current Time: " + stime.wHour.ToString() + ":" + stime.wMinute.ToString());
}
}
}
или вообще в другом проблема? очень надо - помогите, пожалуйста
