hmm didnt work with pelles c source code
this is the resource file i got
{rtf1ansiansicpg1252deff0deflang1033{fonttbl{f0fnil MS Sans Serif;}}
viewkind4uc1pardf0fs16
par }
and it said "please define export"
my c code
// *************************************************************
// Created with BCX -- The BASIC To C Translator (ver 5.05)
// BCX (c) 1999, 2000, 2001, 2002, 2003, 2004 by Kevin Diggins
// *************************************************************
// Translated for compiling using the Pelles C Compiler
// *************************************************************
#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
// *************************************************
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;
// *************************************************
// Standard Prototypes
// *************************************************
int BCX_FontDlg (void);
char* BCX_TmpStr(size_t);
char* str (double);
HOOKPROC CALLBACK SBProc (UINT, WPARAM, LPARAM);
char* join (int, ... );
// *************************************************
// User Prototypes
// *************************************************
__declspec(dllexport) char * fontdlg (void);
// *************************************************
// 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;
}
// put this into a dll
// *************************************************
// 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));
}
char *str (double d)
{
register char *strtmp = BCX_TmpStr(16);
sprintf(strtmp,"% .15G",d);
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;
}
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;
}
// ************************************
// User Subs and Functions
// ************************************
__declspec(dllexport) char * fontdlg (void)
{
static char ret[2048];
memset(&ret,0,sizeof(ret));
static int retr;
memset(&retr,0,sizeof(retr));
char *BCX_RetStr={0};
retr=BCX_FontDlg();
printf("%s%sn","BCX_Font.Name$ = ",BCX_FONT.NAME);
printf("%s% dn","BCX_Font.Size =",(int)BCX_FONT.SIZE);
printf("%s% dn","BCX_Font.Italic =",(int)BCX_FONT.ITALIC);
printf("%s% dn","BCX_Font.Bold =",(int)BCX_FONT.BOLD);
printf("%s% dn","BCX_Font.Underline =",(int)BCX_FONT.UNDERLINE);
printf("%s% dn","BCX_Font.Strikeout =",(int)BCX_FONT.STRIKEOUT);
printf("%s% dn","BCX_Font.Rgb =",(int)BCX_FONT.RGB);
sprintf(BCX_STR,"%s%s%s%s%s%s%s%s%s%s",BCX_FONT.NAME,",",str( BCX_FONT .SIZE ) ,",",str( BCX_FONT .ITALIC ) ,",",str( BCX_FONT .BOLD ) ,",",str( BCX_FONT .UNDERLINE ) ,",");
strcpy(ret,BCX_STR);
sprintf(ret,"%s%s%s%s",ret,str( BCX_FONT .STRIKEOUT ) ,",",str( BCX_FONT .RGB ) );
if(retr==0)
{
strcpy((char*)ret,"0");
}
BCX_RetStr=BCX_TmpStr(strlen(ret));
strcpy((char*)BCX_RetStr,ret);
return BCX_RetStr;
}
btw
sorry for the code being so bulky
edit:
woops forgot to define export
now it sort of works but im too much of a n00b at c to know how to use
#define export extern "C" __declspec(dllexport)
edit2:
k now i got it figured out
but this i dotn think is what i want:
10001, "static%0%static%"
what i am aiming for is fontdlg
X-Patch x-patch.exe(gui):75% make.exe:5% x-patch.dll(runtime dll):0% developed on win xp home sp2