|
The architecture you describe is almost impossible to believe !!! That someone would interface java classes into a C++ game to provide user extendable functionalilty is implausible to say the least. I suspect that you are confused. However in case you are not
java.awt.AWTKeyStroke / javax.swing.KeyStroke is what you are looking for.
http://java.sun.com/j2se/1.4.2/docs/api/
|
|
|
|
|
Thank you.
About the game.. It really is the way i described it, the game is Vampire: The Masquerade - Redemption from Nihilistic Software. Many RP games implement some sort of scripting feature these days to let users add modules and all (like NeverWinter Nights for example). Just with Vampire, they chose to use Java instead of inventing their own scripting language for it. I'm guessing it loads all classes on startup in the JVM (A javai.dll is included in the root directory of the game) and the dll maps the function calls to the executable and vice versa. When u make a script u just have to make sure u derive it from a base class (in most cases Codex) and then there's subclasses for things, players, actors, regions, sectors, sounds, items, disciplines and so on.
Kuniva
--------------------------------------------
|
|
|
|
|
Ok here is the code...
<code> m_strOut = "scrollbar-darkshadow-Color:"+m_str1+";\r\n"+
"scrollbar-3dlight-Color:"+m_str2+";\r\n"+
"scrollbar-arrow-Color:"+m_str3+";\r\n"+
"scrollbar-base-Color:"+m_str4+";\r\n"+
"scrollbar-face-Color:"+m_str5+";\r\n"+
"scrollbar-highlight-Color:"+m_str6+";\r\n"+
"scrollbar-shadow-Color:"+m_str7+";\r\n"+
"scrollbar-track-Color:"+m_str8+";";</code>
and when I changed it to...
<code> m_strOut = "<style>\r\n"+
"{\r\n"+
"scrollbar-darkshadow-Color:"+m_str1+";\r\n"+
"scrollbar-3dlight-Color:"+m_str2+";\r\n"+
"scrollbar-arrow-Color:"+m_str3+";\r\n"+
"scrollbar-base-Color:"+m_str4+";\r\n"+
"scrollbar-face-Color:"+m_str5+";\r\n"+
"scrollbar-highlight-Color:"+m_str6+";\r\n"+
"scrollbar-shadow-Color:"+m_str7+";\r\n"+
"scrollbar-track-Color:"+m_str8+";\r\n"+
"}\r\n"+
"</style>";</code>
I get an error : error C2110: cannot add two pointers.
I don't know what is the problem.
HELP!!!!
<marquee>Universal Project</marquee>
|
|
|
|
|
You can't concatenate ptrs in a CString. So:
m_strOut = "abc"; is ok but m_strOut = "abc" + "def"; isn't. You can resolve this with:
m_strOut = "abc";
m_strOut + "def";
or:
m_strOut = "abc" + CString("def");
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
Thankyou I solved it by doing:
m_strOut = "<style>\r\n{\r\nscrollbar-darkshadow-Color:"+m_str1+";\r\n"+
"scrollbar-3dlight-Color:"+m_str2+";\r\n"+
"scrollbar-arrow-Color:"+m_str3+";\r\n"+
"scrollbar-base-Color:"+m_str4+";\r\n"+
"scrollbar-face-Color:"+m_str5+";\r\n"+
"scrollbar-highlight-Color:"+m_str6+";\r\n"+
"scrollbar-shadow-Color:"+m_str7+";\r\n"+
"scrollbar-track-Color:"+m_str8+"\r\n}\r\n</style>";
<marquee>Universal Project</marquee>
|
|
|
|
|
But
";\r\n"+"scrollbar-3dlight-Color:" shouldn't compile.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
I think it works because of the evaluation order, i.e.:
"<style>\r\n{\r\nscrollbar-darkshadow-Color:"+m_str1 Results in a CString, then
(previous CString) + ";\r\n" results in another CString, so the following concatenation is a CString + a const char* .
- Mike
|
|
|
|
|
I guess it does compile since I did it If you want I'll send you the source.
I think the \r\n makes it posibble I think. Send me an email if you want the source or executable.
<marquee>Universal Project
|
|
|
|
|
I have heard about TWAIN to scan an image.
Looking in codeproject and codeguru i saw samples about it.
However, those samples use the vendor UI.
I need to scan an image without using the vendor UI.
I need to set the resolution as well.
I will appreciate getting a sample.
Thanks in advance,
Dudi
|
|
|
|
|
what does "scan" mean? to get buffer of the image, or scan the buffer?
includeh10
|
|
|
|
|
"Scan" means scanning an image using flatbed scanner.
|
|
|
|
|
OK, i have found it.
Just setting ShowUI field to FALSE in a structure TW_USERINTERFACE.
|
|
|
|
|
as my test, calling function GetDocument() in a thread always causes program crashes, why?
includeh10
|
|
|
|
|
|
i do use raw thread instead of AfxBeginThread.
do you mean AfxBeginThread will solve the problem? if so, AfxBeginThread should have something difference inside?
thx.
includeh10
|
|
|
|
|
Theads don't see the CWnd* Maps of other threads, so you can only see the views/documents created in each thread. In your example GetDocument will be returning NULL, which you should always be testing for.
Neville Franks, Author of ED for Windows. Free Trial at www.getsoft.com
|
|
|
|
|
i got the following problem:
i'm "translating" a console-based c++ programm into a mfc-application. i have to open a file, which is located at the same directory as the executable. in my console-based programm this worked with just:
fstream file("filename",ios::in);
but in the mfc-programm this doesn't work, although i don't know why. so i'looking for a function that returns the path of the executable, or something that doesn't force me to put my file in a fixed directory or to open a openfile dialog.
any idea?
alexis
|
|
|
|
|
GetModuleFileName(0,....);
includeh10
|
|
|
|
|
|
CString CYourDlg::GetLaunchedDir()
{
TCHAR szFullPath[MAX_PATH];
TCHAR szDir[_MAX_DIR];
TCHAR szDrive[_MAX_DRIVE];
CString strLaunched;
::GetModuleFileName(NULL, szFullPath, MAX_PATH);
_splitpath(szFullPath, szDrive, szDir, NULL, NULL);
strLaunched.Format(_T("%s%s"), szDrive, szDir);
return strLaunched;
}
Works in both MFC environment as without (of course u'd have to change the CString to some other string container).
Kuniva
--------------------------------------------
|
|
|
|
|
this is to rephrase my last question
this project must be done on c++ or vc++, it must be something like argoUML, obviosly not as advanced. i want a user to create a design from a set of icons on a pallet, and then save the design and retrieve it and edit it.... any ideas and starting points... (thanx John m. for the reply)
smile...its your destiny
|
|
|
|
|
lxxrya001 wrote:
c++ or vc++
Niether of these have builtin drawing functions or the concept of a canvas. In windows their are many choices on what graphics library to use. Win32 API, MFC, WTL and third party toolkits such as VCF or wxWindows.
John
|
|
|
|
|
Hi Friends,
I want to create a Splitter Window using Win32 API in SDK.
If any one knows how to do it, Please help me.
Thanks
|
|
|
|
|
There is no MFC like Splitter control in W32API
but you can easy implement it
just take a look at following example:
// splitter.cpp
#include "stdafx.h"
#include "resource.h"
#include <commctrl.h>
HINSTANCE hInst;
TCHAR szTitle[]="Splitter";
TCHAR szWindowClass[]="Splitter";
HWND hWnd;
int nSplitPos=320; // splitter position
HWND hLB1,hLB2;
LRESULT CALLBACK WndProc( HWND, UINT, WPARAM, LPARAM );
VOID Resize();
LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)
{
int xPos,yPos;
long fwKeys;
switch( message )
{
case WM_MOUSEMOVE:
xPos = LOWORD(lParam);
yPos = HIWORD(lParam);
fwKeys=wParam;
// receiving WM_MOUSEMOVE we will check if mouse is inside splitter
if(xPos>nSplitPos-2||xPos<nSplitPos+2)
{
SetCursor(LoadCursor(NULL,IDC_SIZEWE));
// if left button is pressed
// set splitter position to mouse x position
if(fwKeys==MK_LBUTTON)
{
SetCapture(hWnd);
RECT rc;
GetWindowRect(hWnd,&rc);
rc.right-=10;
rc.left+=10;
ClipCursor(&rc);// prevent user to drag splitter out of window
nSplitPos=xPos;
// at last resize views
Resize();
}
else
{
ReleaseCapture();
}
}
break;
case WM_LBUTTONDOWN:
xPos = LOWORD(lParam);
yPos = HIWORD(lParam);
if(xPos>nSplitPos-2||xPos<nSplitPos+2)
SetCursor(LoadCursor(NULL,IDC_SIZEWE));
break;
case WM_SIZE:
Resize();
break;
case WM_DESTROY:
PostQuitMessage( 0 );
break;
default:
return DefWindowProc( hWnd, message, wParam, lParam );
}
return 0;
}
VOID Resize()
{
RECT rc;
GetClientRect(hWnd,&rc);
MoveWindow(hLB1,0,0,nSplitPos-2,rc.bottom,TRUE);
MoveWindow(hLB2,nSplitPos+2,0,rc.right-nSplitPos-2,rc.bottom,TRUE);
}
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow )
{
MSG msg;
hInst = hInstance;
InitCommonControls();
WNDCLASSEX wcex;
wcex.cbSize = sizeof(WNDCLASSEX);
wcex.style = CS_HREDRAW | CS_VREDRAW;
wcex.lpfnWndProc = (WNDPROC)WndProc;
wcex.cbClsExtra = 0;
wcex.cbWndExtra = 0;
wcex.hInstance = hInstance;
wcex.hIcon = LoadIcon(hInstance, (LPCTSTR)IDI_SPLITTER);
wcex.hCursor = LoadCursor(NULL, IDC_ARROW);
wcex.hbrBackground = (HBRUSH)(COLOR_WINDOW+1);
wcex.lpszMenuName = NULL;
wcex.lpszClassName = szWindowClass;
wcex.hIconSm = LoadIcon(wcex.hInstance, (LPCTSTR)IDI_SMALL);
RegisterClassEx(&wcex);
hWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW|WS_CLIPCHILDREN,
CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL);
hLB1=CreateWindowEx(0,"LISTBOX",0,
WS_CHILD|WS_VISIBLE|WS_BORDER|LBS_NOINTEGRALHEIGHT,0,0,0,0,hWnd,NULL,hInst,0);
hLB2=CreateWindowEx(0,"LISTBOX",0,
WS_CHILD|WS_VISIBLE|WS_BORDER|LBS_NOINTEGRALHEIGHT,0,0,0,0,hWnd,NULL,hInst,0);
SendMessage(hLB1,LB_INSERTSTRING,-1,(WPARAM)"Listbox1");
SendMessage(hLB2,LB_INSERTSTRING,-1,(WPARAM)"Listbox2");
if( !hWnd ) return FALSE;
ShowWindow( hWnd, nCmdShow );
UpdateWindow( hWnd );
Resize();
while( GetMessage(&msg, NULL, 0, 0) )
{
TranslateMessage( &msg );
DispatchMessage( &msg );
}
return msg.wParam;
}
|
|
|
|
|
I have a problem with named mutex.
In my 1st process I am creating mutex
<br />
CreateMutex(NULL,TRUE,"Process_Running"); <br />
if(GetLastError() == ERROR_ALREADY_EXISTS) { <br />
AfxMessageBox(IDS_ALREADYRUN);<br />
}<br />
Then, in 2nd process I am try to determine, whether 1st process is running:
<br />
HANDLE hMutex = OpenMutex(0,FALSE,"Process_Running");<br />
<br />
if (hMutex != NULL)<br />
{<br />
CloseHandle(hMutex);<br />
}<br />
But in this code hMutex is always NULL ! Even if 1st process is running!
What am I doing wrong ?
|
|
|
|
|