How much memory or other resources is used for an individual VirtualAlloc (xxxx, yyy, MEM_RESERVE, zzz)?
Is there any difference in resource consumption (e.g. kernel paged/nonpaged pool) when I allocated one large block, like this:
VirtualAlloc( xxxx, 1024*1024, MEM_RESERVE, PAGE_READWRITE )
or multiple smaller blocks, like this:
Vi...
LARGE_INTEGER lpPerformanceCount, lpFrequency;
QueryPerformanceCounter(&lpPerformanceCount);
QueryPerformanceFrequency(&lpFrequency);
(Count.QuadPart is a long long showing a CPU count)
(Freq.QuadPart is a long long showing frequency of Count for a second)
Attempting to print microseconds in real time.
stable output:
printf("%llu\...
I wanted to get both icon and text, so I didn't set BM_ICON on my button. In
WM_INITDIALOG (yes, the button is in a dialog) I say:
SendDlgItemMessage(hwndDlg, IDC_CREATE, BM_SETIMAGE, IMAGE_ICON, reinterpret_cast<LPARAM>(create_image));
It doesn't work. The button shows text only. Now, if I do set the BS_ICON
style, it works, but ther...
The socket is created and bound, then the program receives data with recv(). The question is: How do I now determine from which host + port the packet originates so that I can send data back?
Note: C and Winsock is used.
...
Hi all!
I am using Delphi 2010 and my program wants to get the system's temp path. I am using TPath.GetTempPath and everything is working fine... at least for me and my coworkers. But on some customer machines this method returns a cropped path which is (of course) not existing. I found out that the problem seems to be the result from u...
Is there a difference or is it as simple as #define WC_BUTTON "BUTTON"? Also, if I use InitCommonControlsEx in place of InitCommonControls, do I still need to include a manifest?
...
So basically, I have a Tab Control (WC_TABCONTROL) and I want to place all of the controls that go with a single tab page on a single window (control, if you will, or panel). I want to create something like the panel in wxWidgets, so that when I call ShowWindow(panel, SW_HIDE), I can hide the panel and all controls inside it. I hope you ...
Hello,
I've been reading Windows System Programming (4th Edition) - 2010 for couple of months. I've finished it. I've referred to Windows Internals (5th Edition) when required.
Now, I'm ready to do some solid real world project using purely Windows API. Kindly suggest a real world moderate sized project (which can involve processes, th...
The program runs fine for a few minutes and then ReadFile starts failing with error code ERROR_WORKING_SET_QUOTA.
I'm using ReadFile with overlapped I/O like so:
while (continueReading)
{
BOOL bSuccess = ReadFile(deviceHandle, pReadBuf, length,
&bytesRead, readOverlappedPtr);
waitVal = WaitForMulti...
What is a really good Windows, C++, UI library, framework, or tool that will allow me to very simply and easily add a slick look & feel to my native C++ win32 application?
Also;
Slick means skinnable with window background images, fancy buttons, shadows, all that jazz.
This is non-MFC
Supporting Windows XP and beyond
Royalty free lice...
For one of our desktop applications we use a HTML-based interface, loaded from local files into a WebBrowser control.
This works fine, but now we want to load the files from a different source, and are trying to stream them in using IPersistStreamInit (like this example on MSDN). It seems to work OK, except for the referenced javascrip...
Have a 1MB pipe:
if (0 == CreatePipe(&hRead,&hWrite,0,1024*1024))
{
printf("CreatePipe failed\n");
return success;
}
Sending 4000 bytes at a time (bytesReq = 4000)
while ((bytesReq = (FileSize - offset)) != 0)
{
//Send data to Decoder.cpp thread, converting to human readable CSV
if ( (0 == WriteFile(hWrite,
...
We have an Windows32 application in which one thread can stop another to inspect its
state [PC, etc.], by doing SuspendThread/GetThreadContext/ResumeThread.
if (SuspendThread((HANDLE)hComputeThread[threadId])<0) // freeze thread
ThreadOperationFault("SuspendThread","InterruptGranule");
CONTEXT Context, *pContext;
Context.ContextFla...
Have a 1MB pipe:
if (0 == CreatePipe(&hRead,&hWrite,0,1024*1024))
{
printf("CreatePipe failed\n");
return success;
}
Sending 4000 bytes at a time (bytesReq = 4000)
while ((bytesReq = (FileSize - offset)) != 0)
{
//Send data to Decoder.cpp thread, converting to human readable CSV
if ( (0 == WriteFile(hWrite,
...
im trying to create ball animation using gdi but i can't get it working.
i created a ball using this
Graphics graphics(hdc);
Pen pen(Color(255, 0, 0, 255));
graphics.DrawEllipse(&pen, sf , 0, 10, 10);
i have while loop that loops and adds 1 to sf value basicly like this sf++;
than i try to repaint the window(it doesn't work...
Hello,
I want an option to convert a string to wide string with two different behaviors:
Ignore illegal characters
Abort conversion if illegal character occurs:
On Windows XP I could do this:
bool ignore_illegal; // input
DWORD flags = ignore_illegal ? 0 : MB_ERR_INVALID_CHARS;
SetLastError(0);
int res = MultiByteToWideChar(CP_U...
The documentation for TB_GETBUTTONTEXT says that the handler has to return the number of characters and optionally (if lParam is not null) copy the string into the supplied buffer.
The caveat is that the length doesn't include the terminating character. I see the following problem. Say the handler stores the string precomputed (so its l...
Hello, I need somehow to determine whether some TDateTime value is within the Daylight Saving Time range for my timezone or not (in C# the same thing does the DateTime.IsDaylightSavingTime() method).
I know in Delphi there's no similar function, because Delphi TDateTime contains no information about timezone, but I suppose there's some ...
HWND hEdit = CreateWindowEx(WS_EX_CLIENTEDGE, "EDIT", "", WS_CHILD | WS_VISIBLE | WS_VSCROLL | WS_HSCROLL | ES_READONLY | ES_MULTILINE | ES_AUTOVSCROLL | ES_AUTOHSCROLL, 0, 0, width, height, hWnd, (HMENU)IDC_MAINEDIT, GetModuleHandle(NULL), NULL);
Well, that's how I create an (readonly) edit (textbox) control.
How can I create a RichEd...
I'm writing an NSIS installer for a project that requires the PyOpenGL package, however installation of this package fails because my system doesn't contain mscvr71.dll (VS C runtime lib). According to KB326922, this library should have been packaged with PyOpenGL.
My question is, what is the safest way to correct this so I can install ...