|
|
|
why a static member function has no this pointer?
KIRAN PINJARLA
|
|
|
|
|
Because is a class method rather than a instance method .
The concept is quite similar to static variable of classes (but the latter is, IMHO, more immediate): if you declare
class A
{
public:
static int iShrd;
};
then iShrd is a class variable , i.e. is variable shared among all the instance of class A (strictly speaking, you don't even need an instance of the class to access the var, you can use A::iShrd to the pourpuse). As stated before, to understand static functions you can take a similar point of view.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
|
|
|
|
|
Hi Kiran,
The calls to a non-static member function gets expended by the compiler and it passes the pointer to the "instance" as an extra parameter named "this".
In case of static member function, the instance is not available and hence compiler does not make any modification for these functions to accomodate "this".
Manoj
Never Give up
|
|
|
|
|
I am trying to run a 16-bit application by calling the CreateProcess function. I have played with all sorts of parameters' combinations but it keeps failing.
When I call:
STARTUPINFO si;
ZeroMemory(&si, sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
si.dwFlags = STARTF_USESHOWWINDOW;
si.wShowWindow = SW_SHOWNORMAL;
PROCESS_INFORMATION pix;
BOOL b = CreateProcess(_T("d:\\path\\app.exe"),
NULL, NULL, NULL,
FALSE, 0 , NULL, NULL,
&si, &pix);
DWORD dw = GetLastError(); the dw value will be 2 (ERROR_FILE_NOT_FOUND, which is not the case).
Do you know the workaround?
|
|
|
|
|
Bogdan Rechi wrote: Do you know the workaround?
There is no workaround, CreateProcess functions correctly.
led mike
|
|
|
|
|
led mike wrote: CreateProcess functions correctly
Define "correctly"...
|
|
|
|
|
|
|
Isn't that an endless loop?
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Obviously, CreateProcess is an impecably written API function. I was not going to quarrel on this issue at all
Thank you for the advice. Unfortunately, where I am right now, it is not possible to do the test. I remember that I did it earlyer today with little success but I will double-check it on Monday, just in case.
|
|
|
|
|
Bogdan Rechi wrote: Obviously, CreateProcess is an impecably written API function
I hope so....I rely on it.
No argument here, just trying to provide a possible solution to something I can't reproduce
here
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Bogdan Rechi wrote: ERROR_FILE_NOT_FOUND, which is not the case
Are you absolutely sure the pathname is specified correctly?
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Positive. I can copy-paste it and run it from the console.
It's the Pascal-FC compiler (http://www-users.cs.york.ac.uk/~burns/pf.html[^]) for Windows 2000 (and newer). A small tool for solving theoretical multithreading problems I am trying to build a GUI for...
|
|
|
|
|
Then you need to do this:
BOOL b = CreateProcess(NULL, _T("d:\\path\\app.exe"), NULL, NULL,FALSE, 0 /*CREATE_SEPARATE_WOW_VDM*/, NULL, NULL,&si, &pix);
"If the executable module is a 16-bit application, lpApplicationName should be NULL, and the
string pointed to by lpCommandLine should specify the executable module as well as its arguments."
Make sure you quote the pathname if there's any spaces in it.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Bogdan Rechi wrote: BOOL b = CreateProcess(_T("d:\\path\\app.exe"),
Is the path correct?
Bogdan Rechi wrote: Do you know the workaround?
There's nothing wrong with the code snippet you've provided.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I've just run the same code on an old Win' 98 system and, indeed, it works perfectly.
It seems that it only fails under the Win' XP...
|
|
|
|
|
Using CreateProcess as documented[^] for 16-bit applications didn't help any?
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
From the documentation on the lpApplicationName parameter (the first one):If the executable module is a 16-bit application, lpApplicationName should be NULL, and the string pointed to by lpCommandLine should specify the executable module as well as its arguments.
|
|
|
|
|
Ok, thank you. I will change the code as it is required.
|
|
|
|
|
my precedure would like to open a file which in another computer, but the computer has password, how to deal with that?
|
|
|
|
|
Knowing the login and password?
Is usual that net-resources have password, if not...
Greetings.
--------
M.D.V.
If something has a solution... Why do we have to worry about?. If it has no solution... For what reason do we have to worry about?
|
|
|
|
|
I made a simple program which when you press the up key shows up, left key shows left etc.
But how can i make it work with two keys at once? Like up and right (which would then display up and right..)
Is there some not too hard way to do this?
thanks all!
(MS Visual studio 6, program is a windows console application with mfc)
//Johannes
|
|
|
|
|
AFAIK, you will get one event when a key is pressed and another event when the key is released.
Get those events and keep track of what key(s) are currently pressed.
Alcohol. The cause of, and the solution to, all of life's problems - Homer Simpson
|
|
|
|