|
Yes I would tend to agree - the whole task is not easy. But there are a couple of good reasons why I'm not using an intirpreter - firstly is speed as you mentioned... I know that they do get faster than MsVB, but even so they are slow - I mean I'm talking about raytracing flyround movies of 3d fractals; I need power! Also writing an intirpreter sounds to me like a task as formitable as cut and pasting machine code.
Anyway thanks for the suggestions
With time we live, with money we spend!
Joel Holdsworth.
|
|
|
|
|
Hi Joel,
This sounds like an interesting project indeed. To use the .obj files directly you would need to perform all the processing steps that the linker does. This is stuff like address fix ups, checking referenced code exists etc.etc. I don't think you want to go there.
A better approach is to use a language which runs in a virtual machine. Our programmer's editor (see sig) uses this approach. It has a C extension language, with some C++ features. Code is compiled once into vm code and then executed in an interpreter. Some virtual machines compile on the fly, without producing intermediate code.
There are several C/C++ VM's around including CINT, CH and UnderC, but the one I suggest you look at us UnderC at http://home.mweb.co.za/sd/sdonovan/underc.html[^] This is reasonably young project and is developing fairly slowly, but Steve Donovan is doing a good job. I had a play with an early version last year and was quite impressed. It has come a ways since then.
I'd be interested to hear how your project evolves.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Hmm yes that sounds like an interesting alternative... But what worries me is really the speed. You see with this project I expect to be pushing the boundries of image power - and I need just that raw power + flexiility. This is a much better VM than I had imagined, but i'd still expect it to be slowish. Bear in mind that I am talking about rendering fractals, and other such demanding imaging applications... Incidentally do you happen to know exactly how well it performs?
Alternativly I could save the user time if he/she was repeatedly recompiling by using the intirpreter, and doing an old style Compiler-Linker conventional compile when the code settles down!
*¨¨`)
¸¸.·´ ¸.·*¨¨`)
(¸¸.·* ¸ .·*
¸¸.·*
(¸¸.~~> Joel Holdsworth.
|
|
|
|
|
If at all possible you need to have the CPU intensive stuff in straight C++ and just call high level routines from the interpreted code. So you wouldn't say draw 1M pixels, but draw me this object. I realize that may not be feasible here.
I have't done any performance testing, but my guess it would be fine for the sorts of things I'd want to use it for. Certainly the interpreted code in ED performs just fine. This is not UnderC though.
Starting with code in an interpreter is great for rapid prototyping, and then as you say, if performance is an issue, more it to native code.
I'd give UnderC a whirl and see how it stacks up.
Neville Franks, Author of ED for Windows. www.getsoft.com
Make money with our new Affilate program
|
|
|
|
|
Hi Everyone,
I was wondering what the difference between ON_MESSAGE and ON_THREAD_MESSAGE is? It seems in the documentation it states that when you have a CWinThread class that you should use ON_THREAD_MESSAGE. Does this mean you should use ON_THREAD_MESSAGE everywhere, or just where the thread is posting messages?
Sincerly,
Clint
|
|
|
|
|
You use ON_THREAD_MESSAGE in your CWinThread derived class to handle messages sent via PostThreadMessage(). You use ON_MESSAGE to handle messages sent via SendMessage() or PostMessage() (or others) in CWnd-derived classes, even if the message in question has been sent between threads.
Dave
|
|
|
|
|
Hello,
I was wondering if it was still needed to call ReleaseBuffer(); as after a GetBuffer(); call, if I call (LPTSTR)(LPCTSTR) before the parameter to pass...
As my english is not my best, I've thought of placing a sample:
method A
Arxiu.Write((LPTSTR)(LPCTSTR)cs, cs.GetLength());
method B
Arxiu.Write(cs.GetBuffer(cs.GetLength()),cs.GetLength());
cs.ReleaseBuffer(); Are the two of them right?
Thank you in advance.
|
|
|
|
|
The LPCTSTR operator on the CString returns a constant string - you should never cast it to non-const string to change it. So while the first example will compile, and possibly work (depending on what Arxiu.Write() does), it is bad practice, and could cause problems.
You only need to call ReleaseBuffer() after a call to GetBuffer() to tell the CString to take control over the buffer again (and allowing you to call other methods).
Dave
|
|
|
|
|
First, if Arxiu.Write is not going to modify the string, then it should be declared as a LPCTSTR and not LPTSTR. Then the problem just magically goes away.
However, if you have no control over how Arxiu.Write is defined AND you are 100% sure that it does not modify the buffer, then (LPTSTR)(LPCTSTR) is safe but bad style and risky. The only time I ever use that construct is when I am working with Windows API where some structures are dual purpose and thus can not be defined as const when they are being used in a read-only context. (i.e. SetItem for tree views)
Now, you will need to invoke ReleaseBuffer in method B.
Here is an excellet talk about string classes.
http://www.codeproject.com/string/cppstringguide2.asp?target=getbuffer[^]
(Mike doesn't agree with me on the (LPCTSTR) construct for VERY good reasons. One cut and paste into a situation where the buffer is written to will crash the problem.)
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
Thank you, the link has been very useful...
|
|
|
|
|
For some reason I can't find/use the ATL Object Wizard in MSVC6. The button to use it is disabled and its not under my Insert menu. I have the folder and all the files for the Object Wizard (C:\Program Files\Microsoft Visual Studio\Common\MSDev98\Template\ATL) but I cannot use it. Should I reinstall or is there a way to turn it on?
Thanks for any help.
|
|
|
|
|
Is it possible to combine multiple images into one and create animated image?
|
|
|
|
|
Yes.
What is your goal, to create an animated gif ? or a movie type file (AVI, MPEG, MOV, ... )
Max.
Maximilien Lincourt
For success one must aquire one's self
|
|
|
|
|
Which ever creates smallest file!
Actually I want to create a slide show type image by combining 10 full screen size images.
Thanks for you help.
|
|
|
|
|
|
I trying to sort a date string inside a combo box by date. ie "3/07/03 8:42:27 PM" whenever a new date is added to the combo box. I was looking at the compareitem function. Any ideas on how to do this the easiest way.
Thanks
|
|
|
|
|
No. The data is arbitrary, so one solution is to design your own algorithm.
Kuphryn
|
|
|
|
|
Anthony9887 wrote:
I was looking at the compareitem function
That's what you need to do. Ensure that you set owner-draw for the combo box and then write your own CompareItem() method.
Chris Meech
"what makes CP different is the people and sense of community, things people will only discover if they join up and join in." Christian Graus Nov 14, 2002.
"AAAAAAAAAHHHHHH!!!!! Those leaks are driving me crazy! How does one finds a memory leak in a garbage collected environment ??! Daniel Turini Nov. 2, 2002.
|
|
|
|
|
Hi!
first thanks to everyone who answered me about the database problem!
But... still
I'm lost!!! I looked in the MSDN about DAO or ADO or ODBC and i don't know which of them to use for my Win32 application (NOT MFC)...
Please tell me the reason about using any of them!
and if it could possible to tell me how to initialize everything about the database(I mean what to include (*.h) or import (*.dll)) and then how to open the database just to write in it and read from it without having placed any ActiveX database control(just some text controls and buttons required for write in and read from the database) on the application.....
Thanks alot!!!
|
|
|
|
|
DAO used to be great with small databases like access, not good for transaction and somewhat slow. I would not use it if I had a choose
ODBC -
pro
Is great unified db access model, depending on the driver/database access it could be as fast as native API.
cons
Very difficult interface + Microsoft seems to consider it to be outdated
OLEDB - from my experience not much different from ODBC, except for having COM
interfaces. If you only have to work with MS SQL Server it is probably the way to go. It has some MTS/COM+ support and some XML support. Again Microsoft seems too indicate it is going to go away with ADO.NET.
ADO - COM wrapper around ODBC/OLEDB (depends on the version). It is a bit slow, but interface is very simple. MTS/COM+ automatic support. some XML support.
ADO.NET - Highly recommended(marketed) by Microsoft. It has extensive XML support. I do not completely understand what the big deal is , it seems the same as old ADO. If you do .Net it is the only choose.
|
|
|
|
|
Thank you but can you tell me how to do it in Win32 SDK (no MFC)
for example using ODBC or ADO!
|
|
|
|
|
Look in MSDN and Platform SDK - they have bunch of examles.
|
|
|
|
|
Thank you but can you tell me how to do it in Win32 SDK (no MFC)
for example using ODBC or ADO! (I want to load an mdb file)
|
|
|
|
|
Hi,
I would like to know why calling the function 'MySHEnumFolderContent( "c:\",SHCONTF_FOLDERS | SHCONTF_NONFOLDERS | SHCONTF_INCLUDEHIDDEN,NULL, 0 )' multiple times, the number of pages currently resident in memory (memory usage) always grows up (I used the Windows XP Task Manager to measure the memory usage)?
Thanks,
Ana
int MySHEnumFolderContent( LPSHELLFOLDER pFolderPai,
LPITEMIDLIST pItem,
DWORD dwFlags,
FOLDERCONTENTPROC pfn /*= NULL*/,
LPARAM lParam /*= 0*/,
LPITEMIDLIST* ppidl /*= NULL*/ )
{
int NumItens = -1;
LPSHELLFOLDER pFolder = NULL;
HRESULT hr = pFolderPai->BindToObject( pItem, 0,
IID_IShellFolder,(LPVOID *)&pFolder );
if ( SUCCEEDED( hr ) )
{
LPENUMIDLIST pEnumIDList = NULL;
hr = pFolder->EnumObjects( NULL, dwFlags, &pEnumIDList );
if ( SUCCEEDED( hr ) )
{
LPMALLOC pMalloc = NULL;
LPITEMIDLIST pidl = NULL;
SHGetMalloc( &pMalloc );
NumItens = 0;
while ( pEnumIDList->Next( 1, &pidl, NULL ) == S_OK )
{
if ( pfn != NULL && !pfn( pFolder, pidl, lParam ) )
{
// Returns the current PIDL
if ( ppidl != NULL )
*ppidl = pidl;
break;
}
NumItens++;
pMalloc->Free( pidl );
pidl = NULL;
}
pMalloc->Release();
pEnumIDList->Release();
}
pFolder->Release();
}
return ( NumItens );
}
/*---------------------------------------------------------------------------*/
int MySHEnumFolderContent( LPCTSTR pNomeFolder,
DWORD dwFlags,
FOLDERCONTENTPROC pfn /*= NULL*/,
LPARAM lParam /*= 0*/,
LPITEMIDLIST* ppidl /*= NULL*/ )
{
int NumItens = -1;
LPSHELLFOLDER pDesktopFolder = NULL;
// Get an IShellFolder interface pointer
HRESULT hr = SHGetDesktopFolder( &pDesktopFolder );
if ( SUCCEEDED( hr ) )
{
LPITEMIDLIST pItem = NULL;
hr = MySHPathToPIDL( pNomeFolder, &pItem, pDesktopFolder );
if ( SUCCEEDED( hr ) )
{
LPMALLOC pMalloc = NULL;
NumItens = MySHEnumFolderContent( pDesktopFolder, pItem, dwFlags, pfn, lParam, ppidl );
SHGetMalloc( &pMalloc );
pMalloc->Free( pItem );
pMalloc->Release();
}
pDesktopFolder->Release();
}
return ( NumItens );
}
/*----------------------------------------------------------------------------*/
HRESULT MySHPathToPIDL( CString szPath, LPITEMIDLIST *ppidl,
LPSHELLFOLDER pFolder /*= NULL*/ )
{
HRESULT hr;
LPSHELLFOLDER pShellFolder = NULL;
OLECHAR wszPath[ MAX_PATH ] = { 0 };
ULONG nCharsParsed = 0;
BOOL bFreeOnExit = FALSE;
// Use the desktop's IShellFolder by default
if ( pFolder == NULL )
{
hr = SHGetDesktopFolder( &pShellFolder );
if ( FAILED( hr ) )
return ( hr );
bFreeOnExit = TRUE;
}
else
pShellFolder = pFolder;
if( szPath.Right( 1 ) == ':' )
szPath += "\\";
// Convert the path name to Unicode
MultiByteToWideChar( CP_ACP, MB_PRECOMPOSED, szPath, -1, wszPath, MAX_PATH );
// Call ParseDisplayName() to do the job
hr = pShellFolder->ParseDisplayName( NULL, NULL, wszPath,
&nCharsParsed, ppidl, NULL );
// Clean up
if ( bFreeOnExit )
pShellFolder->Release();
return hr;
}
|
|
|
|
|
hi,
im unable to cast an integer into either a VARIANT or _variant_t. Does anyone know how i can place an integer into a variant variable? (i need to do this so that i can place a _variant_t into a new field - ADO style)
Does anyone know how to do this?
|
|
|
|