internal static extern UINT GetRegisteredRawInputDevices( [Out] RawInput[] RawInputDevices, [In, Out] ref UINT NumDevices, UINT cbSize );
public override ScalarValue Decode(System.IO.Stream in_Renamed) { int intValue = ((IntegerValue)UINT.Decode(in_Renamed)).value_Renamed; System.DateTime tempAux = Util.ToTimestamp(intValue); return(new DateValue(ref tempAux)); }
bool Check_overflow(UINT value) { if (rebuff.rp <= rebuff.wp)//说明写指针未回溯 { if (rebuff.rp + value <= rebuff.wp) { return(true); } else { return(false); } } else { if (rebuff.rp + value <= (rebuff.wp + RE_BUFFER_SIZE)) { return(true); } else { return(false); } } }
public static extern int DrawTextW( HDC hdc, [MarshalAs(UnmanagedType.LPWStr)] string lpchText, int cchText, [In] ref RECT lprc, UINT format );
/// <summary> /// コールバック関数。バッファの再生終了を検出するために使用。 /// </summary> /// <param name="hwo"></param> /// <param name="uMsg"></param> /// <param name="dwInstance"></param> /// <param name="dwParam1"></param> /// <param name="dwParam2"></param> public static void SoundCallback( IntPtr hwo, UINT uMsg, DWORD dwInstance, DWORD dwParam1, DWORD dwParam2) { if (uMsg != win32.MM_WOM_DONE) { return; } for (int i = 0; i < NUM_BUF; i++) { fixed(WAVEHDR *p = &wave_header[i]) { if (p != (WAVEHDR *)dwParam1) { continue; } } wave_done[i] = true; break; } }
void Extract_TXXX(UCHR[] buf, UINT i) { txxx.xxlb = buf[((i + 10) & RE_BUFFER_SIZE)]; txxx.fxfdz[0] = buf[((i + 11) & RE_BUFFER_SIZE)]; txxx.fxfdz[1] = buf[((i + 12) & RE_BUFFER_SIZE)]; txxx.fxfdz[2] = buf[((i + 13) & RE_BUFFER_SIZE)]; txxx.fxsj_h = buf[((i + 14) & RE_BUFFER_SIZE)]; txxx.fxsj_m = buf[((i + 15) & RE_BUFFER_SIZE)]; txxx.dwcd = UCHRtoUINT(buf[((i + 16) & RE_BUFFER_SIZE)], buf[((i + 17) & RE_BUFFER_SIZE)]); txxx.dwnr = new UCHR[txxx.dwcd / 8]; for (UINT ii = 0; ii * 8 < txxx.dwcd; ++ii) { txxx.dwnr[ii] = buf[((i + 18 + ii) & RE_BUFFER_SIZE)]; } UINT temp = txxx.dwcd / 8; Analysis_data(ref txxx.fxfdz, ref txxx.fxsj_h, ref txxx.fxsj_m, ref txxx.dwnr, ref temp); //注意有长度无内容的情况 TODO //注意长度不是字节整数 if (txxx.dwcd % 8 == 0) { txxx.crc = buf[((i + 18 + txxx.dwcd / 8) & RE_BUFFER_SIZE)]; } else { txxx.crc = buf[((i + 18 + txxx.dwcd / 8 + 1) & RE_BUFFER_SIZE)]; } //print_txxx(); print_flag |= PRINT_TXXX; }
void Extract_GNPX(UCHR[] buf, UINT i) { gnpx.jdfw = buf[((i + 10) & RE_BUFFER_SIZE)]; gnpx.jd = buf[((i + 11) & RE_BUFFER_SIZE)]; gnpx.jf = buf[((i + 12) & RE_BUFFER_SIZE)]; gnpx.jm = buf[((i + 13) & RE_BUFFER_SIZE)]; gnpx.jxm = buf[((i + 14) & RE_BUFFER_SIZE)]; gnpx.wdfw = buf[((i + 15) & RE_BUFFER_SIZE)]; gnpx.wd = buf[((i + 16) & RE_BUFFER_SIZE)]; gnpx.wf = buf[((i + 17) & RE_BUFFER_SIZE)]; gnpx.wm = buf[((i + 18) & RE_BUFFER_SIZE)]; gnpx.wxm = buf[((i + 19) & RE_BUFFER_SIZE)]; gnpx.gd = UCHRtoINT(buf[((i + 20) & RE_BUFFER_SIZE)], buf[((i + 21) & RE_BUFFER_SIZE)]); gnpx.sd = UCHRtoUINT(buf[((i + 22) & RE_BUFFER_SIZE)], buf[((i + 23) & RE_BUFFER_SIZE)]); gnpx.fx = UCHRtoUINT(buf[((i + 24) & RE_BUFFER_SIZE)], buf[((i + 25) & RE_BUFFER_SIZE)]); gnpx.wxs = buf[((i + 26) & RE_BUFFER_SIZE)]; gnpx.zt = buf[((i + 27) & RE_BUFFER_SIZE)]; gnpx.jdxs = buf[((i + 28) & RE_BUFFER_SIZE)]; gnpx.gjwc = UCHRtoUINT(buf[((i + 29) & RE_BUFFER_SIZE)], buf[((i + 30) & RE_BUFFER_SIZE)]); // print_gnpx(); Handle_GNPX(); print_flag |= PRINT_GNPX; if ((status & ~(STATUS_BIT_ANSWER | STATUS_BIT_CONFIRM)) == STEP_GNPS) { status |= Convert.ToByte(STATUS_BIT_ANSWER | STATUS_BIT_CONFIRM); } }
public override byte[] EncodeValue(ScalarValue value_Renamed) { System.DateTime date = ((DateValue)value_Renamed).value_Renamed; int intValue = Util.TimeToInt(ref date); return(UINT.Encode(new IntegerValue(intValue))); }
void Handle_GNPX() { if (First_Run_POS == true && gnpx.zt == 1) { if (count_time == 0) { if (BaiduAPI.Geocoding_API(Convert.ToString((((gnpx.wxm / 60.0) + gnpx.wm) / 60.0 + gnpx.wf) / 60.0 + gnpx.wd), Convert.ToString((((gnpx.jxm / 60.0) + gnpx.jm) / 60.0 + gnpx.jf) / 60.0 + gnpx.jd), ref address) == true) { First_Run_POS = false; } else { count_time += BD_PRINT_GNPX_SEQ; } print_flag |= PRINT_FIRST_ADDRESS; } else { count_time += BD_PRINT_GNPX_SEQ; if (count_time >= 60)//如果调用API失败,控制在60秒内不再调用 { count_time = 0; } } } }
void Analysis_data(ref UCHR[] fxfdz, ref UCHR h, ref UCHR m, ref UCHR[] buffer, ref UINT package_length) { UINT crc = 0, crc1 = 0; UINT length, length1; if (buffer[package_length - 1] != 0x16) { return; } else if (buffer[0] == 0x11) { length1 = length = ((UINT)buffer[1] << 8) + (UINT)buffer[2]; crc = Convert.ToUInt32(((((UINT)buffer[length + 1]) << 8) & 0xff00) + (buffer[length + 2] & 0x00ff)); if (length1 < package_length) { for (; length1 > 0; length1--) { crc1 += buffer[length1]; } if (crc == crc1) { UINT _LENGTH = length - 2; UCHR[] exdata = new UCHR[_LENGTH]; System.Buffer.BlockCopy(buffer, 3, exdata, 0, Convert.ToInt32(_LENGTH)); DATA_Handler(ref fxfdz, ref h, ref m, ref exdata, ref _LENGTH); } } } }
void TXSQ_send(UCHR[] buffer, UINT len, UCHR[] dis) { UINT lenth = BD_TXSQ.lenth + len, i = 0;; // UCHR[] sendbuffer = Encoding.Default.GetBytes("$TXSQ0?00000?");//最多只能发送210字节,这张卡是628bit UCHR[] sendbuffer = new UCHR[lenth]; sendbuffer[0] = (byte)'$'; sendbuffer[1] = (byte)'T'; sendbuffer[2] = (byte)'X'; sendbuffer[3] = (byte)'S'; sendbuffer[4] = (byte)'Q'; sendbuffer[5] = Convert.ToByte(lenth >> 8); sendbuffer[6] = Convert.ToByte(lenth & 0xff); sendbuffer[7] = icxx.yhdz[0]; sendbuffer[8] = icxx.yhdz[1]; sendbuffer[9] = icxx.yhdz[2]; sendbuffer[10] = 0B01000110; sendbuffer[11] = dis[0]; sendbuffer[12] = dis[1]; sendbuffer[13] = dis[2]; sendbuffer[14] = Convert.ToByte((len * 8) >> 8); sendbuffer[15] = Convert.ToByte((len * 8) & 0xff); sendbuffer[16] = 0; for (; i < len; ++i) { sendbuffer[17 + i] = buffer[i]; } sendbuffer[lenth - 1] = Xor_checksum(ref sendbuffer, lenth - 1); mycom.Send(sendbuffer); }
public DRAWTEXTPARAMS(int tabLength) { cbSize = (uint)Marshal.SizeOf <DRAWTEXTPARAMS>(); iTabLength = tabLength; iLeftMargin = 0; iRightMargin = 0; uiLengthDrawn = 0; }
public static extern int DrawTextExW( HDC hdc, [MarshalAs(UnmanagedType.LPWStr)] string lpchText, int cchText, ref RECT lprc, UINT format, ref DRAWTEXTPARAMS lpdtp );
void LeftButtonDblClk(UINT nFlags, CPoint point) { CShowBatterDlg dlg; dlg.m_pBatter = m_pSlot->m_pBatter; dlg.DoModal(); }
private static extern HBITMAP CreateDIBSection( HDC hdc, ref BITMAPINFO pbmi, UINT usage, out IntPtr ppvBits, HANDLE hSection, DWORD offset );
public override void init() { base.init(); mState = null; mParam = null; mOutStateID = null; mStateTime = -1.0f; mStateID = 0; }
public override byte[] EncodeValue(ScalarValue v) { if (v.Null) { return(NULL_VALUE_ENCODING); } return(UINT.EncodeValue(((NumericValue)v).Increment())); }
public static extern HICON CreateIconFromResourceEx( PBYTE presbits, DWORD dwResSize, int fIcon, DWORD dwVer, int cxDesired, int cyDesired, UINT Flags );
public override void resetProperty() { base.resetProperty(); mStateType = null; mParam = null; mOutStateID = null; mStateTime = -1.0f; mStateID = 0; }
public override ScalarValue Decode(System.IO.Stream in_Renamed) { long longValue = UINT.Decode(in_Renamed).ToLong(); var year = (int)(longValue / 10000); var month = (int)((longValue - (year * 10000)) / 100); var day = (int)(longValue % 100); System.DateTime tempAux = Util.Date(year, month, day); return(new DateValue(ref tempAux)); }
void Extract_FKXX(UCHR[] buf, UINT i) { fkxx.flbz = buf[((i + 10) & RE_BUFFER_SIZE)]; fkxx.fjxx[0] = buf[((i + 11) & RE_BUFFER_SIZE)]; fkxx.fjxx[1] = buf[((i + 12) & RE_BUFFER_SIZE)]; fkxx.fjxx[2] = buf[((i + 13) & RE_BUFFER_SIZE)]; fkxx.fjxx[3] = buf[((i + 14) & RE_BUFFER_SIZE)]; Handle_FXXX(); print_flag |= PRINT_FKXX; // print_fkxx(); }
public override ScalarValue Decode(System.IO.Stream in_Renamed) { var value_Renamed = (NumericValue)UINT.Decode(in_Renamed); if (value_Renamed.Equals(0)) { return(null); } return(value_Renamed.Decrement()); }
public override byte[] Encode(ScalarValue value_Renamed) { byte[] bytes = value_Renamed.Bytes; int lengthSize = IntegerCodec.GetUnsignedIntegerSize(bytes.Length); var encoding = new byte[bytes.Length + lengthSize]; byte[] length = UINT.Encode(new IntegerValue(bytes.Length)); Array.Copy(length, 0, encoding, 0, lengthSize); Array.Copy(bytes, 0, encoding, lengthSize, bytes.Length); return(encoding); }
public void BD_send(ref UCHR[] buffer, UINT len, UCHR[] dis) { if (len > 0)//BSGL != 0 && error_flag == 0 &&SEND_BLOCKTIME == 0 && { UCHR[] send_buffer; send_buffer = new UCHR[len + DATA_FIRM_LENTH]; TXSQ_send(Data_encapsulation(send_buffer, ref buffer, ref len), len + DATA_FIRM_LENTH, dis); } else { } }
/* * 发送用 * 异或校验和算法 */ UCHR Xor_checksum(ref UCHR[] buf, UINT len) { UINT i; UCHR checksum = 0; for (i = 0; i < len; ++i) { checksum ^= buf[i]; } return(checksum); }
/* * 接收用 * 异或校验和算法 */ UCHR Xor_checksum(ref UCHR[] buf, UINT location, UINT len) { UINT i, ii; UCHR checksum = 0; for (i = 0; i < len; ++i) { ii = (location + i) & RE_BUFFER_SIZE; checksum ^= buf[ii]; } return(checksum); }
void Thread_Check() { while (true) { Check_status(); if (SEND_BLOCKTIME != 0) { --SEND_BLOCKTIME; print_flag |= PRINT_BLOCK; } Thread.Sleep(1000); } }
protected static Int32 __WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { DuiHostFormBase hostForm = null; if (msg == WindowMessages.WM_NCCREATE) { var lpcs = (LPCREATESTRUCT)Marshal.PtrToStructure((IntPtr)lParam, typeof(LPCREATESTRUCT)); IntPtr pHostForm = new IntPtr(lpcs.lpCreateParams); var gch = GCHandle.FromIntPtr(pHostForm); hostForm = gch.Target as DuiHostFormBase; if (hostForm != null) { hostForm.m_hWnd = hWnd; NativeMethods.SetWindowLong(hWnd, (int)SetWindowLongOffsets.GWL_USERDATA, pHostForm); } } else { IntPtr pHostForm = NativeMethods.GetWindowLong(hWnd, SetWindowLongOffsets.GWL_USERDATA); try { var gch = GCHandle.FromIntPtr(pHostForm); hostForm = gch.Target as DuiHostFormBase; } catch { } if (msg == WindowMessages.WM_NCDESTROY && hostForm != null) { LRESULT lRes = NativeMethods.CallWindowProc(hostForm.m_defWindowProc, hWnd, (int)msg, (IntPtr)wParam, (IntPtr)lParam).ToInt32(); NativeMethods.SetWindowLong(hWnd, (int)SetWindowLongOffsets.GWL_USERDATA, IntPtr.Zero); if (hostForm.m_bSubclassed) { hostForm.Unsubclass(); } hostForm.m_hWnd = IntPtr.Zero; hostForm.OnFinalMessage(hWnd); return(lRes); } } if (hostForm != null) { return(hostForm.HandleMessage(msg, wParam, lParam)); } else { return(NativeMethods.DefWindowProc(hWnd, (int)msg, new IntPtr(wParam), new IntPtr(lParam)).ToInt32()); } }
void Extract_SJXX(UCHR[] buf, UINT i) { sjxx.year = UCHRtoUINT(buf[((i + 10) & RE_BUFFER_SIZE)], buf[((i + 11) & RE_BUFFER_SIZE)]); sjxx.month = buf[((i + 12) & RE_BUFFER_SIZE)]; sjxx.day = buf[((i + 13) & RE_BUFFER_SIZE)]; sjxx.hour = buf[((i + 14) & RE_BUFFER_SIZE)]; sjxx.minute = buf[((i + 15) & RE_BUFFER_SIZE)]; sjxx.second = buf[((i + 16) & RE_BUFFER_SIZE)]; // print_sjxx(); print_flag |= PRINT_SJXX; if ((status & ~(STATUS_BIT_ANSWER | STATUS_BIT_CONFIRM)) == STEP_SJSC) { status |= Convert.ToByte(STATUS_BIT_ANSWER | STATUS_BIT_CONFIRM); } }
void Extract_GNTX(UCHR[] buf, UINT i) { gntx.sqlx = Convert.ToSByte(buf[((i + 10) & RE_BUFFER_SIZE)]); gntx.year = Convert.ToUInt32(buf[((i + 11) & RE_BUFFER_SIZE)]) + 2000; gntx.month = buf[((i + 12) & RE_BUFFER_SIZE)]; gntx.day = buf[((i + 13) & RE_BUFFER_SIZE)]; gntx.hour = buf[((i + 14) & RE_BUFFER_SIZE)]; gntx.minute = buf[((i + 15) & RE_BUFFER_SIZE)]; gntx.second = buf[((i + 16) & RE_BUFFER_SIZE)]; // print_gntx(); print_flag |= PRINT_GNTX; if ((status & ~(STATUS_BIT_ANSWER | STATUS_BIT_CONFIRM)) == STEP_GNTS) { status |= Convert.ToByte(STATUS_BIT_ANSWER | STATUS_BIT_CONFIRM); } }
public override ScalarValue Decode(System.IO.Stream in_Renamed) { int intValue = ((IntegerValue)UINT.Decode(in_Renamed)).value_Renamed; int hour = intValue / 10000000; intValue -= hour * 10000000; int minute = intValue / 100000; intValue -= minute * 100000; int second = intValue / 1000; intValue -= second * 1000; int millisecond = intValue % 1000; var tempAux = new DateTime(hour * 3600000 + minute * 60000 + second * 1000 + millisecond); return(new DateValue(ref tempAux)); }
public override ScalarValue Decode(System.IO.Stream in_Renamed) { int length = ((IntegerValue)UINT.Decode(in_Renamed)).value_Renamed; var encoding = new byte[length]; for (int i = 0; i < length; i++) { try { encoding[i] = (byte)in_Renamed.ReadByte(); } catch (System.IO.IOException e) { throw new RuntimeException(e); } } return(new ByteVectorValue(encoding)); }
public static extern DWORD_PTR SHGetFileInfo(LPCTSTR pszPath, DWORD dwFileAttributes, ref SHFILEINFO psfi, UINT cbFileInfo, ShGetFileIconFlags uFlags);
public static extern UINT_PTR SetTimer(HWND hWnd, UINT_PTR nIDEvent, UINT uElapse, TIMERPROC lpTimerFunc);
internal static extern UINT GetRawInputDeviceList( [In, Out] IntPtr RawInputDeviceList, [In, Out] ref UINT NumDevices, UINT Size );
internal static extern BOOL RegisterRawInputDevices( RawInputDevice[] RawInputDevices, UINT NumDevices, UINT Size );
unsafe internal static extern LRESULT DefRawInputProc(IntPtr RawInput, INT Input, UINT SizeHeader);
internal static extern UINT GetRawInputData( HRAWINPUT RawInput, GetRawInputDataEnum Command, /*[MarshalAs(UnmanagedType.LPStruct)]*/ [Out] out RawInput Data, [In, Out] ref UINT Size, UINT SizeHeader );
public static extern BOOL TerminateProcess(HANDLE hProcess, UINT uExitCode);
public static extern bool mciGetErrorStringA( uint mcierr, [MarshalAs( UnmanagedType.LPStr )] string pszText, UINT cchText );
public static extern uint waveOutUnprepareHeader( IntPtr hwo, ref WAVEHDR pwh, UINT cbwh );
public static extern uint waveOutGetPosition( IntPtr hwo, ref MMTIME pmmt, UINT cbmmt );
internal static extern UINT MapVirtualKey(UINT uCode, MapVirtualKeyType uMapType);
internal static extern LRESULT DefRawInputProc(RawInput[] RawInput, INT Input, UINT SizeHeader);
internal static extern UINT GetRawInputData( HRAWINPUT RawInput, GetRawInputDataEnum Command, [Out] LPVOID Data, [In, Out] ref UINT Size, UINT SizeHeader );
internal static extern LRESULT CallWindowProc( WNDPROC lpPrevWndFunc, HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam );