|
Try googling for xbase. IIRC it can handle FoxPro files also.
|
|
|
|
|
okay thanks chaps, but I really would like to code this myself have you any idea as to why my approach doesn't work ?
cheers
Pete Kane
|
|
|
|
|
pk_fox wrote:
but I really would like to code this myself
OK, you want to do it as an excercise. I got the impression you were looking for a solution to a problem.
I still think you should have a look at the xbase code since 1) IIRC it can handle FoxPro files and 2) since the source is available, and much documentation about these dBase derived formats is also included, you can from there figure it out yourself.
|
|
|
|
|
Hi,
I'm doing an application that first checks the OS installed in the machine where it is run. If the OS is Windows 2000, the porgram does a number of checks with iphlpapi, which do not work in Windows 9x. If the Os is Win9x, it displays some information.
The application has the following structure:
if (OS is Win2K)
{
... checks with iphlpapi
}
else
{
... displays some information
}
Now, the application fails in Win9x, and I don't understand why. The functions in the first part of the if are not executed, so why does it give an error?
The curious thing is that if do this:
if (OS is Win2K)
{
/*
... checks with iphlpapi
*/
}
else
{
... displays some information
}
(I comment all the first part of the if)
It DOES work in win9x, perfectly. So the part that is giving me an error is the part that si not even executed in Win9x. I don't get it!
Any ideas about this?
Thanks a lot.
F
|
|
|
|
|
Ouch.
Without much info, there is probably something in the commented out section that has a side effect, even though it never is executed. The side effect might be something like loading another DLL, and that somehow causes a problem with the Win9x processing.
Have you tried switching things around so that you test for OS is NOT Win2000, rather than OS IS Win2000? This doesn't cancel a side effect of loading a DLL, but it may indicate something else.
Just a few guesses, as you haven't given much to go on.
Dave
"You can say that again." -- Dept. of Redundancy Dept.
|
|
|
|
|
Not only you don't have to call the W2k-only functions, also you cannot link them: When the program uses some Win32 function, it is linking against a so called import .lib, which loads the corresponging DLL and arranges everything so that when the time comes to call the function, everything works. The problem with a W2k-only function is that the import library will try to load it even if the program never calls it!
You have two options:- Do the loading yourself, as in this example with
TryEnterCriticalSection :
BOOL (WINAPI * pTryEnterCriticalSection)(LPCRITICAL_SECTION lpCriticalSection);
HMODULE hKernel32;
void LoadW2kFunctions()
{
hKernel32=LoadLibrary("KERNEL32");
(FARPROC&)pTryEnterCriticalSection=GetProcAddress(hKernel32,"TryEnterCriticalSection");
}
...
if(OS is W2k){
LoadW2kFunctions
}
...
if(OS is W2k){
pTryEnterCriticalSection(...);
}
else{
...
} This is hard work, you'll probably find some problems along the way. - In VC++ 7.0, there's an option called delayed loading which loads DLLs the first time thery're used. If you have this compiler, this is surely the fastest way to get your problem solved.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Joaquín, aprecio tu respuesta. Estoy trabajando con VC++ 6, pero creo que puedo conseguir instalar la versión 7.
Te mantendré informado de mis progresos en este respecto.
Thanks a lot.
n
|
|
|
|
|
Se me ha ocurrido otra solución:
Do you think I could work wiht a try-catch block, do that if an error takes place I could detect it, and then I could detect that is the 'not supported by OS' problem and then do the information display I want to do on Win9x machineS?
Thanks for your advice.
n
|
|
|
|
|
Hello, I am getting syntax errors in this file upon compile but I can't figure out what is wrong. Can someone comment?
Thanks.
The errors are:
cinterface3.cpp(17) : error C2065: 'DWORD' : undeclared identifier
cinterface3.cpp(17) : error C2146: syntax error : missing ';' before identifier 'tid'
cinterface3.cpp(17) : error C2065: 'tid' : undeclared identifier
cinterface3.cpp(19) : error C2065: 'HANDLE' : undeclared identifier
cinterface3.cpp(19) : error C2146: syntax error : missing ';' before identifier 'hThread'
cinterface3.cpp(19) : error C2065: 'hThread' : undeclared identifier
cinterface3.cpp(21) : error C2065: 'CreateThread' : undeclared identifier
cinterface3.cpp(23) : error C2146: syntax error : missing ';' before identifier 'CloseHandle'
cinterface3.cpp(23) : error C2065: 'CloseHandle' : undeclared identifier
#include <stdio.h>
#include <string.h>
struct io {
char time[10];
int start;
};
struct io cio;
extern "C" __declspec(dllimport) void _stdcall FTREND3
( long * );
void main (void)
{
DWORD tid, cio;
HANDLE hThread;
hThread = CreateThread(NULL, 0, FTREND3, &cio, 0, &tid)
CloseHandle(hThread);
printf("In c after fortran thread started\n\n");
printf("string = %s\n",cio.time);
}
|
|
|
|
|
#include <windows.h>
is probably missing.
|
|
|
|
|
sorry... the special quote characters are not displayed on this website:
#include "windows.h"
is prbably missing
|
|
|
|
|
I am almost willing to bet that it is because you haven't specified /Mt or /Mtd, ( or whichever it is for your version of VC ), to enable multithreading. The Microsoft headers have a nifty ( not ) set of defines which undef the multithreading functions if the _MT define, ( which comes through the /M... compiler switches ), aren't set.
-=jarl=-
|
|
|
|
|
Thanks all.
The include windows.h cleaned up many errors.
|
|
|
|
|
Hy everybody!
I made an GUI Dll, and I found a problem...
- When I made my Dialog modeless, the default button doesn't work. It only works if the Dialog is Modal
Why?
cheers!
Ricky
|
|
|
|
|
I need to be able to keep all of the controls of a dialog ( for resize purpose )in a list/vector, ... ; so I use GetDlgItem with the controls ID to retrieve the CWnd of each control; but MSDN says that the pointer is temporary.
I don't want to keep a member variable for each control of the dialog; but this is working and might be a simpler solution.
Is there another way to do this ?
Max.
|
|
|
|
|
I think the pointer is temporary because controls can be created and destroyed dynamically. I think you will be fine to leave it the way that it is.
For safety, you may want to make the OnDestroy handler remove the point for that control from the parent dialog class.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
Declare an array to save all of controls ID like this:
<br />
int ControlIDArray[]=<br />
{<br />
IDC_BUTTON1,<br />
IDC_EDIT1,<br />
IDC_PROGRESS1<br />
};<br />
A. Riazi
|
|
|
|
|
Hello,
I need to use a template function, but I need that that template function be a class member...
Let's say that I've tried to do:
INSIDE THE HEADER FILE:
template<class T> void MyClass::MyFunction(T& Parameter);
-------------------------------------------------------------------
INSIDE THE IMPLEMENTATION FILE:
template<class T> void CMyClass::MyFunction(T& Parameter)
{
SomeOperations...
}
-------------------------------------------------------------------
HOW DO I CALL THE FUNCTION:
bool b = false;
MyFunction(b); The fact is that using this code I get a lot of errors (one in each MyFunction call) like:
...MyFile.cpp(119) : error C2893: Failed to specialize function template 'void __thiscall CMyclass::MyFunction(T &)'<br />
With the following template arguments:<br />
'bool'
The strange thing is that if I remove the declaration from the class (I've commented it out) and I call the function as a non class member, then it executes well...
I need to be able to call that function while that function would be a part of CMyClass.
Is this possible? and if it is possible, what do I'm doing wrong?
Thank you in advance.
NOTE:
Somebody has told me that this is a weakness of the VC++ compiler, but I continue searching because I need it, what do you believe?
|
|
|
|
|
Firstly, the declaration you have there is not correct. ( or is it just formatting which removes the < typename T > bit ? )
Anyways, ( assuming it is not ), to declare a template member function you have to do this;
in header:
<br />
template< typename T > <br />
void MyFunction( T& );<br />
...<br />
template< typename T ><br />
void MyClass::MyFunction( T & param )<br />
{<br />
...<br />
}<br />
The point is that you can't define a templated method outside of the header-file where it is declared. ( The compiler might not complain, even 7 doesn't, but the linker looses it... )
Secondly, this will only partly work if you have anything earlier than VC 7. VC 6 will do it, however it might fail silently on certain cases which can cause you grief later. ( In particular if you try to specialise the member templates )
-=jarl=-
|
|
|
|
|
Sorry, I've corrected the syntax... could you take other look at it?
|
|
|
|
|
...right, so reading, my reply again I realise that it might not be entirely clear....;P
What I was trying to say was;
Member function templates are poorly supported by VC 6
Member function templates are supported by VC 7, however...
Member function template specialisation is not, ( not properly, anyways ),
What you are trying to do, ( splitting template declaration and definition into
separate files ), is the subject of the mysterious export keyword, which for
numerous reasons has been deemed a red herring.
Unfortunately (?), the only solution is to keep the declaration and definition in the same header file.
If you want to make sure that the linker has a single instance of a template somewhere, ( and not rely on client code usage patterns ), you can instantiate it using the
template keyword on its own, like so;
in some cpp files somwhere...
<br />
template MyTemplatedClass<SomeType>;<br />
this will generate all the code for MyTemplatedClas<sometype> in the cpp file for the linker to use. HOWEVER....this doesn't work for template member functions, only for the whole class, ( or perhaps for free functions. )
So...'tis a bit messy...
-=jarl=-
|
|
|
|
|
aaaarghhh....i hate this... the < typename T > bit keeps getting lost in the wash....
oh well, we now know what we're both trying to say.
-=jarl=-
|
|
|
|
|
Try this approach:
class CMyClass
{
public:
template<class T> void MyFunction(T& Parameter)
{
}
}; Although you can legally move the definition of MyFunction outside the body of CMyClass declaration, VC++ 6.0 crashes at it, so this is your only option (don't know about VC++ 7.0).
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Sorry, I've corrected the syntax... could you take other look at it?
|
|
|
|
|
Right,
this has worked well.
Thank you very much.
|
|
|
|