peterkuxhaus
asked on
convert from win16 to win32
Hi i have a program that was written some 12 years ago for designing patterns on cloth. The program worked fine on an old win 3.11 pc (now dead) so we installed what we had of the program on a nt4 pc all ok except the save button would not work and on w2k or xp it does not work correctly i have looked at the code that i can fined and it tells me it was written with borland so i am thinking c++ but i am unable to work out how to reopen the program so that i can convert to another platform ie win32 either in c++ or another language such as vb.net or c#.net can any body help i have attached some code if this helps
Relocation table offset 0x0040
Overlay Number 0x0000
New EXE Offset 0x00000250
New EXE Header Info (Main Menu)
Module LAPIT
Description Lapit weave pattern editing system
Data NONSHARED
Windows Version 3.10 (PMODE ONLY!)
Signature 0x454E
Linker Version 0x0006
Linker Revision 0x0001
Entry Table Offset 0x031B
Entry Table Length 0x0002
Checksum 0x00000000
Module Flags 0x030A
DGROUP seg 0x0006
Heap Size 0x8000
Stack Size 0x2000
Initial CS:IP seg 0x0001 offset 0x0000
Initial SS:SP seg 0x0006 offset 0x0000
Entries in Segment Table 0x0006
Entries in Module Table 0x0006
Non-Resident Name Table Size 0x0039
Segment Table Offset 0x0040
Resource Table Offset 0x0070
Resident Name Table Offset 0x02E0
Module Table Offset 0x02E9
Imported Name Table Offset 0x02F5
Non-Resident Name Table Offset 0x0000056D
Moveable entries 0x0000
Alignment Shift Count 0x0009
Resource Segments 0x0000
Executable Type 0x0002
Additional Flags 0x0008
Fast Load Offset 0x0003
Fast Load Length 0x00D6
Relocation table offset 0x0040
Overlay Number 0x0000
New EXE Offset 0x00000250
New EXE Header Info (Main Menu)
Module LAPIT
Description Lapit weave pattern editing system
Data NONSHARED
Windows Version 3.10 (PMODE ONLY!)
Signature 0x454E
Linker Version 0x0006
Linker Revision 0x0001
Entry Table Offset 0x031B
Entry Table Length 0x0002
Checksum 0x00000000
Module Flags 0x030A
DGROUP seg 0x0006
Heap Size 0x8000
Stack Size 0x2000
Initial CS:IP seg 0x0001 offset 0x0000
Initial SS:SP seg 0x0006 offset 0x0000
Entries in Segment Table 0x0006
Entries in Module Table 0x0006
Non-Resident Name Table Size 0x0039
Segment Table Offset 0x0040
Resource Table Offset 0x0070
Resident Name Table Offset 0x02E0
Module Table Offset 0x02E9
Imported Name Table Offset 0x02F5
Non-Resident Name Table Offset 0x0000056D
Moveable entries 0x0000
Alignment Shift Count 0x0009
Resource Segments 0x0000
Executable Type 0x0002
Additional Flags 0x0008
Fast Load Offset 0x0003
Fast Load Length 0x00D6
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi
I have been trying to locate the source code for the program and i hope to have it available on monday when i do i will post it so you can see if you can help
Thanks peter
I have been trying to locate the source code for the program and i hope to have it available on monday when i do i will post it so you can see if you can help
Thanks peter
ASKER
Hi
I have now found what i think is the source code and have attached a sample if this is no good i will have to use the emulator option as it will only be needed on 2 pc's.
Thanks for any help
Peter
#include <stdio.h>
#include "windows.h"
#include "resource.h"
#include "lapit.h"
void
HandleSelectionState(LPDRA WITEMSTRUC T lpdis,int inflate);
void
HandleFocusState(LPDRAWITE MSTRUCT lpdis,int inflate);
void
DrawEntireItem(LPDRAWITEMS TRUCT lpdis,int inflate);
void
SetColours(HWND hDlg,int CtrlID,COLORREF IntlColr);
/* set up the colours in combo box */
/************************* ********** ********** ********** ********** ********** *
* *
* FUNCTION : HandleSelectionState(LPDRA WITEMSTRUC T, int) *
* *
* PURPOSE : Handles a change in an item selection state. If an item is *
* selected, a black rectangular frame is drawn around that *
* item; if an item is de-selected, the frame is removed. *
* *
* COMMENT : The black selection frame is slightly larger than the gray *
* focus frame so they won't paint over each other. *
* *
************************** ********** ********** ********** ********** ********** /
void
HandleSelectionState(LPDRA WITEMSTRUC T lpdis,int inflate)
{
RECT rc;
HBRUSH hbr;
/* Resize rectangle to place selection frame outside of the focus
* frame and the item.
*/
CopyRect ((LPRECT)&rc, (LPRECT)&lpdis->rcItem);
InflateRect ((LPRECT)&rc, inflate, inflate);
if (lpdis->itemState & ODS_SELECTED)
{
/* selecting item -- paint a black frame */
hbr = GetStockObject(BLACK_BRUSH );
}
else
{
/* de-selecting item -- remove frame */
hbr = CreateSolidBrush(GetSysCol or(COLOR_W INDOW));
}
FrameRect(lpdis->hDC, (LPRECT)&rc, hbr);
DeleteObject (hbr);
}
/************************* ********** ********** ********** ********** ********** *
* *
* FUNCTION : HandleFocusState(LPDRAWITE MSTRUCT, int) *
* *
* PURPOSE : Handle a change in item focus state. If an item gains the *
* input focus, a gray rectangular frame is drawn around that *
* item; if an item loses the input focus, the gray frame is *
* removed. *
* *
* COMMENT : The gray focus frame is slightly smaller than the black *
* selection frame so they won't paint over each other. *
* *
************************** ********** ********** ********** ********** ********** /
void
HandleFocusState(LPDRAWITE MSTRUCT lpdis,int inflate)
{
RECT rc;
HBRUSH hbr;
/* Resize rectangle to place focus frame between the selection
* frame and the item.
*/
CopyRect ((LPRECT)&rc, (LPRECT)&lpdis->rcItem);
InflateRect ((LPRECT)&rc, inflate, inflate);
if (lpdis->itemState & ODS_FOCUS)
{
/* gaining input focus -- paint a gray frame */
hbr = GetStockObject(GRAY_BRUSH) ;
}
else
{
/* losing input focus -- remove (paint over) frame */
hbr = CreateSolidBrush(GetSysCol or(COLOR_W INDOW));
}
FrameRect(lpdis->hDC, (LPRECT)&rc, hbr);
DeleteObject (hbr);
}
/************************* ********** ********** ********** ********** ********** *
* *
* FUNCTION : DrawEntireItem(LPDRAWITEMS TRUCT, int) *
* *
* PURPOSE : Draws an item and frames it with a selection frame and/or *
* a focus frame when appropriate. *
* *
************************** ********** ********** ********** ********** ********** /
void
DrawEntireItem(LPDRAWITEMS TRUCT lpdis,int inflate)
{
RECT rc;
HBRUSH hbr;
/* Resize rectangle to leave space for frames */
CopyRect ((LPRECT)&rc, (LPRECT)&lpdis->rcItem);
InflateRect ((LPRECT)&rc, inflate, inflate);
/* Create a brush using the value in the item data field (this value
* was initialized when we added the item to the list/combo box using
* LB_ADDSTRING/CB_ADDSTRING) and draw the color in the list/combo box.
*/
hbr = CreateSolidBrush (lpdis->itemData);
FillRect (lpdis->hDC, (LPRECT)&rc, hbr);
DeleteObject (hbr);
/* Draw or erase appropriate frames */
HandleSelectionState(lpdis , inflate + 4);
HandleFocusState(lpdis, inflate + 2);
}
BOOL FAR PASCAL AlterColours(hDlg, message, wParam, lParam)
HWND hDlg;
unsigned message;
WORD wParam;
LONG lParam;
{
LPDRAWITEMSTRUCT lpdis;
LPMEASUREITEMSTRUCT lpmis;
/* Variables for WM_DRAWITEM */
RECT rc;
HBRUSH hbr;
int Item;
static PattData *Pat;
static HLOCAL hMem;
switch (message)
{
case WM_INITDIALOG:
/* get colours from pattern data */
hMem=(HLOCAL) lParam;
Pat=(PattData *) LocalLock(hMem);
/* set up the colours */
SetColours(hDlg,IDC_NRMTRV B,Pat->Clr ScrTrvB);
SetColours(hDlg,IDC_NRMTRV C,Pat->Clr ScrTrvC);
SetColours(hDlg,IDC_NRMOVR LAP,Pat->C lrScrTrvMi x);
SetColours(hDlg,IDC_PRTTRV B,Pat->Clr PrtTrvB);
SetColours(hDlg,IDC_PRTTRV C,Pat->Clr PrtTrvC);
SetColours(hDlg,IDC_PRTOVR LAP,Pat->C lrPrtTrvMi x);
break;
case WM_COMMAND:
switch (wParam)
{
case IDOK:
/* overwrite the current colours with selections */
Item=SendMessage(GetDlgIte m(hDlg, IDC_NRMTRVB),CB_GETCURSEL, 0,0L);
Pat->ClrScrTrvB=SendMessag e(GetDlgIt em(hDlg, IDC_NRMTRVB),CB_GETITEMDAT A,Item,0L) ;
Item=SendMessage(GetDlgIte m(hDlg, IDC_NRMTRVC),CB_GETCURSEL, 0,0L);
Pat->ClrScrTrvC=SendMessag e(GetDlgIt em(hDlg, IDC_NRMTRVC),CB_GETITEMDAT A,Item,0L) ;
Item=SendMessage(GetDlgIte m(hDlg, IDC_NRMOVRLAP),CB_GETCURSE L,0,0L);
Pat->ClrScrTrvMix=SendMess age(GetDlg Item(hDlg, IDC_NRMOVRLAP),CB_GETITEMD ATA,Item,0 L);
Item=SendMessage(GetDlgIte m(hDlg, IDC_PRTTRVB),CB_GETCURSEL, 0,0L);
Pat->ClrPrtTrvB=SendMessag e(GetDlgIt em(hDlg, IDC_PRTTRVB),CB_GETITEMDAT A,Item,0L) ;
Item=SendMessage(GetDlgIte m(hDlg, IDC_PRTTRVC),CB_GETCURSEL, 0,0L);
Pat->ClrPrtTrvC=SendMessag e(GetDlgIt em(hDlg, IDC_PRTTRVC),CB_GETITEMDAT A,Item,0L) ;
Item=SendMessage(GetDlgIte m(hDlg, IDC_PRTOVRLAP),CB_GETCURSE L,0,0L);
Pat->ClrPrtTrvMix=SendMess age(GetDlg Item(hDlg, IDC_PRTOVRLAP),CB_GETITEMD ATA,Item,0 L);
case IDCANCEL:
LocalUnlock(hMem);
EndDialog (hDlg, wParam);
return(TRUE);
default:
return(TRUE);
}
case WM_DRAWITEM:
/* Get pointer to the DRAWITEMSTRUCT */
lpdis = (LPDRAWITEMSTRUCT)lParam;
switch (lpdis->itemAction)
{
case ODA_DRAWENTIRE:
DrawEntireItem(lpdis, -4);
break;
case ODA_SELECT:
HandleSelectionState(lpdis , 0);
break;
case ODA_FOCUS:
HandleFocusState(lpdis, -2);
break;
}
/* Return TRUE meaning that we processed this message. */
return(TRUE);
case WM_MEASUREITEM:
lpmis = (LPMEASUREITEMSTRUCT)lPara m;
/* All the items are the same height since the combo box is
* CBS_OWNERDRAWFIXED
*/
if ((int)lpmis->itemID == -1)
{
/* If -1 for item, then we are setting the height of the
* always visible static item part of the dropdown combo box.
*/
lpmis->itemHeight = 25;
return(TRUE);
}
lpmis->itemHeight = 30;
break;
case WM_CLOSE:
LocalUnlock(hMem);
EndDialog(hDlg, IDOK);
return(TRUE);
default:
return(FALSE);
}
return(TRUE);
}
void
SetColours(HWND hDlg,int CtrlID,COLORREF IntlColr)
/* set up the colours in combo box */
{
int i;
COLORREF ColourSet[]={
RGB(0,0,0),
RGB(0,0,255),
RGB(255,0,0),
RGB(255,0,255),
RGB(0,255,0),
RGB(0,255,255),
RGB(255,255,0),
RGB(255,255,255),
RGB(0,0,128),
RGB(128,0,0),
RGB(128,0,128),
RGB(0,128,0),
RGB(0,128,128),
RGB(128,128,0),
RGB(128,128,128)};
for (i=0; i<15; i++)
{
SendMessage (GetDlgItem(hDlg, CtrlID),CB_ADDSTRING,0,Col ourSet[i]) ;
/* if this colour default colour select it */
if (IntlColr==ColourSet[i])
SendMessage (GetDlgItem(hDlg, CtrlID),CB_SETCURSEL,i,0L) ;
}
}
I have now found what i think is the source code and have attached a sample if this is no good i will have to use the emulator option as it will only be needed on 2 pc's.
Thanks for any help
Peter
#include <stdio.h>
#include "windows.h"
#include "resource.h"
#include "lapit.h"
void
HandleSelectionState(LPDRA
void
HandleFocusState(LPDRAWITE
void
DrawEntireItem(LPDRAWITEMS
void
SetColours(HWND hDlg,int CtrlID,COLORREF IntlColr);
/* set up the colours in combo box */
/*************************
* *
* FUNCTION : HandleSelectionState(LPDRA
* *
* PURPOSE : Handles a change in an item selection state. If an item is *
* selected, a black rectangular frame is drawn around that *
* item; if an item is de-selected, the frame is removed. *
* *
* COMMENT : The black selection frame is slightly larger than the gray *
* focus frame so they won't paint over each other. *
* *
**************************
void
HandleSelectionState(LPDRA
{
RECT rc;
HBRUSH hbr;
/* Resize rectangle to place selection frame outside of the focus
* frame and the item.
*/
CopyRect ((LPRECT)&rc, (LPRECT)&lpdis->rcItem);
InflateRect ((LPRECT)&rc, inflate, inflate);
if (lpdis->itemState & ODS_SELECTED)
{
/* selecting item -- paint a black frame */
hbr = GetStockObject(BLACK_BRUSH
}
else
{
/* de-selecting item -- remove frame */
hbr = CreateSolidBrush(GetSysCol
}
FrameRect(lpdis->hDC, (LPRECT)&rc, hbr);
DeleteObject (hbr);
}
/*************************
* *
* FUNCTION : HandleFocusState(LPDRAWITE
* *
* PURPOSE : Handle a change in item focus state. If an item gains the *
* input focus, a gray rectangular frame is drawn around that *
* item; if an item loses the input focus, the gray frame is *
* removed. *
* *
* COMMENT : The gray focus frame is slightly smaller than the black *
* selection frame so they won't paint over each other. *
* *
**************************
void
HandleFocusState(LPDRAWITE
{
RECT rc;
HBRUSH hbr;
/* Resize rectangle to place focus frame between the selection
* frame and the item.
*/
CopyRect ((LPRECT)&rc, (LPRECT)&lpdis->rcItem);
InflateRect ((LPRECT)&rc, inflate, inflate);
if (lpdis->itemState & ODS_FOCUS)
{
/* gaining input focus -- paint a gray frame */
hbr = GetStockObject(GRAY_BRUSH)
}
else
{
/* losing input focus -- remove (paint over) frame */
hbr = CreateSolidBrush(GetSysCol
}
FrameRect(lpdis->hDC, (LPRECT)&rc, hbr);
DeleteObject (hbr);
}
/*************************
* *
* FUNCTION : DrawEntireItem(LPDRAWITEMS
* *
* PURPOSE : Draws an item and frames it with a selection frame and/or *
* a focus frame when appropriate. *
* *
**************************
void
DrawEntireItem(LPDRAWITEMS
{
RECT rc;
HBRUSH hbr;
/* Resize rectangle to leave space for frames */
CopyRect ((LPRECT)&rc, (LPRECT)&lpdis->rcItem);
InflateRect ((LPRECT)&rc, inflate, inflate);
/* Create a brush using the value in the item data field (this value
* was initialized when we added the item to the list/combo box using
* LB_ADDSTRING/CB_ADDSTRING)
*/
hbr = CreateSolidBrush (lpdis->itemData);
FillRect (lpdis->hDC, (LPRECT)&rc, hbr);
DeleteObject (hbr);
/* Draw or erase appropriate frames */
HandleSelectionState(lpdis
HandleFocusState(lpdis, inflate + 2);
}
BOOL FAR PASCAL AlterColours(hDlg, message, wParam, lParam)
HWND hDlg;
unsigned message;
WORD wParam;
LONG lParam;
{
LPDRAWITEMSTRUCT lpdis;
LPMEASUREITEMSTRUCT lpmis;
/* Variables for WM_DRAWITEM */
RECT rc;
HBRUSH hbr;
int Item;
static PattData *Pat;
static HLOCAL hMem;
switch (message)
{
case WM_INITDIALOG:
/* get colours from pattern data */
hMem=(HLOCAL) lParam;
Pat=(PattData *) LocalLock(hMem);
/* set up the colours */
SetColours(hDlg,IDC_NRMTRV
SetColours(hDlg,IDC_NRMTRV
SetColours(hDlg,IDC_NRMOVR
SetColours(hDlg,IDC_PRTTRV
SetColours(hDlg,IDC_PRTTRV
SetColours(hDlg,IDC_PRTOVR
break;
case WM_COMMAND:
switch (wParam)
{
case IDOK:
/* overwrite the current colours with selections */
Item=SendMessage(GetDlgIte
Pat->ClrScrTrvB=SendMessag
Item=SendMessage(GetDlgIte
Pat->ClrScrTrvC=SendMessag
Item=SendMessage(GetDlgIte
Pat->ClrScrTrvMix=SendMess
Item=SendMessage(GetDlgIte
Pat->ClrPrtTrvB=SendMessag
Item=SendMessage(GetDlgIte
Pat->ClrPrtTrvC=SendMessag
Item=SendMessage(GetDlgIte
Pat->ClrPrtTrvMix=SendMess
case IDCANCEL:
LocalUnlock(hMem);
EndDialog (hDlg, wParam);
return(TRUE);
default:
return(TRUE);
}
case WM_DRAWITEM:
/* Get pointer to the DRAWITEMSTRUCT */
lpdis = (LPDRAWITEMSTRUCT)lParam;
switch (lpdis->itemAction)
{
case ODA_DRAWENTIRE:
DrawEntireItem(lpdis, -4);
break;
case ODA_SELECT:
HandleSelectionState(lpdis
break;
case ODA_FOCUS:
HandleFocusState(lpdis, -2);
break;
}
/* Return TRUE meaning that we processed this message. */
return(TRUE);
case WM_MEASUREITEM:
lpmis = (LPMEASUREITEMSTRUCT)lPara
/* All the items are the same height since the combo box is
* CBS_OWNERDRAWFIXED
*/
if ((int)lpmis->itemID == -1)
{
/* If -1 for item, then we are setting the height of the
* always visible static item part of the dropdown combo box.
*/
lpmis->itemHeight = 25;
return(TRUE);
}
lpmis->itemHeight = 30;
break;
case WM_CLOSE:
LocalUnlock(hMem);
EndDialog(hDlg, IDOK);
return(TRUE);
default:
return(FALSE);
}
return(TRUE);
}
void
SetColours(HWND hDlg,int CtrlID,COLORREF IntlColr)
/* set up the colours in combo box */
{
int i;
COLORREF ColourSet[]={
RGB(0,0,0),
RGB(0,0,255),
RGB(255,0,0),
RGB(255,0,255),
RGB(0,255,0),
RGB(0,255,255),
RGB(255,255,0),
RGB(255,255,255),
RGB(0,0,128),
RGB(128,0,0),
RGB(128,0,128),
RGB(0,128,0),
RGB(0,128,128),
RGB(128,128,0),
RGB(128,128,128)};
for (i=0; i<15; i++)
{
SendMessage (GetDlgItem(hDlg, CtrlID),CB_ADDSTRING,0,Col
/* if this colour default colour select it */
if (IntlColr==ColourSet[i])
SendMessage (GetDlgItem(hDlg, CtrlID),CB_SETCURSEL,i,0L)
}
}
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks Paul,
I will have a look and try filemon, I may have to come back as i know very little about c++ writing
Peter
I will have a look and try filemon, I may have to come back as i know very little about c++ writing
Peter
This is the details for the executable. In almost all cases, an executable is built from a set of source files (usually collectively called 'source code') It will be almost impossible to reliably change this program without source code. I would strongly recommend you try to find the source to this program.
Another alternative might be to run this under an emulator. Microsoft have released a PC Emulator for just such a problem as you have. If this is a valid alternative, let us know and we'll make some suggestions. The downside of this will be that you will have to install and configure the emulator on every PC that wants to run the program and this is not a trivial process.
Paul