|
Igor Vigdorchik wrote:
Services have no front end.
Yeap service don't have any FrontEnd, but you can have both Windows and front end for service....( clue: desktop interactice service)
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
|
is there a way to get the handle of aprocess without calling openprocess if i have the pid ?
gabby
|
|
|
|
|
euacela wrote:
openprocess if i have the pid ?
AFAIK, NO!
"Opinions are neither right nor wrong. I cannot change your opinion. I can, however, change what influences your opinion." - David Crow
cheers,
Alok Gupta
VC Forum Q&A :- I/ IV
|
|
|
|
|
Definitely, no.
Definitely, yes - if you can access information on the Kernel internal structures. But even if so, your app may not work on different Windows versions.
One always gets the deserved.
http://www.silveragesoftware.com/hffr.html Update your source code with my tool HandyFile Find And Replace!
|
|
|
|
|
Even if he had kernel access he couldn't!
The kernel does not use handles for the process. It uses pointers to EPROCESS structures!
Don't try it, just do it!
|
|
|
|
|
I know that I can make a driver and use deviceiocontrol and get the handle out but just tell me the function.
The EPROCESS structure doesn't have a member for the handle.
I know about this function
NTSYSAPI
NTSTATUS
NTAPI
PsLookupProcessByProcessId (
IN ULONG ProcessId,
OUT PEPROCESS *Process
);
and this is all I know about eprocess
typedef struct _EPROCESS {
KPROCESS Pcb;
EX_PUSH_LOCK ProcessLock;
...
UCHAR ImageFileName[16];
...
UCHAR PriorityClass;
BOOLEAN WorkingSetAcquiredUnsafe;
} EPROCESS, *PEPROCESS;
is KPROCESS the process HANDLE and if it is what ACCESS does it have, i supose PROCESS_ALL_ACCESS right ??/
gabby
|
|
|
|
|
i wonder how can I get an IMAGE_FUNCTION_ENTRY of a certain function in a dll
is it
IMAGE_FUNCTION_ENTRY *IFE=(IMAGE_FUNCTION_ENTRY *)((BYTE *)hMod+FunctionAddress) ????
this returns a non NULL value but I am not sure if it is a valid structure
gabby
|
|
|
|
|
|
It is definitly not.
The code you are using may not even create a pointer to valid memory.
Read the "SymFunctionTableAccess64" page in MSDN and you will see that IMAGE_FUNCTION_ENTRY is not used on x86 (Intel + AMD) platforms.
Don't try it, just do it!
|
|
|
|
|
I'm trying to teach myself C++. I making a real simple calculator (console app) from an exercise in a book. It needs to display, "Press any key to continue".
I declared a variable chKey, but when I hit enter the cursor just keeps moving down the command prompt.
cout << "PRESS ANY KEY TO CONTINUE\n\n";
cin >> chKey;
Is there anything I need to do to "continue"? The book is no help.
Thanks
|
|
|
|
|
Try this instead:
cout << "PRESS ANY KEY TO CONTINUE" << endl << endl;
getch();
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
How do you clear the console screen?
THanks
|
|
|
|
|
See MSDN article Q99261.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
|
system("cls");
or use
-------
void clrscr(TCHAR FillChar)
{
COORD coordScreen = { 0, 0 };
DWORD cCharsWritten;
CONSOLE_SCREEN_BUFFER_INFO csbi;
DWORD dwConSize;
HANDLE hConsole = GetStdHandle(STD_OUTPUT_HANDLE);
GetConsoleScreenBufferInfo(hConsole, &csbi);
dwConSize = csbi.dwSize.X * csbi.dwSize.Y;
FillConsoleOutputCharacter(hConsole, FillChar, dwConSize, coordScreen, &cCharsWritten);
GetConsoleScreenBufferInfo(hConsole, &csbi);
FillConsoleOutputAttribute(hConsole, csbi.wAttributes, dwConSize, coordScreen, &cCharsWritten);
SetConsoleCursorPosition(hConsole, coordScreen);
return;
}
-------
and maybe you will need gotoxy too ( X-D )
-------
void gotoxy(int x, int y)
{
COORD pos;
pos.X = x-1; pos.Y = y-1;
SetConsoleCursorPosition(GetStdHandle( STD_OUTPUT_HANDLE ), pos);
}
|
|
|
|
|
That only seems to clear the screen if I hit enter. Any key would work. Please help.
|
|
|
|
|
I often use the function Shellexecute to run for example gzip.exe to compress files. How can I stop the execution of my program to wait for the “gzip-process” to return?
May I use any other function to accomplish my task?
_____________________________
...and justice for all
APe
|
|
|
|
|
Use WaitForSingleObject() .
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
DWORD ExitCode;
STARTUPINFO si;
ZeroMemory(&si,sizeof(STARTUPINFO));
si.cb = sizeof(STARTUPINFO);
PROCESS_INFORMATION pi;
if(!CreateProcessA(0, "notepad.exe", NULL, NULL, FALSE, NORMAL_PRIORITY_CLASS, NULL, 0, &si, &pi))
{
printf("CreateProcess false\n");
return -1;
}
WaitForSingleObject(pi.hProcess, INFINITE);
GetExitCodeProcess(pi.hProcess, &ExitCode);
CloseHandle(pi.hThread);
CloseHandle(pi.hProcess);
if (ExitCode == 0)
{
// ...
}
....
|
|
|
|
|
Anyone know of a program / class / piece of code that will take an irregularly spaced set of (x,y,z) data and transform to regularly spaced contours?
cheers,
Chris Maunder
|
|
|
|
|
Sound like the problem faced in Boundary Element Method.
...
|
|
|
|
|
GTS - GNU Triangulated Surface Library:
http://gts.sourceforge.net/index.html[^]
which won't create the contours, but will generate the delaunay triangulation.
From there you could write a routine to find all triangles spanning a given elevation, interpolate along their edges to get x,y coord and generate the contours.
GMT should be able to do what you want:
http://gmt.soest.hawaii.edu/[^]
... although it is a bit of overkill.
It's a bit of pain to get through the website, as a short-cut:
- goto ftp://falcon.grdl.noaa.gov/pub/gmt/4/[^]
- download GMT_progs.zip
- to start with look at xyz2grd.c and grdcontour.c
...cmk
Save the whales - collect the whole set
|
|
|
|
|
here is my code:
---------------------------------------------
RECT rect;
GetWindowRect(hWnd, & rect);
HDC hDC = GetDC(hWnd);
HDC hDCMem = CreateCompatibleDC(hDC);
HBITMAP hBmp = NULL;
hBmp = CreateCompatibleBitmap(hDC, rect.right - rect.left, rect.bottom - rect.top);
HGDIOBJ hOld = SelectObject(hDCMem, hBmp);
SendMessage(hWnd, WM_PRINT, (WPARAM) hDCMem, PRF_CHILDREN | PRF_CLIENT | PRF_ERASEBKGND | PRF_NONCLIENT | PRF_OWNED);
SelectObject(hDCMem, hOld);
OpenClipboard(NULL);
EmptyClipboard();
SetClipboardData(CF_BITMAP, hBmp);
CloseClipboard();
DeleteDC(hDCMem);
ReleaseDC(hWnd,hDC);
---------------------------------------------
if hWnd holds the handle of the window of the same program in which i place this code then it works fine. but if i store another program's window's handle in it then it gives me black image. the size of the image is according to the window whose handle was given but the image is totally black. i get the handle of other windows through the FindWindow fucntion.
can anybody tell me where did i go wrong?
|
|
|
|
|
im not sure i think window must be visible on screen ... try test with HWND hWnd = GetForegroundWindow();
|
|
|
|