Not sure why you want to do all this by spawning child processes. Why don't you make the program multi-threaded and do what you require on different threads?
You can get each thread to write a number to a 'queue' (STL will give you the code needed) and the main thread can then loop and read...
I don't think it's a problem with the typedef definition - it would give a different error.
The error message means that GetProcAddress cannot find the function name you're passing in - check the dll's exported functions to ensure you've got the right function name.
Same applies for any dynamically allocated multi-dimensional array. So for a 1000*1000 char array:-
char (*something)[1000];
something = new char[1000][1000];
something[34][24] = 'z';
printf("Output: %c\n\n", something[34][24]);
delete [] something;
To allocate dynamically use the following syntax for a float array of 1000 by 1000:-
float (*something)[1000];
something = new float[1000][1000];
something[34][24] = 0.9f;
printf("Output: %f\n\n", something[34][24]);
delete [] something; // for completeness
I tried out your code (as a console application) and it worked for both cases.
I'm guessing that the problem lies with the fact that you are blowing the 'stack'. Each 'float' takes 4 bytes of stack so 1000*1000*4 = 4,000,000 bytes and 'default' stack size is only 1MB.
You can increase the...
Don't know of a way of doing this (RunDll32 will not work with the Win32 APIs).
However, it's extremely easy to write a simple EXE which does exactly what you want and returns the appropriate value to you cmd/bat file.
The best way is to get the thread you wish to 'kill' to exit. You can do this by either posting a message to the thread (assuming you've got a message loop in the thread) or by using an event/semaphore to indicate to the thread that it can die.
The other way is to call TerminateThread on the...
When you instantiate the object are you checking that it's worked? E_POINTER errors can be caused by calling methods on a non-instantiated object.
Temps
Probably 'stub' program is a bit unclear - we tend to use the term for a program who's only intention in life is to launch another program.
Not really sure what your requirement is having seen some of the discussions in this thread. However, if you want the 'background' program to be available...
Not actually a VC++ issue.
There are several ways of doing this programmatically:-
1) Write a 'stub' executable which does a CreateProcess on the actual program you want as a background process. CreateProcess lets you set the 'priority' you want the new process to run at.
2) Call...
COM 'abstracts' object implementation details thus enabling a program to not have to worry, or make assumptions, about how (or where) an object is implemented - could be a DLL, EXE or remote machine; it shouldn't matter.
However, when requesting an object to be instantiated you can insist you...
Matt,
If you want to pass a pointer to a member function of a class, the member function must be declared as 'static' (the problem is that there is a hidden 'this' pointer for every non-static member function).
Within the header file declare
public:
static DWORD WINAPI...
When you declare a static member variable in a class, you also have to allocate storage for it as follows:
class Foo
{
private:
static int i;
};
int Foo::i;
The fact that you haven't allocated storage will give the 'Unresolved External' error.
Temps
The SetState and GetState methods need to be 'public' as they will be called by instances of the class - if they were 'private' they would only be callable within the actual class code itself.
The data behind the SetState and GetState methods can either be different for each instance of the...
Typically, you can use the API 'CreateProcess' to start another application and pass parameters to it.
If it doesn't accept parameters on the command line, you could try sending the appropriate keystrokes to the application.
Temps
Assuming cFname and cLname are declared as char *, this should work:-
BankAccount::BankAccount()
{
cFname = new char[ARY];
cLname = new char[ARY];
iIDNumber = 0;
}
BankAccount::~BankAccount()
{
delete [] cFname;
delete [] cLname;
}
Regards,
Temps
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.