winapi

Upgradeable read/write lock Win32

I am in search of an upgradeable read write lock for win32 with the behaviour of pthreads rwlock, where a read lock can be up- and downgraded. What I want: pthread_rwlock_rdlock( &lock ); ...read... if( some condition ) { pthread_rwlock_wrlock( &lock ); ...write... pthread_rwlock_unlock( &lock ); } ...read... pthread_rwlock...

GetTokenInformation in Visual Basic 6

Hello, I am using GetTokenInformation as a part of the code that determines if the current thread is running as an Administrator. Anyway, I have a structure for TOKEN INFORMATION that looks like this: Private Type TOKEN_GROUPS GroupCount As Long Groups(500) As SID_AND_ATTRIBUTES End Type Then, I invoke GetTokenInformation like...

Any particular services that has to run ? (win32_networkadapterconfiguration)

Hi. I'm having problems with a script that changes the TCP/IP settings of my NICs. The script works as it should on most PCs, but on some it don't. I can't figure why it wont work because both the working systems and the non working systems have .NET 3.5 SP1 installed... The weird thing is that I have no problems getting the current TCP...

Why GetPixel() is so slow using Ruby (or probably Perl or Python too) and how to do it by other methods?

I tried using Win32's GetPixel() with Ruby and it is really slow even on a Quad Core Intel machine. I think for example, if I get a really small region such as 100 x 10 pixels = 1000 pixels and it can take 30 seconds to complete. Is there a better way such as by getting a region all at once? ...

open process as different user

hi all I want to get the privileges of a selected user on a local machine. I know how to get them from the current user, so my problem is how to open a process as as a different user. I'm currently looking for more info about CreateProcessAsUser() thanks ...

Getting user input from Win32 C++. WPARAM casted as int?

I'm working on a pre-existing codebase and I'm looking to have the user type any 1-2 digits followed by the enter key at any time during the code being run and pass that number to a function. Currently, user input is handled like so: LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { int wmId, wmEvent...

Random bytes with fread

#post The names of my variables are not imporant! This code will be deleted when it works! #post Alright, so I'm using fread in stdio.h to read a text file. The problem is that I keep reading random bytes that don't exist in the text file from my knowledge. I'm assuming they are part of files scheme, but I just wanna make sure it's no...

Mailslot with string

Hi, I need to make a message concating various parts. So I used ostringstream. Now I have a std::string or a const * char to send by mailslot. I have tryed many ways to do it but every time I receive wrong messages. I would like to know a solution to send messages by mailslot and receive it and show it by console. My code to generate an...

Finding the command line options a process was launched with.

I'm trying to find out how to do this, I'm currently using CreateToolHelp32SnapShot to get a list of the running processes and I've got the FilePaths of the executables which are currently running, but I need to be able to find out what command line options were used to start the process. I know its possible since you can see it on Proc...

How can I send input to Visual Studio using Windows API

Hello, I am trying to develop a util (using system-hook) for that works like an expander (user selects some text and presses a hotkey and it is expands). It should work with Visual Studio. I want to implement this using Windows API because I want to develop an app that works globally with any application (whether you're using VS, or wo...

IContextMenu3 HandleMenuMsg2 is never called

Hi, I'm trying to implement a shell extension that extends IContextMenu3 and IShellExtInit, and i'm inserting menu items using the method described in section "HBMMENU_CALLBACK method" (http://www.nanoant.com/programming/themed-menus-icons-a-complete-vista-xp-solution) but in my project the method HandleMenuMsg2 or the HandleMenuMsg is...

Using AlphaBlend() and FillRect()

So, I'm using AlphaBlend() to copy a rectangle from one HBITMAP to another. It works, but there is a problem. Whenever I use the FillRect() function, the alpha values in the HBITMAP get slammed out to 0. Everytime. So I have to GetDIBits(), reset the alpha back to 255, and then SetDIBits(), after every call to the Win32 api functions...

How to get the x,y coordinate of a mouse-click with win32 C++ on a directx object?

How can I get the x,y coordinate of a mouse click, to see if it is over my menu button drawn by directx? Currently, my codebase has the following mouse-related class that doesn't seem to be able to give me this..I'm not sure how this might work. InputMouse::InputMouse() : m_LastX(-1), m_LastY(-1) { m_MouseActionEvent.clear(...

Determine the parent process of the current app

I wrote this utility (exe) which can be called from within this host application. And I'd prefer it that the utility can only be called from the host application. Running it from the outside or a different host should terminate the utility immediately. Is there a way to find out which process launched my utility? Thanks for the repli...

How do you write to an xml file in win32 C++?

I would like to write a simple xml file using xmllite in win32 c++. the file will be saved over every time the user saves. How do I do this? I'd rather not include any new libraries for this... ...

How do you get the location, in x-y coordinate pixels, of a mouse click?

In C++ (WIN32), how can I get the (X,y) coordinate of a mouse click on the screen? ...

Is UnregisterHotKey() important for clean up?

Simple question I think, after I have registered a few system-wide hotkeys with RegisterHotKey() do I need to eventually call UnregisterHotKey() to clean them up, or can I simply exit my application without worrying about it? MSDN doesn't seem to say, that or I misunderstand it, anyways: I realize I should just go ahead and call Unregis...

Connecting and Fetching a record form sequel server 2005.

I have a windows application in visual C++. I am not using MFC, in this application I have connect to SQL server 2005 and fetch records form a database file. Can any one guide me how this can done. Thanks in advance. ...

Prevent Modal Dialog on win32 process crash

We have a legacy build infrastructure for nightly builds (implemented in Perl) to compile, link and unit tests our applications/plugins. On Windows, if the unit testing process crashes, this pops up a Modal Dialog which "locks" our build farm. Is there a way (win32 API call, system config, env var, something...) to disable this behavior...

Message Map in Win32 No-MFC

How could I create similar structure to handle Win32 Messages like it is in MFC? In MFC; BEGIN_MESSAGE_MAP(CSkinCtrlTestDlg, CDialog) //{{AFX_MSG_MAP(CSkinCtrlTestDlg) ON_BN_CLICKED(IDC_BROWSE, OnBrowse) ON_BN_CLICKED(IDC_DEFAULTSKIN, OnChangeSkin) ON_WM_DRAWITEM() ON_WM_MEASUREITEM() ON_WM_COMPAREITEM() ON_...