|
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();
|
|
|
|
|
use:
-------------------------------
HDC hdc;
RECT rect;
HWND hWnd = GetForegroundWindow();
hdc = GetWindowDC(hWnd);
GetClientRect(hWnd, &rect);
HDC hDest = CreateCompatibleDC(hdc);
HBITMAP hbDesktop = CreateCompatibleBitmap(hdc, rect.right - rect.left, rect.bottom - rect.top);
SelectObject(hDest, hbDesktop);
BitBlt(hDest, 0,0, rect.right - rect.left, rect.bottom - rect.top, hdc, 0, 0, SRCCOPY);
OpenClipboard(NULL);
EmptyClipboard();
SetClipboardData(CF_BITMAP, hbDesktop);
CloseClipboard();
DeleteDC(hDest);
ReleaseDC(hWnd,hdc);
-------------------------------
|
|
|
|
|
BitBlt requires that your window is not minmized and not even covered. I don't want this. I want to do it with SendMessage. Even if I first get the window to foreground and then capture its image, i get a black one. (if the handle was of another program's window)
|
|
|
|
|
Hello,
I want to know how I can convert ASCII strings into their Hex Values. For example:
A = 41
K = 4B
I'm programming with Dev-C++ if this is any help.
With best regards,
Benedikt
|
|
|
|
|
use:
char* mystring = "Hello world!";
for (int x = 0; x < strlen(mystring); x++)
{
printf("%x ", mystring[x]);
}
|
|
|
|
|
Thank you !
And how can I convert hex back to ascii ?
With best regards,
RedDragon2kx
|
|
|
|
|
lol its little harded but ok use this:
--------------
BYTE StringHexToByte(LPCSTR HexString)
{
BYTE hi;
BYTE lo;
hi = 0;
lo = 0;
if ((HexString[0] - 0x30)<10)
{
hi = HexString[0] - 0x30;
}
else {
switch (toupper(HexString[0])) {
case 'A':
hi = 0x0a;
break;
case 'B':
hi = 0x0b;
break;
case 'C':
hi = 0x0c;
break;
case 'D':
hi = 0x0d;
break;
case 'E':
hi = 0x0e;
break;
case 'F':
hi = 0x0f;
break;
}
}
if ((HexString[1] - 0x30)<10) {
lo = HexString[1] - 0x30;
}
else {
switch (toupper(HexString[1])) {
case 'A':
lo = 0x0a;
break;
case 'B':
lo = 0x0b;
break;
case 'C':
lo = 0x0c;
break;
case 'D':
lo = 0x0d;
break;
case 'E':
lo = 0x0e;
break;
case 'F':
lo = 0x0f;
break;
}
}
return (hi << 4) | lo;
}
static void StringHexToArray(IN LPCSTR HexString, OUT PBYTE Array)
{
UINT i = 0;
while (i < strlen(HexString))
{
*Array++ = StringHexToByte(&HexString[i]);
i += 3;
}
}
---------------
call as
BYTE* lpData = (PBYTE)malloc(1024);
ZeroMemory(lpData, 1024);
StringHexToArray(SourceString, lpData);
free(lpData);
|
|
|
|
|
Have you tried strtol() to change from one representation to another?
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|
|
yes but how can I get that value in a variable the one that is printed ??
gabby
|
|
|
|
|
Are you wanting to know how to represent a value in base-16 rather than base-10? For example, the values:
65 (base 10)
41 (base 16)
1000001 (base 2)
are all the same but in a different base. Therefore, the concept of converting from one base to the other does not exist. You can represent a value in a different base, however. Hunter has provided an example of that.
"One must learn from the bite of the fire to leave it alone." - Native American Proverb
|
|
|
|