hmm c++ i recoommend but c and c++ is quite similar until u start getting to a few high level points which u may or may not be able to use in your projects
i actually prefer C because pellesC is free, has a well developed ide, supports stringtables, and should work with globstruct.h(havent tested using it any but the actual file compiles)
#include <windows.h> // Win32 Header File
#include <windowsx.h> // Win32 Header File
#include <commctrl.h> // Win32 Header File
#include <mmsystem.h> // Win32 Header File
#include <shellapi.h> // Win32 Header File
#include <shlobj.h> // Win32 Header File
#include <richedit.h> // Win32 Header File
#include <wchar.h> // Win32 Header File
#include <objbase.h> // Win32 Header File
#include <ocidl.h> // Win32 Header File
#include <winuser.h> // Win32 Header File
#include <olectl.h> // Win32 Header File
#include <oaidl.h> // Win32 Header File
#include <ole2.h> // Win32 Header File
#include <oleauto.h> // Win32 Header File
#include <conio.h>
//#include <direct.h>
#include <ctype.h>
#include <io.h>
#include <math.h>
#include <stdio.h>
#include <string.h>
#include <stddef.h>
#include <stdlib.h>
#include <setjmp.h>
#include <time.h>
#include <stdarg.h>
#include <process.h>
/*
// ***************************************************
// Compiler Defines
// ***************************************************
// C++
#if defined( __cplusplus )
#endif
// LCCWIN32 defs
#if defined( __LCC__ )
#define USE_LCCWIN32C
#endif
// MingW32 defs
#if defined( __MINGW32__ )
#define USE_MINGW32C
#endif
*/
// PellesC defs
#if defined( __POCC__ )
#ifndef _WINDOWS_H
#include <windows.h>
#endif
#define USE_PELLESC
#if !defined( __POCC__OLDNAMES )
#define O_RDONLY _O_RDONLY
#define O_WRONLY _O_WRONLY
#define O_RDWR _O_RDWR
#define O_APPEND _O_APPEND
#define O_CREAT _O_CREAT
#define O_TRUNC _O_TRUNC
#define O_EXCL _O_EXCL
#define O_TEXT _O_TEXT
#define O_BINARY _O_BINARY
#define O_NOINHERIT _O_NOINHERIT
#define O_TEMPORARY _O_TEMPORARY
#define O_SEQUENTIAL _O_SEQUENTIAL
#define O_RANDOM _O_RANDOM
#define SH_DENYRW _SH_DENYRW
#define SH_DENYWR _SH_DENYWR
#define SH_DENYRD _SH_DENYRD
#define SH_DENYNO _SH_DENYNO
#define S_IREAD _S_IREAD
#define S_IWRITE _S_IWRITE
#define LK_UNLCK _LK_UNLCK
#define LK_LOCK _LK_LOCK
#define LK_NBLCK _LK_NBLCK
#define LK_RLCK _LK_RLCK
#define LK_NBRLCK _LK_NBRLCK
#define P_WAIT _P_WAIT
#define P_NOWAIT _P_NOWAIT
#define P_OVERLAY _P_OVERLAY
#define P_NOWAITO _P_NOWAITO
#define P_DETACH _P_DETACH
#define access _access
#define chdir _chdir
#define chmod _chmod
#define chsize _chsize
#define close _close
#define creat _creat
#define cwait _cwait
#define dup _dup
#define dup2 _dup2
#define eof _eof
#define fdopen _fdopen
#define filelength _filelength
#define fileno _fileno
#define fstat _fstat
#define ftime _ftime
#define getch _getch
#define getche _getche
#define getcwd _getcwd
#define getpid _getpid
#define inp _inp
#define inp _inp
#define inpd _inpd
#define inpw _inpw
#define inpw _inpw
#define isascii _isascii
#define isatty _isatty
#define itoa _itoa
#define kbhit _kbhit
#define locking _locking
#define lrotl _lrotl
#define lrotr _lrotr
#define lseek _lseek
#define ltoa _ltoa
#define memicmp _memicmp
#define mkdir _mkdir
#define open _open
#define out _out
#define outp _outp
#define outpd _outpd
#define outpw _outpw
#define outw _outw
#define putch _putch
#define putenv _putenv
#define read _read
#define rmdir _rmdir
#define rotl _rotl
#define rotr _rotr
#define setmode _setmode
#define sopen _sopen
#define spawnl _spawnl
#define spawnle _spawnle
#define spawnlp _spawnlp
#define spawnlpe _spawnlpe
#define spawnv _spawnv
#define spawnve _spawnve
#define spawnvp _spawnvp
#define spawnvpe _spawnvpe
#define stat _stat
#define strdup _strdup
#define stricmp _stricmp
#define strlwr _strlwr
#define strnicmp _strnicmp
#define strnset _strnset
#define strrev _strrev
#define strupr _strupr
#define tell _tell
#define ultoa _ultoa
#define ungetch _ungetch
#define unlink _unlink
#define utime _utime
#define wascii _wascii
#define wcsdup _wcsdup
#define wcsicmp _wcsicmp
#define wcslwr _wcslwr
#define wcsnicmp _wcsnicmp
#define wcsnset _wcsnset
#define wcsrev _wcsrev
#define wcsupr _wcsupr
#define write _write
#endif
#define _asm __asm
#define strdate _strdate
// ===== PellesC Libraries ==========
#pragma comment(lib,"kernel32.lib")
#pragma comment(lib,"user32.lib")
#pragma comment(lib,"gdi32.lib")
#pragma comment(lib,"comctl32.lib")
#pragma comment(lib,"advapi32.lib")
#pragma comment(lib,"winspool.lib")
#pragma comment(lib,"shell32.lib")
#pragma comment(lib,"ole32.lib")
#pragma comment(lib,"oleaut32.lib")
#pragma comment(lib,"uuid.lib")
#pragma comment(lib,"odbc32.lib")
#pragma comment(lib,"odbccp32.lib")
#pragma comment(lib,"winmm.lib")
#pragma comment(lib,"comdlg32.lib")
// ==================================
#endif
/*
// Open Watcom defs
#if defined( __WATCOMC__ )
#define USE_WATCOMC
#define strdate _strdate
#define _fcloseall fcloseall
#endif
// Borland C++ 5.5.1 defs - bcc32.exe
#if defined( __BCPLUSPLUS__ )
#define strdate _strdate
#define USE_BCPLUSPLUS
// ===== Borland Libraries ==========
#pragma comment(lib,"import32.lib")
#pragma comment(lib,"cw32.lib")
// ==================================
#endif
// Borland C
#if defined( __BORLANDC__ )
#define strdate _strdate
#define USE_BORLANDC
// ===== Borland Libraries ==========
#pragma comment(lib,"import32.lib")
#pragma comment(lib,"cw32.lib")
// ==================================
#endif
// Microsoft C
#if defined( __MSC_VER )
#define USE_MSC
#endif
#if !defined( __LCC__ )
// *************************************************
// Instruct Linker to Search Object/Import Libraries
// *************************************************
#pragma comment(lib,"kernel32.lib")
#pragma comment(lib,"user32.lib")
#pragma comment(lib,"gdi32.lib")
#pragma comment(lib,"comctl32.lib")
#pragma comment(lib,"advapi32.lib")
#pragma comment(lib,"winspool.lib")
#pragma comment(lib,"shell32.lib")
#pragma comment(lib,"ole32.lib")
#pragma comment(lib,"oleaut32.lib")
#pragma comment(lib,"uuid.lib")
#pragma comment(lib,"odbc32.lib")
#pragma comment(lib,"odbccp32.lib")
#pragma comment(lib,"winmm.lib")
#pragma comment(lib,"comdlg32.lib")
#else
#pragma lib kernel32.lib
#pragma lib user32.lib
#pragma lib gdi32.lib
#pragma lib comctl32.lib
#pragma lib advapi32.lib
#pragma lib winspool.lib
#pragma lib shell32.lib
#pragma lib ole32.lib
#pragma lib oleaut32.lib
#pragma lib uuid.lib
#pragma lib odbc32.lib
#pragma lib odbccp32.lib
#pragma lib winmm.lib
#pragma lib comdlg32.lib
// *************************************************
// End of Object/Import Libraries To Search
// *************************************************
#endif
// *************************************************
// System Variables
// *************************************************
*/
#define SNDQUE 10000
typedef struct _soundtype
{
FLOAT Freq;
INT Dura;
INT Vol;
INT Voice;
FLOAT Tempo;
INT sndTid;
} soundtype, *LPSOUNDTYPE;
static soundtype SndPmtr[SNDQUE+1];
static UINT gTenter;
static UINT gTwait;
static UINT gTexit;
static UINT gTarray;
static BOOL gTsig;
static HANDLE gSThread=NULL;
typedef struct _BCX_FONT_TYPE
{
char NAME[80];
int SIZE;
int ITALIC;
int UNDERLINE;
int STRIKEOUT;
int BOLD;
int RGB;
} BCX_FONT_TYPE;
static BCX_FONT_TYPE BCX_FONT;
char BCX_STR [1024*1024];
HHOOK CmDlgHook;
// *************************************************
// User Global Variables
// *************************************************
static HDC BcxPtr_hDC;
static long BcxPtr_FontMetrix;
static long BcxPtr_LineCtr;
static long BcxPtr_PrinterOn;
static HFONT BcxPtr_hFont;
static HFONT BcxPtr_hFontOld;
static DOCINFO BcxPtr_di;
static LOGFONT BcxPtr_Lf;
static TEXTMETRIC BcxPtr_tm;
static char BcxPtr_Text[2048];
static char BcxPtr_Buffer[2048];
// *************************************************
// Standard Macros
// *************************************************
#define BOR |
#define Inp(port)_inp(port)
#define Inpw(port)_inpw(port)
#define Outp(port,value)_outp(port,value)
#define Outpw(port,value)_outpw(port,value)
#define GETATTR(a)(DWORD)GetFileAttributes(a)
#define SETATTR(a,b)(DWORD)SetFileAttributes(a,b)
// *************************************************
// Standard Prototypes
// *************************************************
char* Bin(int);
int str_cmp(char*, char*);
LPWORD lpwAlign(LPWORD);
void InfoBox(char*,char*,int=160,int=155);
LRESULT CALLBACK CB_InfoBox(HWND,UINT,WPARAM,LPARAM);
int BCX_ColorDlg (void);
int BCX_FontDlg (void);
int rmdir (const char*);
char* BCX_TmpStr(size_t);
char* ucase (char*);
char* mid (char*, int, int=-1);
char* left (char*,int);
char* extract (char*,char*);
char* str (double);
char* windir (void);
char* sysdir (void);
char* tempdir (void);
char* RegString (HKEY,char*,char*);
void CreateRegString (HKEY,char*,char*,char*);
void CreateRegInt (HKEY,char*,char*,int);
int RegInt (HKEY,char*,char*);
int FileLocked (char*);
HOOKPROC CALLBACK SBProc (UINT, WPARAM, LPARAM);
char* GetFileName (char*,char*,int=0,HWND=0,DWORD=0,char* =0);
char* join (int, ... );
int MsgBox (char*,char*,int);
int Bin2Dec (char*);
int Hex2Dec (char*);
double Round (double,int);
double Abs (double);
BOOL ModStyle (HWND, DWORD=0, DWORD=0, BOOL=0);
int Sound (float,int=0,int=127,int=0,float=1);
int PlaySnd (void);
int PrinterOpen (void);
void PrinterWrite (char*);
void EjectPage (void);
void PrinterClose (void);
// *************************************************
// User Prototypes
// *************************************************
__declspec(dllexport) int mesgbox (char *, char *, int);
__declspec(dllexport) int bytes2word(byte,byte);
__declspec(dllexport) char * open_file_dialog (char *, char *, char *, int);
__declspec(dllexport) char * save_file_dialog (char *, char *, char *, int);
__declspec(dllexport) char * reg_read_string (char *, char *, char *);
__declspec(dllexport) int reg_read_int (char *, char *, char *);
__declspec(dllexport) int createreg_int (char *, char *, char *, int);
__declspec(dllexport) int createreg_string (char *, char *, char *, char *);
__declspec(dllexport) int set_attr (char *, int);
__declspec(dllexport) int get_attr (char *);
__declspec(dllexport) int mid_qsound (int, int, int, int, float);
__declspec(dllexport) int mid_lsound (int, int, int, int, float);
__declspec(dllexport) int infbox (char *, char *);
__declspec(dllexport) char * getsysdir (void);
__declspec(dllexport) char * gettmpdir (void);
__declspec(dllexport) char * getwindir (void);
__declspec(dllexport) int filestat (char *);
__declspec(dllexport) HANDLE FindWindowText (char *);
__declspec(dllexport) int CenterWindow (void);
__declspec(dllexport) int hex2int (char *);
__declspec(dllexport) int bin2int (char *);
__declspec(dllexport) int removedir (char *);
__declspec(dllexport) int openprint (void);
__declspec(dllexport) int closeprint (void);
__declspec(dllexport) int ejectpage (void);
__declspec(dllexport) int write2printer (char *);
__declspec(dllexport) int resizewindow (int, int);
__declspec(dllexport) char * fontdlg (int, int, int, int, int, int, int);
__declspec(dllexport) int rainbowdlg (void);
__declspec(dllexport) int removemax (void);
__declspec(dllexport) int removemin (void);
__declspec(dllexport) int removesizing (void);
__declspec(dllexport) int addtransp (void);
int changewindow (int, int, int);
__declspec(dllexport) int ismin (void);
int getport_byte (int);
int getport_word (int);
int putport_byte (int, int);
int putport_word (int, int);
// *************************************************
// Main Program
// *************************************************
__declspec(dllexport) BOOL WINAPI DllMain (HINSTANCE hInst, DWORD Reason, LPVOID Reserved)
{
switch (Reason)
{
case DLL_PROCESS_ATTACH:
break;
case DLL_PROCESS_DETACH:
break;
case DLL_THREAD_ATTACH:
break;
case DLL_THREAD_DETACH:
break;
}
return TRUE;
}
// function mid_que()
// dim ret as integer
// ret=sound(0,0,0,0,0)
// function=ret
// end function
// function inptbox(title$,prompt$,default$) export
// dim ret$
// ret$ = INPUTBOX$(title$, prompt$,default$)
// function=ret$
// end function
// function drag_drop()
// dim ret$ as string
// ret$=command$
// function=ret$
// end function
// *************************************************
// Run Time Functions
// *************************************************
char *BCX_TmpStr (size_t Bites)
{
static int StrCnt;
static char *StrFunc[2048];
StrCnt=(StrCnt + 1) & 2047;
if(StrFunc[StrCnt]) free (StrFunc[StrCnt]);
return StrFunc[StrCnt]=(char*)calloc(Bites+128,sizeof(char));
}
int str_cmp (char *a, char *b)
{
register int counter;
counter=counter^counter;
while(1)
{
if((a[counter]^b[counter]))
{
if((UINT) a[counter]>= (UINT) b[counter])
return 1;
return -1;
}
if(!a[counter]) return 0;
counter++;
}
#if !defined( __cplusplus )
return 0;
#endif
}
char *left (char *S, int length)
{
register int tmplen = strlen(S);
char *strtmp = BCX_TmpStr(tmplen);
strcpy (strtmp,S);
if(length>tmplen)
strtmp[tmplen] = 0;
else
strtmp[length] = 0;
return strtmp;
}
char *mid (char *S, int start, int length)
{
register int tmplen = strlen(S);
char *strtmp;
if(start>tmplen||start<1) return BCX_TmpStr(1);
if (length < 0) length = tmplen - start + 1;
strtmp = BCX_TmpStr(length);
strncpy(strtmp,&S[start-1],length);
strtmp[length] = 0;
return strtmp;
}
char *extract (char *mane, char *match)
{
register char *a;
register char *strtmp = BCX_TmpStr(strlen(mane));
strcpy(strtmp,mane);
a=strstr(mane,match);
if(a) strtmp[a-mane]=0;
return strtmp;
}
char *ucase (char *S)
{
register char *strtmp = BCX_TmpStr(strlen(S));
return strupr(strcpy(strtmp,S));
}
char *str (double d)
{
register char *strtmp = BCX_TmpStr(16);
sprintf(strtmp,"% .15G",d);
return strtmp;
}
char *tempdir (void)
{
register char *strtmp = BCX_TmpStr(2048);
GetTempPath (1024,strtmp);
return strtmp;
}
char *windir (void)
{
register char *strtmp = BCX_TmpStr(2048);
GetWindowsDirectory (strtmp,2048);
return strtmp;
}
char *sysdir (void)
{
register char *strtmp = BCX_TmpStr(2048);
GetSystemDirectory (strtmp,2048);
return strtmp;
}
char * join(int n, ...)
{
register int i = n, tmplen = 0;
register char *s_;
register char *strtmp; // = 0;
va_list marker;
va_start(marker, n); // Initialize variable arguments
while(i-- > 0)
{
s_ = va_arg(marker, char *);
tmplen += strlen(s_);
}
strtmp = BCX_TmpStr(tmplen);
va_end(marker); // Reset variable arguments
i = n;
va_start(marker, n); // Initialize variable arguments
while(i-- > 0)
{
s_ = va_arg(marker, char *);
strtmp = strcat(strtmp, s_);
}
va_end(marker); // Reset variable arguments
return strtmp;
}
HOOKPROC CALLBACK SBProc (UINT Msg, WPARAM wParam, LPARAM lParam)
{
if(Msg==HCBT_ACTIVATE)
{
static RECT rc1;
static RECT rc2;
GetWindowRect(GetDesktopWindow(),&rc1);
GetWindowRect((HWND)wParam,&rc2);
SetWindowPos((HWND)wParam,HWND_TOP,(rc1.left+rc1.right-rc2.right+rc2.left)/2,
(rc1.top+rc1.bottom-rc2.bottom+rc2.top)/2,0,0,SWP_NOSIZE|SWP_NOACTIVATE);
UnhookWindowsHookEx(CmDlgHook);
}
return 0;
}
char *GetFileName(char*Title,char*Filter,int Flag,HWND hWnd,DWORD Flags,char*InitialDir)
{
OPENFILENAME OpenFileStruct;
char* filename = BCX_TmpStr(500000);
char* RET = BCX_TmpStr(500000);
char* Extension = BCX_TmpStr(256);
char* filetitle = BCX_TmpStr(256);
char ch=0;
int Counter=0;
char *strtmp=0;
memset(&OpenFileStruct,0,sizeof(OpenFileStruct));
strtmp = BCX_TmpStr(500000);
strcat(Extension,Filter);
for(Counter=1;Counter<=strlen(Filter)-1;Counter++)
{
ch=Filter[Counter];
if(ch=='|')
Extension[Counter]=0;
else
Extension[Counter]=ch;
}
CmDlgHook=SetWindowsHookEx(WH_CBT,(HOOKPROC)SBProc,(HINSTANCE)NULL,GetCurrentThreadId());
OpenFileStruct.lStructSize=sizeof(OpenFileStruct);
OpenFileStruct.hwndOwner=hWnd;
OpenFileStruct.hInstance=0;
OpenFileStruct.lpstrFilter=Extension;
OpenFileStruct.lpstrTitle=Title;
OpenFileStruct.Flags=Flags;
OpenFileStruct.nMaxFile=500000;
OpenFileStruct.nMaxFileTitle=255;
OpenFileStruct.lpstrFile=filename;
OpenFileStruct.lpstrFileTitle=filetitle;
OpenFileStruct.lpstrCustomFilter=0;
OpenFileStruct.nMaxCustFilter=0;
OpenFileStruct.nFilterIndex=0;
OpenFileStruct.lpstrInitialDir=InitialDir;
OpenFileStruct.nFileOffset=0;
OpenFileStruct.nFileExtension=0;
OpenFileStruct.lpstrDefExt=0;
OpenFileStruct.lCustData=0;
OpenFileStruct.lpfnHook=0;
OpenFileStruct.lpTemplateName=0;
OpenFileStruct.Flags = OFN_HIDEREADONLY | OFN_CREATEPROMPT | OFN_EXPLORER;
if(!Flag)
{
if(GetOpenFileName(&OpenFileStruct))
{
int len=strlen(OpenFileStruct.lpstrFile);
if(OpenFileStruct.lpstrFile[len+1]==0)
return strcpy(strtmp,OpenFileStruct.lpstrFile);
else
{
strcpy(RET,OpenFileStruct.lpstrFile);
OpenFileStruct.lpstrFile+=len+1;
while(OpenFileStruct.lpstrFile[0])
{
len=strlen(OpenFileStruct.lpstrFile);
sprintf(RET,"%s%s%s",RET,",",OpenFileStruct.lpstrFile);
OpenFileStruct.lpstrFile+=len+1;
}
return strcpy(strtmp,RET);
}
}
}
else
{
if(GetSaveFileName(&OpenFileStruct))
return strcpy(strtmp,OpenFileStruct.lpstrFile);
}
return strcpy(strtmp,"");
}
double Round (double n, int d)
{
return (floor((n)*pow(10.0,(d))+0.5)/pow(10.0,(d)));
}
double Abs (double a)
{
if(a<0) return -a;
return a;
}
int Bin2Dec (char *cptr)
{
register int i, j = 0;
while(cptr && *cptr && strchr("01", *cptr))
{
i = *cptr++ - '0';
j <<= 1;
j |= (i & 0x01);
}
return(j);
}
int Hex2Dec (char *szInput)
{
DWORD dwPos=0;
DWORD dwOut=0;
DWORD dwLen = strlen(szInput);
while(*szInput)
{
++ dwPos;
if(*szInput >= 'a' && *szInput <= 'f' || *szInput >= 'A' && *szInput <= 'F')
dwOut |=((((int)*szInput - 48) & 15) + 9) <<((dwLen - dwPos) << 2);
else if(*szInput >= '0' && *szInput <= '9')
dwOut |=((int)*szInput - 48) <<((dwLen - dwPos) << 2);
szInput++;
}
return dwOut;
}
int MsgBox (LPSTR Msg, LPSTR Title, int Num)
{
return MessageBox(NULL,Msg,Title,Num);
}
void InfoBox(char *Title, char *Value, int xSize, int ySize)
{
LPDLGITEMTEMPLATE lpdit;
LPDLGTEMPLATE lpdt;
HINSTANCE hInst;
HGLOBAL hgbl;
LPWORD lpw;
LPWSTR lpwsz;
DWORD MyStyle;
int nchar;
int ID_EDIT = 101;
int ID_OKAY = 102;
// *************************************
hgbl=GlobalAlloc(GMEM_ZEROINIT,49152);
lpdt=(LPDLGTEMPLATE)GlobalLock(hgbl);
MyStyle = WS_VISIBLE | DS_NOFAILCREATE |
WS_BORDER | DS_CENTER | DS_SETFONT;
// *************************************
// Create the InfoBox Window
// *************************************
lpdt->style=MyStyle;
lpdt->cdit=4;
lpdt->cx = xSize;
lpdt->cy = ySize;
lpw = (LPWORD)(lpdt+1);
*lpw++ = 0;
*lpw++ = 0;
lpwsz = (LPWSTR)lpw;
nchar = MultiByteToWideChar(CP_ACP,0,Title,-1,lpwsz,1+strlen(Title));
lpw+= nchar;
lpwsz = (LPWSTR)lpw;
nchar = MultiByteToWideChar(CP_ACP,0,"MS Sans Serif",-1,lpwsz,50);
lpw+= nchar;
// ********************************
// Create the OKAY button.
// ********************************
lpw = lpwAlign(lpw);
lpdit = (LPDLGITEMTEMPLATE)lpw;
lpdit->x = (xSize/2)-24;
lpdit->y = ySize - 29;
lpdit->cx = 40;
lpdit->cy = 12;
lpdit->id=ID_OKAY;
lpdit->style = WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON | WS_TABSTOP;
lpw = (LPWORD)(lpdit+1);
*lpw++ = 0xFFFF;
*lpw++ = 0x0080;
lpwsz = (LPWSTR)lpw;
nchar = MultiByteToWideChar(CP_ACP,0,"Okay",-1,lpwsz,5);
lpw+= nchar;
lpw = lpwAlign(lpw);
*lpw++ = 0;
// ************************************
// Create the Read-Only EDIT control
// ************************************
lpw = (LPWORD)lpwAlign(lpw);
lpdit = (LPDLGITEMTEMPLATE)lpw;
lpdit->x = 4;
lpdit->y = 8;
lpdit->cx = xSize-9;
lpdit->cy = ySize-40;
lpdit->id=ID_EDIT;
lpdit->style = WS_VISIBLE | WS_VSCROLL | ES_AUTOHSCROLL | WS_CHILD |
ES_READONLY | ES_MULTILINE | ES_WANTRETURN | WS_HSCROLL;
lpw = (LPWORD)(lpdit+1);
*lpw++ = 0xFFFF;
*lpw++ = 0x0081;
lpwsz = (LPWSTR)lpw;
nchar = MultiByteToWideChar(CP_ACP,0,Value,-1,lpwsz,1+strlen(Value));
lpw+= nchar;
lpw = lpwAlign(lpw);
*lpw++ = 0;
// ********************************
GlobalUnlock(hgbl);
hInst = (HINSTANCE)GetWindowLong(0,GWL_HINSTANCE);
DialogBoxIndirect (hInst,(LPDLGTEMPLATE)hgbl,GetActiveWindow(),(DLGPROC)CB_InfoBox);
GlobalFree(hgbl);
}
LRESULT CALLBACK CB_InfoBox(HWND hWnd, UINT Msg, WPARAM wParam, LPARAM lParam)
{
HWND hTmp;
HWND hOkay;
static HFONT hFont;
int ID_OKAY = 102;
while(1)
{
if(Msg==WM_INITDIALOG)
{
hFont = CreateFont
(12,8,0,0,200,FALSE,FALSE,FALSE,ANSI_CHARSET,
OUT_DEFAULT_PRECIS,CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,
DEFAULT_PITCH|FF_DONTCARE,"MS Sans Serif");
hTmp=GetWindow(hWnd,GW_CHILD);
while(hTmp)
{
SendMessage(hTmp,(UINT)WM_SETFONT,(WPARAM)hFont,(LPARAM)TRUE);
hTmp=GetWindow(hTmp,GW_HWNDNEXT);
}
hOkay=GetDlgItem(hWnd,ID_OKAY);
SetFocus(hOkay);
return 0;
}
if(Msg==WM_COMMAND)
{
if(LOWORD(wParam)==ID_OKAY)
{
if (hFont) DeleteObject(hFont);
SendMessage(hWnd,WM_CLOSE,0,0);
}
break;
}
if(Msg==WM_CLOSE)
EndDialog(hWnd,0);
break;
}
return 0;
}
LPWORD lpwAlign (LPWORD lpIn)
{
ULONG ul;
ul=(ULONG)lpIn;
ul+=3;
ul>>=2;
ul<<=2;
return (LPWORD)ul;
}
int BCX_ColorDlg (void)
{
COLORREF CustColors[16];
CHOOSECOLOR cc;
memset(&CustColors,0,sizeof(CustColors));
memset(&cc,0,sizeof(cc));
cc.lStructSize=sizeof(CHOOSECOLOR);
cc.rgbResult=RGB(128,128,128);
cc.lpCustColors=CustColors;
cc.Flags=CC_RGBINIT|CC_FULLOPEN;
CmDlgHook=SetWindowsHookEx(WH_CBT,(HOOKPROC)SBProc,(HINSTANCE)NULL,GetCurrentThreadId());
ChooseColor(&cc);
return cc.rgbResult;
}
BOOL ModStyle(HWND hWnd, DWORD dwAdd, DWORD dwRemove, BOOL bEx)
{
SetLastError(0);
DWORD dwStyle = GetWindowLong(hWnd,(bEx ? GWL_EXSTYLE:GWL_STYLE));
DWORD dwNewStyle = (dwStyle & (~dwRemove)) | dwAdd;
SetWindowLong(hWnd, (bEx ? GWL_EXSTYLE : GWL_STYLE),dwNewStyle);
SetWindowPos(hWnd,NULL,0,0,0,0,
SWP_NOMOVE|SWP_NOSIZE|SWP_NOZORDER|SWP_FRAMECHANGED);
return (GetLastError() == 0);
}
int BCX_FontDlg (void)
{
CHOOSEFONT cf;
LOGFONT lf;
memset(&cf,0,sizeof(cf));
memset(&lf,0,sizeof(lf));
GetObject(GetStockObject(DEFAULT_GUI_FONT),sizeof(lf),&lf);
cf.lStructSize=sizeof(CHOOSEFONT);
cf.lpLogFont=&lf;
cf.Flags=CF_INITTOLOGFONTSTRUCT|CF_SCREENFONTS|CF_EFFECTS;
CmDlgHook=SetWindowsHookEx(WH_CBT,(HOOKPROC)SBProc,(HINSTANCE)NULL,GetCurrentThreadId());
int rc=ChooseFont(&cf);
if(rc)
{
strcpy(BCX_FONT.NAME,lf.lfFaceName);
BCX_FONT.SIZE=cf.iPointSize/10;
BCX_FONT.ITALIC=lf.lfItalic;
BCX_FONT.BOLD=lf.lfWeight;
BCX_FONT.UNDERLINE=lf.lfUnderline;
BCX_FONT.STRIKEOUT=lf.lfStrikeOut;
BCX_FONT.RGB=cf.rgbColors;
}
return rc;
}
char *RegString (HKEY hKey, char *RegPath, char *SubKey)
{
static char Result[2048];
memset(&Result,0,sizeof(Result));
char *BCX_RetStr={0};
int BufferLen=sizeof(Result);
if(!RegOpenKeyEx(hKey,RegPath,0,KEY_QUERY_VALUE,&hKey))
{
RegQueryValueEx(hKey,SubKey,0,0,(LPBYTE)Result,(LPDWORD)&BufferLen);
}
RegCloseKey(hKey);
BCX_RetStr=BCX_TmpStr(strlen(Result));
strcpy(BCX_RetStr,Result);
return BCX_RetStr;
}
char* Bin(int number)
{
char *strtmp = BCX_TmpStr(2048);
itoa(number,strtmp,2);
return strtmp;
}
void CreateRegString (HKEY HK, char *Key, char *VarName, char *Value)
{
HKEY hKey;
char Buff[100]={0};
DWORD Result;
RegCreateKeyEx(HK,Key,0,Buff,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,0,&hKey,&Result);
RegSetValueEx(hKey,VarName,0,REG_SZ,(LPBYTE)Value,(DWORD)lstrlen(Value)+1);
RegCloseKey(hKey);
}
void CreateRegInt (HKEY HK, char *Key, char *VarName, int Value)
{
char Buf[100]={0};
DWORD Result;
HKEY hKey;
RegCreateKeyEx(HK,Key,0,Buf,REG_OPTION_NON_VOLATILE,KEY_ALL_ACCESS,0,&hKey,&Result);
RegSetValueEx(hKey,VarName,0,REG_DWORD,(BYTE*)&Value,sizeof(int));
RegCloseKey(hKey);
}
int RegInt(HKEY HK,char* Key, char* SubKey)
{
HKEY hKey = 0;
DWORD Result = 0;
DWORD Size = sizeof(DWORD);
RegOpenKeyEx (HK,Key,0,KEY_QUERY_VALUE,&HK);
RegQueryValueEx (HK,SubKey,0,0,(LPBYTE)&Result,&Size);
RegCloseKey (hKey);
return Result;
}
int PrinterOpen (void)
{
int PointSize=12;
char zPrinter[2048];
GetProfileString("WINDOWS","DEVICE","",zPrinter,127);
strcpy(zPrinter,(char*)extract(zPrinter,","));
strcpy(BcxPtr_Text,"Printing ...");
BcxPtr_hDC=CreateDC("",zPrinter,"",0);
if(!BcxPtr_hDC) return 0;
BcxPtr_di.cbSize=sizeof(BcxPtr_di);
BcxPtr_di.lpszDocName=BcxPtr_Text;
StartDoc(BcxPtr_hDC,&BcxPtr_di);
StartPage(BcxPtr_hDC);
SetTextAlign(BcxPtr_hDC,TA_BASELINE | TA_NOUPDATECP | TA_LEFT);
SetBkMode(BcxPtr_hDC,TRANSPARENT);
BcxPtr_Lf.lfHeight=PointSize*GetDeviceCaps(BcxPtr_hDC,LOGPIXELSY)/72;
BcxPtr_Lf.lfWidth=0;
BcxPtr_Lf.lfEscapement=0;
BcxPtr_Lf.lfOrientation=0;
BcxPtr_Lf.lfWeight=FW_NORMAL;
BcxPtr_Lf.lfItalic=0;
BcxPtr_Lf.lfUnderline=0;
BcxPtr_Lf.lfStrikeOut=0;
BcxPtr_Lf.lfCharSet=ANSI_CHARSET;
BcxPtr_Lf.lfOutPrecision=OUT_DEFAULT_PRECIS;
BcxPtr_Lf.lfClipPrecision=CLIP_DEFAULT_PRECIS;
BcxPtr_Lf.lfQuality=PROOF_QUALITY;
BcxPtr_Lf.lfPitchAndFamily=VARIABLE_PITCH | FF_ROMAN;
strcpy(BcxPtr_Lf.lfFaceName,TEXT("Courier New"));
BcxPtr_hFont=CreateFontIndirect(&BcxPtr_Lf);
BcxPtr_hFontOld=(HFONT)SelectObject(BcxPtr_hDC,BcxPtr_hFont);
GetTextMetrics(BcxPtr_hDC,&BcxPtr_tm);
BcxPtr_FontMetrix=BcxPtr_Lf.lfHeight;
BcxPtr_PrinterOn=1;
return 1;
}
void PrinterWrite (char *TextIn)
{
int LPP=60;
int CPL=80;
char sTemp[2048]={0};
if(!BcxPtr_PrinterOn)
{
MessageBox (GetActiveWindow(),"Problem with Printer","",0);
return;
}
strcpy(sTemp,TextIn);
while(1)
{
if(strlen(sTemp)>CPL)
{
strcpy(BcxPtr_Text,(char*)left(sTemp,CPL));
strcpy(sTemp,(char*)mid(sTemp,CPL+1));
}
else
{
strcpy(BcxPtr_Text,sTemp);
*sTemp=0;
}
BcxPtr_LineCtr+=1;
if(BcxPtr_LineCtr>=LPP)
{
EndPage(BcxPtr_hDC);
BcxPtr_LineCtr=0;
StartPage(BcxPtr_hDC);
}
TextOut(BcxPtr_hDC,20,BcxPtr_FontMetrix*BcxPtr_LineCtr,BcxPtr_Text,strlen(BcxPtr_Text));
if(sTemp[0]==0) break;
}
}
void PrinterClose (void)
{
if(!BcxPtr_PrinterOn) return;
SelectObject(BcxPtr_hDC,BcxPtr_hFontOld);
DeleteObject(BcxPtr_hFont);
EndPage(BcxPtr_hDC);
EndDoc(BcxPtr_hDC);
DeleteDC(BcxPtr_hDC);
BcxPtr_LineCtr=0;
BcxPtr_PrinterOn=0;
}
void EjectPage(void)
{
EndPage(BcxPtr_hDC);
BcxPtr_LineCtr=0;
StartPage(BcxPtr_hDC);
}
int FileLocked (char *Filname)
{
int rc=0;
int errno=0;
rc=_lopen(Filname,OF_READ | OF_SHARE_EXCLUSIVE);
if(rc==HFILE_ERROR)
errno=GetLastError();
else
_lclose(rc);
return ((rc==HFILE_ERROR) & (errno==ERROR_SHARING_VIOLATION));
}
int Sound (float Freq,int Dura,int Vol,int Voice,float Tempo)
{
DWORD dwThreadId;
if(Freq==0&&Dura<1) return gTenter-gTexit;
if(Freq==0) Vol=0;
if(Dura<5) Dura=5;
gTenter++;
gTsig=FALSE;
if(gTenter>=SNDQUE) gTarray=gTenter % SNDQUE+1;
else gTarray=gTenter;
SndPmtr[gTarray].Freq=Freq;
SndPmtr[gTarray].Dura=Dura;
SndPmtr[gTarray].Tempo=Tempo;
SndPmtr[gTarray].Vol=Vol;
SndPmtr[gTarray].Voice=Voice;
SndPmtr[gTarray].sndTid=gTenter;
if(gSThread==NULL&&(Freq==Abs(Freq)||Freq==0))
{
gSThread=CreateThread(NULL,0,PlaySnd,"PlaySnd",0,&dwThreadId);
Sleep(1);
return 0;
}
if(Freq!=Abs(Freq))
{
if(Freq==-1)
{
Freq=0;
SndPmtr[gTarray].Vol=0;
}
SndPmtr[gTarray].Freq=Abs(Freq);
gTsig=TRUE;
while(gSThread!=NULL)
{
Sleep(10);
}
gTexit=gTenter-1;
gTwait=gTenter-1;
gTsig=FALSE;
return PlaySnd();
}
return 0;
}
int PlaySnd (void)
{
soundtype LocSndPar;
UINT lTarray;
while(gTenter>gTexit&&gTsig==FALSE)
{
gTwait++;
if(gTwait>=SNDQUE)
lTarray=gTwait % SNDQUE+1;
else
lTarray=gTwait;
LocSndPar=SndPmtr[lTarray];
int Note=0;
int Phrase=0;
HMIDIOUT hMidi;
midiOutOpen(&hMidi,(UINT)-1,0,0,CALLBACK_NULL);
midiOutShortMsg(hMidi,(256*LocSndPar.Voice)+192);
Note=Round((log(LocSndPar.Freq)-log(440.0))/log(2)*12+69,0);
Phrase=(LocSndPar.Vol*256+Note)*256+144;
midiOutShortMsg(hMidi,Phrase);
Sleep(LocSndPar.Dura*(1/LocSndPar.Tempo+0.0001));
Phrase=(LocSndPar.Vol*256+Note)*256+128;
midiOutShortMsg(hMidi,Phrase);
midiOutClose(hMidi);
gTexit++;
}
CloseHandle(gSThread);
gSThread=NULL;
return 0;
}
// ************************************
// User Subs and Functions
// ************************************
__declspec(dllexport) int mesgbox (LPSTR content, LPSTR title, int typee)
{
//static int tmp;
//memset(&tmp,0,sizeof(tmp));
return MessageBox(NULL,content,title,MB_OK);
}
__declspec(dllexport) char * open_file_dialog (LPSTR dir, LPSTR filter, LPSTR title, int flags)
{
static char ret[2048];
memset(&ret,0,sizeof(ret));
char *BCX_RetStr={0};
strcpy(ret,(char*)GetFileName(title,filter,0,GetActiveWindow(),flags,dir));
BCX_RetStr=BCX_TmpStr(strlen(ret));
strcpy((char*)BCX_RetStr,ret);
return BCX_RetStr;
}
// kernel32.lib user32.lib gdi32.lib comctl32.lib comdlg32.lib advapi32.lib delayimp.lib
__declspec(dllexport) char * save_file_dialog (char *dir, char *filter, char *title, int flags)
{
static char ret[2048];
memset(&ret,0,sizeof(ret));
char *BCX_RetStr={0};
strcpy(ret,(char*)GetFileName(title,filter,1,GetActiveWindow(),flags,dir));
BCX_RetStr=BCX_TmpStr(strlen(ret));
strcpy((char*)BCX_RetStr,ret);
return BCX_RetStr;
}
__declspec(dllexport) char * reg_read_string (char *hkey, char *subk, char *value)
{
static char ret[2048];
memset(&ret,0,sizeof(ret));
// ret="0"
char *BCX_RetStr={0};
if(str_cmp(hkey,"hklm")==0)
{
strcpy(ret,(char*)RegString(HKEY_LOCAL_MACHINE,subk,value));
}
if(str_cmp(hkey,"hkcr")==0)
{
strcpy(ret,(char*)RegString(HKEY_CLASSES_ROOT,subk,value));
}
if(str_cmp(hkey,"hkcu")==0)
{
strcpy(ret,(char*)RegString(HKEY_CURRENT_USER,subk,value));
}
if(str_cmp(hkey,"hkus")==0)
{
strcpy(ret,(char*)RegString(HKEY_USERS,subk,value));
}
if(str_cmp(hkey,"hkcc")==0)
{
strcpy(ret,(char*)RegString(HKEY_CURRENT_CONFIG,subk,value));
}
if(str_cmp(hkey,"hkdd")==0)
{
strcpy(ret,(char*)RegString(HKEY_DYN_DATA,subk,value));
}
BCX_RetStr=BCX_TmpStr(strlen(ret));
strcpy((char*)BCX_RetStr,ret);
return BCX_RetStr;
}
__declspec(dllexport) int reg_read_int (char *hkey, char *subk, char *value)
{
static int ret;
memset(&ret,0,sizeof(ret));
// ret=NULL
if(str_cmp(hkey,"hklm")==0)
{
ret=RegInt(HKEY_LOCAL_MACHINE,subk,value);
}
if(str_cmp(hkey,"hkcr")==0)
{
ret=RegInt(HKEY_CLASSES_ROOT,subk,value);
}
if(str_cmp(hkey,"hkcu")==0)
{
ret=RegInt(HKEY_CURRENT_USER,subk,value);
}
if(str_cmp(hkey,"hkus")==0)
{
ret=RegInt(HKEY_USERS,subk,value);
}
if(str_cmp(hkey,"hkcc")==0)
{
ret=RegInt(HKEY_CURRENT_CONFIG,subk,value);
}
if(str_cmp(hkey,"hkdd")==0)
{
ret=RegInt(HKEY_DYN_DATA,subk,value);
}
return ret;
}
__declspec(dllexport) int createreg_int (char *hkey, char *subk, char *value, int Value)
{
if(str_cmp(hkey,"hklm")==0)
{
CreateRegInt(HKEY_LOCAL_MACHINE,subk,value,Value);
}
if(str_cmp(hkey,"hkcr")==0)
{
CreateRegInt(HKEY_CLASSES_ROOT,subk,value,Value);
}
if(str_cmp(hkey,"hkcu")==0)
{
CreateRegInt(HKEY_CURRENT_USER,subk,value,Value);
}
if(str_cmp(hkey,"hkus")==0)
{
CreateRegInt(HKEY_USERS,subk,value,Value);
}
if(str_cmp(hkey,"hkcc")==0)
{
CreateRegInt(HKEY_CURRENT_CONFIG,subk,value,Value);
}
if(str_cmp(hkey,"hkdd")==0)
{
CreateRegInt(HKEY_DYN_DATA,subk,value,Value);
}
}
__declspec(dllexport) int createreg_string (char *hkey, char *subk, char *value, char *Value)
{
if(str_cmp(hkey,"hklm")==0)
{
CreateRegString(HKEY_LOCAL_MACHINE,subk,value,Value);
}
if(str_cmp(hkey,"hkcr")==0)
{
CreateRegString(HKEY_CLASSES_ROOT,subk,value,Value);
}
if(str_cmp(hkey,"hkcu")==0)
{
CreateRegString(HKEY_CURRENT_USER,subk,value,Value);
}
if(str_cmp(hkey,"hkus")==0)
{
CreateRegString(HKEY_USERS,subk,value,Value);
}
if(str_cmp(hkey,"hkcc")==0)
{
CreateRegString(HKEY_CURRENT_CONFIG,subk,value,Value);
}
if(str_cmp(hkey,"hkdd")==0)
{
CreateRegString(HKEY_DYN_DATA,subk,value,Value);
}
}
__declspec(dllexport) int set_attr (char *file, int attribs)
{
SETATTR(file,attribs);
}
__declspec(dllexport) int get_attr (char *file)
{
static int ret;
memset(&ret,0,sizeof(ret));
ret=GETATTR(file);
return ret;
}
__declspec(dllexport) int mid_qsound (int freq, int duration, int volume, int voice, float tempo)
{
// qued sound mode ;does not pause
// SOUND ( 95, 2000, 127, 111,1) ' 2 second blast
// SOUND ( 0, 1000, 0, 111,1) ' 1 second of silence
// SOUND ( 95, 2000, 127, 111,1) ' 2 second blast
// Sleep (5500) ' Give it time to finish
// use threading to do more than 1 sound
Sound(freq,duration,volume,voice,tempo);
Sleep(10);
}
__declspec(dllexport) int mid_lsound (int freq, int duration, int volume, int voice, float tempo)
{
// live sound ;pauses the program
Sound(-freq,duration,volume,voice,tempo);
Sleep(10);
}
__declspec(dllexport) int infbox (char *caption, char *info)
{
InfoBox(caption,info,160,155);
}
__declspec(dllexport) char * getsysdir (void)
{
static char ret[2048];
memset(&ret,0,sizeof(ret));
char *BCX_RetStr={0};
strcpy((char*)ret,sysdir());
BCX_RetStr=BCX_TmpStr(strlen(ret));
strcpy((char*)BCX_RetStr,ret);
return BCX_RetStr;
}
__declspec(dllexport) char * gettmpdir (void)
{
static char ret[2048];
memset(&ret,0,sizeof(ret));
char *BCX_RetStr={0};
strcpy((char*)ret,tempdir());
BCX_RetStr=BCX_TmpStr(strlen(ret));
strcpy((char*)BCX_RetStr,ret);
return BCX_RetStr;
}
__declspec(dllexport) char * getwindir (void)
{
static char ret[2048];
memset(&ret,0,sizeof(ret));
char *BCX_RetStr={0};
strcpy((char*)ret,windir());
BCX_RetStr=BCX_TmpStr(strlen(ret));
strcpy((char*)BCX_RetStr,ret);
return BCX_RetStr;
}
__declspec(dllexport) int filestat (char *file)
{
static int ret;
memset(&ret,0,sizeof(ret));
ret=FileLocked(file);
return ret;
}
__declspec(dllexport) HANDLE FindWindowText (char *WindowText)
{
static char zBuffer[2048];
memset(&zBuffer,0,sizeof(zBuffer));
static HWND hNext;
memset(&hNext,0,sizeof(hNext));
static HWND hPrev;
memset(&hPrev,0,sizeof(hPrev));
static HWND hTop;
memset(&hTop,0,sizeof(hTop));
hTop=GetTopWindow(0);
hPrev=hTop;
hNext=0;
while(hNext!=hTop)
{
hNext=GetWindow(hPrev,GW_HWNDNEXT);
GetWindowText(hNext,zBuffer,strlen(WindowText)+1);
if(str_cmp(ucase(zBuffer),ucase(WindowText))==0)
{
return hNext;
}
hPrev=hNext;
}
return 0;
}
__declspec(dllexport) int CenterWindow (void)
{
static RECT wRect;
memset(&wRect,0,sizeof(wRect));
static DWORD x;
memset(&x,0,sizeof(x));
static DWORD y;
memset(&y,0,sizeof(y));
static HWND hWnd;
memset(&hWnd,0,sizeof(hWnd));
hWnd=GetActiveWindow();
GetWindowRect(hWnd,&wRect);
x=(GetSystemMetrics(SM_CXSCREEN)-(wRect.right-wRect.left))/2;
y=(GetSystemMetrics(SM_CYSCREEN)-(wRect.bottom-wRect.top+GetSystemMetrics(SM_CYCAPTION)))/2;
SetWindowPos(hWnd,NULL,x,y,0,0,SWP_NOSIZE BOR SWP_NOZORDER);
}
__declspec(dllexport) int hex2int (char *hexstring)
{
static int ret;
memset(&ret,0,sizeof(ret));
ret=Hex2Dec(hexstring);
return ret;
}
__declspec(dllexport) int bin2int (char *binarystring)
{
static int ret;
memset(&ret,0,sizeof(ret));
ret=Bin2Dec(binarystring);
return ret;
}
__declspec(dllexport) int removedir (char *dir)
{
_rmdir ((dir));
}
__declspec(dllexport) int openprint (void)
{
PrinterOpen();
}
__declspec(dllexport) int closeprint (void)
{
PrinterClose();
}
__declspec(dllexport) int ejectpage (void)
{
EjectPage();
}
__declspec(dllexport) int write2printer (char *txt)
{
sprintf(BcxPtr_Buffer,"%s",txt);
PrinterWrite(BcxPtr_Buffer);
}
__declspec(dllexport) int resizewindow (int width, int height)
{
static BOOL trash;
memset(&trash,0,sizeof(trash));
trash=SetWindowPos(GetActiveWindow(),0,0,0,width,height,SWP_NOREPOSITION&SWP_NOMOVE);
}
__declspec(dllexport) char * fontdlg (int namee, int sizee, int italic, int bold, int underline, int strikeout, int rgbb)
{
static int RetVal;
memset(&RetVal,0,sizeof(RetVal));
static char ret[2048];
memset(&ret,0,sizeof(ret));
static char dat[7][2048];
memset(&dat,0,sizeof(dat));
static int tmp;
memset(&tmp,0,sizeof(tmp));
char *BCX_RetStr={0};
RetVal=BCX_FontDlg();
if(RetVal==0)
{
strcpy((char*)ret,0);
BCX_RetStr=BCX_TmpStr(strlen(ret));
strcpy((char*)BCX_RetStr,ret);
return BCX_RetStr;
return 0;
}
strcpy(dat[1],(char*)BCX_FONT.NAME);
tmp=BCX_FONT.SIZE;
strcpy(dat[2],(char*)str(tmp));
tmp=BCX_FONT.ITALIC;
strcpy(dat[3],(char*)str(tmp));
tmp=BCX_FONT.BOLD;
strcpy(dat[4],(char*)str(tmp));
tmp=BCX_FONT.UNDERLINE;
strcpy(dat[5],(char*)str(tmp));
tmp=BCX_FONT.STRIKEOUT;
strcpy(dat[6],(char*)str(tmp));
tmp=BCX_FONT.RGB;
strcpy(dat[7],(char*)str(tmp));
if(namee==1)
{
sprintf(ret,"%s%s%s",ret,dat[ 1 ] ,",");
}
if(sizee==1)
{
sprintf(ret,"%s%s%s",ret,dat[ 2 ] ,",");
}
if(italic==1)
{
sprintf(ret,"%s%s%s",ret,dat[ 3 ] ,",");
}
if(bold==1)
{
sprintf(ret,"%s%s%s",ret,dat[ 4 ] ,",");
}
if(underline==1)
{
sprintf(ret,"%s%s%s",ret,dat[ 5 ] ,",");
}
if(strikeout==1)
{
sprintf(ret,"%s%s%s",ret,dat[ 6 ] ,",");
}
if(rgbb==1)
{
sprintf(ret,"%s%s%s",ret,dat[ 7 ] ,",");
}
BCX_RetStr=BCX_TmpStr(strlen(ret));
strcpy((char*)BCX_RetStr,ret);
return BCX_RetStr;
}
__declspec(dllexport) int rainbowdlg (void)
{
static int ret;
memset(&ret,0,sizeof(ret));
ret=BCX_ColorDlg();
return ret;
}
__declspec(dllexport) int removemax (void)
{
static int trash;
memset(&trash,0,sizeof(trash));
trash=ModStyle(GetActiveWindow(),0,WS_MAXIMIZEBOX,FALSE);
}
__declspec(dllexport) int removemin (void)
{
static int trash;
memset(&trash,0,sizeof(trash));
trash=ModStyle(GetActiveWindow(),0,WS_MINIMIZEBOX,FALSE);
}
__declspec(dllexport) int removesizing (void)
{
static int trash;
memset(&trash,0,sizeof(trash));
trash=ModStyle(GetActiveWindow(),0,WS_SIZEBOX,FALSE);
}
__declspec(dllexport) int addtransp (void)
{
static int trash;
memset(&trash,0,sizeof(trash));
trash=ModStyle(GetActiveWindow(),WS_EX_TRANSPARENT,0,TRUE);
}
__declspec(dllexport) int changewindow (int add, int remov, int exornot)
{
static int trash;
memset(&trash,0,sizeof(trash));
if(exornot==1)
{
trash=ModStyle(GetActiveWindow(),add,remov,TRUE);
}
else
{
trash=ModStyle(GetActiveWindow(),add,remov,FALSE);
}
}
__declspec(dllexport) int ismin (void)
{
static int ret;
memset(&ret,0,sizeof(ret));
ret=IsIconic(GetActiveWindow());
return ret;
}
__declspec(dllexport) int bytes2word(byte byte1,byte byte2)
{
static char temp[2048];
memset(&temp,0,sizeof(temp));
static int ret;
memset(&ret,0,sizeof(ret));
sprintf(BCX_STR,"%s%s",Bin( byte1 ) ,Bin( byte2 ) );
strcpy(temp,BCX_STR);
ret=Bin2Dec(temp);
return ret;
}
__declspec(dllexport) HWND globalalloc(UINT flags, unsigned long size)
{
HWND ret;
ret=GlobalAlloc(flags, size);
return ret;
}
__declspec(dllexport) HWND lockglobal(HWND pointer)
{
HWND ret;
ret=GlobalLock(pointer);
return ret;
}
__declspec(dllexport) BOOL unlockglobal(HWND pointer)
{
BOOL ret;
ret=GlobalUnlock(pointer);
return ret;
}
__declspec(dllexport) HWND freeglobal(HWND pointer)
{
HWND ret;
ret=GlobalDiscard(pointer);
return ret;
}
int getport_byte (int port)
{
static int ret;
memset(&ret,0,sizeof(ret));
ret=Inp(port);
return ret;
}
int getport_word (int port)
{
static int ret;
memset(&ret,0,sizeof(ret));
ret=Inpw(port);
return ret;
}
int putport_byte (int port, int bytey)
{
Outp(port,bytey);
}
int putport_word (int port, int wordey)
{
Outpw(port,wordey);
}
__declspec(dllexport) HWND newfilemap(LPSTR filename, DWORD size,int readonly,FILE *fileh,LPSTR name ) //did ghave HWND protect
{
HWND ret;
//HWND fileh;
if (readonly=0) {
fileh=fopen(filename,"wb");
if (fileh=NULL) {
ret=0;
//return ret;
//exit;
}
ret=CreateFileMapping(fileh,NULL,PAGE_READWRITE,0,size,name);
return ret;
//exit;
}
if (readonly=1) {
fileh=fopen(filename,"rb");
if (fileh=NULL) {
ret=0;
return ret;
//exit;
}
ret=CreateFileMapping(fileh,NULL,PAGE_READONLY,0,size,name);
//exit;
}
return ret;
}
__declspec(dllexport) BOOL closefilemap(HANDLE handle,FILE *fileh)
{
BOOL ret;
int tmp;
//tmp=fclose(fileh);
//if (tmp=EOF) {
//ret=0;
//return ret;
//exit;
ret=CloseHandle(handle);
return ret;
}
__declspec(dllexport) BOOL setpower(BOOL suspend,BOOL force)
{
BOOL ret;
ret=SetSystemPowerState(suspend,force);
}
__declspec(dllexport) HANDLE openfilemap(LPSTR name,int read_only)
{
HANDLE ret;
if (read_only=1) {
ret=OpenFileMapping(FILE_MAP_READ,FALSE,name);
}
if (read_only=0) {
ret=OpenFileMapping(FILE_MAP_WRITE,FALSE,name);
}
return ret;
}
__declspec(dllexport) DWORD geterror(VOID)
{
DWORD ret;
ret=GetLastError();
return ret;
}
__declspec(dllexport) LPVOID mapfile(HANDLE hdle,DWORD offset, DWORD num, int read_only)
{
LPVOID ret;
if (read_only=1) {
ret=MapViewOfFile(hdle,FILE_MAP_READ,0,offset,num);
}
if (read_only=0) {
ret=MapViewOfFile(hdle,FILE_MAP_WRITE,0,offset,num);
}
return ret;
}
__declspec(dllexport) BOOL unmapfile(LPVOID hndle)
{
BOOL ret;
ret=UnmapViewOfFile(hndle);
return ret;
}
actually i cheated a bit and made a few functions with bcx(basic to c translator) but about 10 functions are made without bcx
anyway if that helps any
formerly shadows of emptiness