Hi Vortex,
first i will explain the deferent between old c-- and the modified c--.
1- NewSphinxC always produces obj file so there is no need to #pragma option coff //coff format.
2- because of using alink as a default linker , there is new directive '#includelib' that tells alink which libs and objs will be linked, there is no need to put the obj name of source code.
// this links win32 library & msvcrt library
#includelib win32.lib MSVCRT.lib
3- when using '#includepath' you just use '$' term then the path so NewSphinxC will insert the correct path automatically for you.
// $ will replaced with SphinxC-- main path
#includepath "$\winlib"
4-there is no need to include windows header as you did , just include windows.h
// those feet my needs
#include <windows.h>
#include <MSVCRT.H-->
5- there is no need to use '#pragma option J0' directive so NewSpinxC allows to determine the entry point with '#Entry' directive. the default is main function
// tells linker to start from main function.
#Entry main
here is you code compiled & worked okay
#pragma option w32 //create Windows GUI EXE.
#pragma option w //enable warning.
#pragma option 3 //386 CPU.
#includelib win32.lib MSVCRT.lib ole32.lib
#includepath "$\winlib"
#include <windows.h>
#include "Menu.rc" //resource file.
dword hInst;
dword hWnd;
dword hMenu;
char classTitle="Menu demo";
char szMenuName="WinMenu";
void main()
{
struct MSG msgStruc;
struct WNDCLASSEX WndClassEx;
hInst=GetModuleHandle(0);
WndClassEx.cbSize=sizeof(WndClassEx);
WndClassEx.style=CS_HREDRAW|CS_VREDRAW;
WndClassEx.lpfnWndProc=#WndProc;
WndClassEx.cbWndExtra=0;
WndClassEx.cbClsExtra=0;
WndClassEx.hInstance=hInst;
WndClassEx.hIcon=LoadIcon(NULL,IDI_APPLICATION);
WndClassEx.hCursor=LoadCursor(0,IDC_ARROW);
WndClassEx.hbrBackground=COLOR_WINDOW+1;
WndClassEx.lpszMenuName=#szMenuName;
WndClassEx.lpszClassName=#classTitle;
WndClassEx.hIconSm=0;
RegisterClassEx(#WndClassEx);
hWnd=CreateWindowEx(WS_EX_OVERLAPPEDWINDOW,#classTitle,"Demo program",
WS_OVERLAPPEDWINDOW,CW_USEDEFAULT,CW_USEDEFAULT,CW_USEDEFAULT,
CW_USEDEFAULT,0,0,hInst,0);
ShowWindow(EAX,SW_SHOW); //show window
UpdateWindow(hWnd); //redraw window
WHILE(GetMessage(#msgStruc,0,0,0)){
TranslateMessage(#msgStruc);
DispatchMessage(#msgStruc);
}
ExitProcess(0);
}
dword WndProc(dword hwnd,msg,wParam,lParam)
{
SWITCH(msg){
CASE WM_DESTROY:
PostQuitMessage(0);
EAX=0;
BREAK;
CASE WM_COMMAND:
IF(lParam==0) {
switch(wParam)
{
case IDM_ABOUT:
MessageBox(hwnd,"Sphinx C-- Sample","Hello!",MB_OK);
break;
case IDM_EXIT:
DestroyWindow(hwnd);
break;
}
}
break;
default:
DefWindowProc(hwnd,msg,wParam,lParam);
}
}
Edited:
why the plugins are loaded automatically?
I get some copies of the source file after the compilation
the PlugIn System of NewSpinxC works like that , each PlugIn will delver the source code and make it's processing then pass back.
so Macro Plugin will get the original source code the process it and save it as ....$0.c-- , the second PlugIn will get ....$0.c-- then process it then save as ....$1.c-- and so on.
finaly c-- will get ...$n-1.c-- and compile it as original filename.exe
it is useful when debug the output of a certain plugin.