Source file: /~heha/mb-iwp/Energiemessung/VIPsys3/vipsys3.zip/src/vipsys3.h

#pragma once

#define _WIN32_WINNT 0x0500
#if _MSC_VER > 1400
#define _INC_SWPRINTF_INL_
extern "C" int _declspec(dllimport) _cdecl swprintf(wchar_t*,const wchar_t*,...);
#endif
#include <windows.h>
#include <windowsx.h>
#include <shlwapi.h>
#include <commctrl.h>
#include <stdio.h>
#include <tchar.h>
#include <limits.h>

#define nobreak
#define elemof(x) (sizeof(x)/sizeof(*(x)))
#define T(x) TEXT(x)

#undef RtlMoveMemory
EXTERN_C void _declspec(dllimport) WINAPI RtlMoveMemory(PVOID,const VOID*,SIZE_T);

#if 0//ndef DWLP_USER
# define DWLP_USER DWL_USER
# define SetWindowLongPtr SetWindowLong
# define GetWindowLongPtr GetWindowLong
#endif

struct RECTS{
 short left,top,right,bottom;
 void operator=(const RECT&r) {	// set
  left=short(r.left);
  top=short(r.top);
  right=short(r.right);
  bottom=short(r.bottom);
 };
 void operator>>(RECT&r) const {	// get
  r.left=left;
  r.top=top;
  r.right=right;
  r.bottom=bottom;
 };
};

union TSel{
 DWORD u;
 struct{
  DWORD :1;
  DWORD f:1;	// Frequency
  DWORD I:1;	// Current
  DWORD U:1;	// Voltage
  DWORD P:1;	// Power
  DWORD S:1;	// Apparent Power
  DWORD Q:1;	// (double) Reverse Power
  DWORD d:1;	// THD
  DWORD c:1;	// cos phi *
  DWORD t:1;	// tan phi *
  DWORD W:1;	// Energy / Work *
  DWORD X:1;	// unused (Apparent Energy / Work)
  DWORD Y:1;	// (double) Reverse Energy / Work *
  DWORD a:1;	// two aux values
  DWORD :2;

  DWORD ph1:1;	// show values for Phase 1, etc.
  DWORD ph2:1;
  DWORD ph3:1;
  DWORD phS:1;	// show summed values, applies to Frequency too
  DWORD n:1;	// neutral column (current only)
  DWORD v:1;	// column for chained voltages U12, U23, and U31
  DWORD :2;

  DWORD inst:1;
  DWORD avg:1;
  DWORD peak:1;
  DWORD :1;
  DWORD tariff:4;// number of Tariff Periods (0..4)
 };		// * included in Tariff Periods
};

struct TConfig{
 RECTS winpos;		// "normale" Fensterposition
 char showCmd;		// SW_SHOWxxx
 union{
  BYTE checkBits;	// Einstellungs-Bits für Anzeige
  struct{
   BYTE doubleBuf:1;	// Doppel-Pufferung
   BYTE flashIcon:1;	// blinkendes Symbol
   BYTE unused:1;
   BYTE glassFx:1;	// Vista Glass effect (TODO)
   BYTE ddePoint:1;	// Use decimal point instead of Windows setting
  };
 };
 BYTE serialNo;		// 0..255 = COM-Port-Nummer, nullbasiert
 BYTE serialCfg;	// Bit 7-4: Baudrate {300,600,1200,2400,4800,9600}
			// Bit 3-2: Parität {N,O,E}
			// Bit 1:   Stoppbits {1,2}
			// Bit 0:   Datenbits {7,8}
 TSel sel;
 BYTE valEnable[28];
};

extern HINSTANCE ghInst;
extern TCHAR StdMBoxTitle[64];
extern TConfig Config;

void _fastcall InitStruct(LPVOID,DWORD);
void SetCheckboxGroup(HWND,UINT,UINT,UINT);
UINT GetCheckboxGroup(HWND,UINT,UINT);
int MyLoadStringW(UINT id, LPWSTR buf, int len);
int toStringW(double f, PWSTR s, int l);

struct DLGCONFIG{
 HWND Wnd;
 BYTE serialNo;		// zero-based
 BYTE serialCfg;
 BYTE checkBits;
 static INT_PTR CALLBACK DlgProc(HWND,UINT,WPARAM,LPARAM);
 static void SetDCB(DCB&,BYTE);
 void ParameterDlg();
};

struct DLGDATASEL{
 TSel sel;
 static INT_PTR CALLBACK DlgProc(HWND,UINT,WPARAM,LPARAM);
};
Detected encoding: ANSI (CP1252)4
Wrong umlauts? - Assume file is ANSI (CP1252) encoded