winapi

How to catch Keyboard and mouse events?

I want to create an application. This application has to do something when a user presses special keys on keyboard or/and uses scroll wheel. This application is a service. It has no windows. I want to catch any keyboard or mouse events which were designed with other applications. For example, you are watching TV by 3rd party application...

can't find what's wrong with my code :(

the point of my code is for me to press f1 and it will scan 500 pixels down and 500 pixels and put them in a array (it just takes a box that is 500 by 500 of the screen). then after that when i hit end it will click on only on the color black or... what i set it to. anyway it has been doing odd stuff and i can't find why: #include <iost...

Gui's with Win32 API

I'm wondering what the correct way of creating Gui's in with Win32 API. Right now I just call the CreateWindowEx in my WM_CREATE event, but I don't think this is the right way to do it. Just as an example, what would be the correct way of adding a 100x20 EditField and getting text from it? Would you create it on WM_Create then use GetTex...

How can you print a file using Win32 Printing and Print Spooler Functions

I am trying to figure out how you can print a file, for example an excel spreadsheet using the Win32 Printing and Print Spooler Functions. I know the path of the file, but don't have a clue to send it to the print spooler. ...

How to use WINAPI from newer SDK but still using the old SDK in WindowsMobile.

Specifically, I want to use Point-to-point Message Queue but because I am still using legacy codes in eVC++ 4 and it only support until PocketPC 2003SE SDK, I cannot find CreateMsgQueue and friends in the headers (the port to newer VisualStudio is still in progess) I am using the Message Queue to do IPC with apps developed with WM-6.5-D...

Why does the token returned by LogonUser() in Win x64 not belong to LOCAL group?

Hi, I have a piece of code that calls LogonUser() followed by CreateProcessAsUser(). In Win32, the resulting process belongs to a user (say, TESTDOMAIN\user1) who belongs to the LOCAL group. However, in x64, the process owner does not belong to LOCAL. The owner still belongs to all other groups (Authenticated Users, Everyone, etc.) Doe...

How can i determine the version of the Windows SDK installed on my computer?

Hello everyone :) I've very recently decided to teach myself c++ and win32 programming after learning vb.net, and i've got a very simple question: How can I determine what version of the Windows SDK is installed on my computer? I'm asking so I can install the latest version if it isn't installed allready, before i start playing around w...

how to know location of return address on stack c/c++

i have been reading about a function that can overwrite its return address. void foo(const char* input) { char buf[10]; //What? No extra arguments supplied to printf? //It's a cheap trick to view the stack 8-) //We'll see this trick again when we look at format strings. printf("My stack looks like:\n%p\n%p\n%p\n%p\n...

How to suspend a running thread using win32 api's?

Here it is Create a thread in suspended state. hThrd1 = CreateThread(NULL, 0, (LPTHREAD_START_ROUTINE) ThreadProc1, (LPVOID) &obj1, CREATE_SUSPENDED, &dwFirstThreadID); Resume the thread whenever required ResumeThread(hThrd1); How do I suspend this running thread. I may resume it after sometime, but I want to suspend it now. I c...

How can I change text on a win32 window?

Looking for hints, tips and search terms for changing the text on a win32 window from C#. More specifically, I'm trying to change the text on the print dialog from "Print" to "OK", as I am using the dialog to create a print ticket and not do any printing. How can I find the dialog's window handle? Once I've got it, how would I go about...

Forcing file redirection on x64 for a 32-bit application

The silent redirection of 64-bit system files to their 32-bit equivalents can be turned off and reverted with Wow64DisableWow64FsRedirection and Wow64RevertWow64FsRedirection. We use this for certain file identity checks in our application. The problem is that in performing some of theses tasks, we might call a framework or Windows API,...

rockscroll or metalscroll for vis 2010

Has any one found a replacement for rockscroll or metalscroll for visual studio 2010? I miss it so much that i looked into making one my self but only have word highlighting working and a place holder scroll bar and seems to be much harder than i thought it would be. Im happy to share what i got if someone is interested in helping. ...

Linking win32 dll in Qt

Hi, I want to reference a win32 dll from my Qt application. I've added the dll location in the .pro file at "LIBS+=" . Once that is done, by right, i should be able to include the .h file inside the dll from my application. But i'm unable to do so. I'm testing with the dll here: http://www.flipcode.com/archives/Creating_And_Using_DLLs.sh...

Win32 API Programming - Is it worth ?

Now I code win32 api windows explorer . But it seems quite hard to me.I've a month to do it. But through the time I code, I wonder is it worth that I code win32 api ? . When we can create GUI easily with MFC or even easier with C#. What should I do ? 1- Keep coding with win32 api to deeply understand about them. 2- Just learn and cod...

Semaphores in unmanaged code

I've been using the Semaphore class to create semaphores. However, the examples use managed code (requires /clr), and I need to use unmanaged code because it seems FreeType doesn't like working with managed code. How can I create two simple threads which use a semaphore in unmanaged code? ...

Casting to global variable from LPVOID - C

I am trying to cast data to a struct from a parameter passed into my method, I need the data to be passed to a global variable as it is needed elsewhere in my application. I have tried the following but I get errors saying that diceResult is an undeclared identifier Here is the code itself: //Structure to hold dice data typedef struct...

How to get the drive letter of pendrive

Hi, I want to get the drive letter of pendrive or external harddisk connected through USB. Is it possible to get the Drive letter. I am using VC++ ...

Windows 7 application taskbar icons, font size and shortcuts

We have come across some behaviour involving the taskbar icons that Windows 7 displays for different applications. I'm wondering whether anybody could shed some light on this: Windows 7 is set with font-size = 110%. Two MFC dialog applications A.exe and B.exe have exactly the same .ico resource embedded in them. A.exe has a shortcut as...

How to check whether a PE file (DLL,EXE) is a COM component?

I need to write a stub module which, when given a PE (DLL/EXE) as input, will determine whether it is a normal Win32 DLL/EXE or COM DLL/EXE. I need to determine this programatically. Are there any Windows APIs for this purpose? ...

Windows Kernel Debugger API?...accessing strings

Hi! Does everyone out there knows how can you read windows kernel debugger strings generated by calls to kdPrint or debugPrint functions? Reading in user mode especially but it is also good in kernel mode! It's the same thing as DebugView does but I want to filter and to work only with certain messages (strings) given to the debugger!...