winapi

C++ cursor changes to hour glass using WM_SETCURSOR

OK i have a game when person loses ill set a different cursor. i used the setcursro with loadcusor and WM_SETCURSOR. the problem is that my default cursor which i hae set it where i register my window, it changes to hour glass until the person loses than it changes to the cursor i have set it to. i found that when i use the WM_SETCURSOR ...

c++ set cursor size over 32

im trying to set a cursor. the width and the height of the cursor is bigger than 32 px. but it just scale it down to 32px when i set it. any idea? ...

win32 C api call for disabling a network adapter?

Ive been all over looking for a way to disable the network adapter through M$ IP Helper routines. For the majority of the code I've been using this api: http://msdn.microsoft.com/en-us/library/aa366071(v=VS.85).aspx However, I do not see a way to actually disable the adapters .. If deleting the IP address associated with the adapter di...

c++ using too much cpu

ok im creating a game but it uses too much cpu but it doesn't uses too much memory. the cpu does increase and decrease. i have too many timers in my game, i kill the timer when i don't use it any more so that should cause a problem but what i think that causes the problem is there is too many messages in my message qeue. i have new lapt...

c++ repaint part of window

i know how to repaint the full window but i don't know how to repaint a pieace of window like i draw a squre using gdi+ than i want to change it's coordinates so i want to repaint the squre not the whole window anyidea? i also tried this RECT rect2; rect2.left=0; rect2.top=100; rect2.right=225; rect2.bottom=300; InvadiateRect(hwnd, &...

visual c++ 2010 debugging problem

When I debug the my game, it works. But if I open my game's exe file that is stored in my project debug file, it shows as being 3 days old. The file is not getting updated. Any ideas why? ...

c++ high cpu usage

Possible Duplicate: c++ using too much cpu my game uses over 50% of cpu. i found way to reduce the cpu to be 40-50% but i can't find any other way to reduce it. i tried to use Code analyst profiler but it doesn't give me any good information in my code where im using my cpu. here is my code // Xstrike.cpp : Defines the entr...

C#: Hiding a console window ?

Question: I have a console program that shouldn't be seen. (It resets IIS and deletes temp files.) Right now I can manage to hide the window right after start like this: static void Main(string[] args) { var currentProcess = System.Diagnostics.Process.GetCurrentProcess(); Console.WriteLine(currentProcess.MainWindowTitle); ...

Broadcasting message to multiple processes (Point-to-Point Message Queue with multiple readers)

I want to share a data with multiple processes. My first attempt is to use Point to point message queue with multiple readers since I read that P2P Msg Queue is very fast. During my test, it seems like multiple readers are reading from the same queue and once a message is fetched by one reader, other readers will not be able to fetch th...

returning std::string/std::list from dll...

Short question. I just got a dll I'm supposed to interface with. Dll uses crt from msvcr90D.dll (notice D), and returns std::strings, std::lists, and boost::shared_ptr. Operator new/delete is not overloaded anywhere. I assume crt mixup (msvcr90.dll in release build, or if one of components is rebuilt with newer crt, etc) is bound to ca...

Win32: Displaying a Stock Icon in a Dialog Box under High DPI

Hi, I've got a dialog box where I need to display the standard Information icon. Here's my RC code: ICON "",IDC_ICON_INFORMATION,18,70,21,20 I process the WM_INITDIALOG message as follows: HICON aIcn = LoadIcon(NULL, IDI_INFORMATION); SendDlgItemMessage(m_hWnd, IDC_ICON_INFORMATION, STM_SETICON, (WPARAM) aIcn, 0); Everything wo...

impersonation via token stored in a cookie

I want to know more about win32 LogonUser api function. The last parameter is a token which can be used to impersonate a windows identity to execute code on a person's behalf. Say I have a login page where I enter my username, password and domain. When the user submits the page I validate the user by making a call to LogonUser() and get ...

GPRS connection watchdog

Hello all, I'd like to make my WM-based device reconnect to GPRS network, if connection has been broken. There is a function in WinAPI HRESULT WINAPI ConnMgrConnectionStatus( HANDLE hConnection, DWORD *pdwStatus ); but it requires previous connection handle, and in my case it can be established manually. Is there a way to g...

Which use of AdjustTokenPrivileges in KB131065 is correct?

KB131065 demonstrates how to activate SeDebugPrivilege to open a handle to any process. It has a function named SetPrivilege that calls AdjustTokenPrivileges, but there are two implementations and no mention why. The first implementation calls ATP in two passes: // // first pass. get current privilege setting // tp.PrivilegeCount ...

Questions regarding "warning C4312: 'type cast'"

This is the code I have: HWND WebformCreate(HWND hParent, UINT id) { return CreateWindowEx(0, WEBFORM_CLASS, _T("about:blank"), WS_CHILD | WS_CLIPSIBLINGS | WS_VISIBLE, 0, 0, 100, 100, hParent, (HMENU)id, GetModuleHandle(NULL), 0); } This is the warning I get: warning C4312: 'type cast' : conversion from 'UINT' to...

RegOpenKeyEx returns 1

I can't catch this problem on my own comp, but "test users" keep informing about this. What is it? (HKEY_CURRENT_USER, handle is got by RegOpenCurrentUser) 1 = ERROR_INVALID_FUNCTION ...

Group boxes and WS_CLIPCHILDREN

Group boxes don't render properly if the parent window has the WS_CLIPCHILDREN style set. My current workaround is to simply remove the flag from the parent. However this results in extreme flickering when resizing the window. Is there a better workaround possible? Update The Dr Dobbs article Resizable Dialogs Revisited address exactl...

What causes CreateDirectory to return ERROR_ACCESS_DENIED?

In another question, we established that yes, CreateDirectory occasionally fails with the undocumented GetLastError value of ERROR_ACCESS_DENIED, and that the right way to handle the situation is probably to try again a few times. It's easy to implement such an algorithm, but it's not so easy to test it when you don't know how to reprodu...

Can named pipe names have backslashes?

According to MSDN, [The pipe name] must have the following form: \\.\pipe\pipename The pipename part of the name can include any character other than a backslash, including numbers and special characters. The entire pipe name string can be up to 256 characters long. Pipe names are not case sensitive. But the...

Find out if thread is awaiting for input (not output)

Greetings everyone. I'm capturing an output from a process created using CreateProcess() through the redirected named pipes for stdout and stderr. I also send an input to the redirected stdin. Everything goes fine except one big annoying thing. Sometimes it's unknown what data needs to be written in stdin and I present a simple dialog ...