winapi

Scrollbar movement SetScrollPos and SendMessage

Hi, I'm trying to move the scrollbar of a window programatically. I'm first sending a : SetScrollPos(handle, 1, position, true); and then followed by : SendMessage(handle, 0x0115, wparam, new IntPtr(0)); The wparam is correct. When i inspect through spy++, the only difference between sending a scroll with the above code and actuall...

Win3Printer and Win32_PrintJob to get printer queue jobs?

Win32_PrintJob give me jobs from computer I use? But how to get jobs from specific printer? Something like use Win32_Printer to get Network printers and next using Win32_PrintJob to get all jobs from specific printer... It is possible ? ...

Send mail through gmail SMTP server using Win API

I am trying to use gmail's SMTP server smtp.gmail.com to send mails using C in Windows. I am able to connect to port 587 of the server, however the server responds by saying that STARTTLS/TLS is needed. Is there any Windows API call for starting a TLS connection ? Should I even consider writing this application in C or use Python ? Edi...

Should I use Thread.BeginThreadAffinity() when using impersonation?

I understand that impersonation is tied to a single thread. However, managed threads could be shuffled around on top of native Win32 threads, so should I try to bind the identity using Thread.BeginThreadAffinity()? And should I use Thread::ManagedThreadId when checking calls later on an object that manages the impersonation? EDIT: But ...

Updating the Z-Order of Many Windows Using Win32 API

The scenario is that I have a list of window handles to top level windows and I want to shift them around so they are arranged in the z-order of my choosing. I started off by iterating the list (with the window I want to end up on top last), calling SetForegroundWindow on each one. This seemed to work some of the time but not always, i...

How can I change the default CDialog font for a non-modal dialog?

It is necessary to switch off the "ClearType" property of the default font for all dialog controls. It is possible to do that for one control by setting logfont.lfQuality = ANTIALIASED_QUALITY There are a lot of suggestion how to do the same for modal dialogs (http://neelaakash.wordpress.com/2007/12/31/change-default-dialog-font-of-cd...

resource.h is missing

is it possible to generate resource header file if i got the resource.rc file? ...

Run managed code on secure desktop

I am working on creating an application which must interact with the user on the secure desktop (i.e. locked computer screen), but does not specifically provide authentication. From my research, it seems that the only way to get code running on the secure desktop is to use the Credentials Provider API. However, you can only write a crede...

Attach a video stream onto an existing application

Hello, Is it possible to show a video that is playing onto an existing application? Application A is running. Get Video A and place it on top of Application A and then play it. Thanks! Cheers! ...

VS2010 C code - String pooling

Hi, Below code crash in VS 2010 when you compile with following flag and if you add /GF- or remove the opimization flag they don't crash. The crash occur at assembly code which translate 'if( path[i] == '/' )'. I like to understand the optimization that compiler does here and lead to crash. Looking forward for some pointers. -Karthik ...

Createfile function

I am creating the file using Createfile function. The C program is working fine but I am unable to see the created file in the respective folder. Also "view hidden files" option is checked. ...

Convert LPTSTR to string or char * to be written to a file

I want to convert LPTSTR to string or char * to be able to write it to file using ofstream. Any Ideas? ...

Access is denied - when trying to get the url (text) from address bar's handle

I'm trying to extract the URL from the address bar of IE. (IE 8 on Windows 7) using the following C# code. static string GetUrlFromIE() { IntPtr windowHandle = APIFuncs.getForegroundWindow(); IntPtr childHandle; String strUrlToReturn = ""; //try to get a handle to IE's too...

Does LoadBitMap() API creates paint issues?

I have a legacy system written in C++, MFC. I was checking a piece of code where LoadBitmap() was replaced with LoadImage() API. The comment written in the code says "LoadBitmap() uses the Paged pool from Kernel memory and if the usage reaches the maximum limit then the paint issues would pop up. So LoadImage API should be used". I goo...

I don't always receive WM_LBUTTONDBLCLK

I'm writing an app (in C++) which uses WM_LBUTTONDBLCLK. It's all working fine except but I don't always get the DBLCLK message. Quite often I get two WM_LBUTTONDOWN messages instead. I've looked at the mouse position - it doesn't move. I've looked at the time between the two WM_LBUTTONDOWN messages - it's well within the value return...

How do I print the string which __FILE__ expands to correctly?

Consider this program: #include <stdio.h> int main() { printf("%s\n", __FILE__); return 0; } Depending on the name of the file, this program works - or not. The issue I'm facing is that I'd like to print the name of the current file in an encoding-safe way. However, in case the file has funny characters which cannot be represe...

how to make screen screenshot with win32 in c++?

how can i make screen-shots of the local pc screen with win32 c++? ...

Process name missing from GetCommandLine

Hi, I have a problem with GetCommandLine API. It usually returns the executable name followed by a space and arguments. As documentation says, the first token may not have complete path to image and blah blah blah. I never had problems until now that I used CreateProcess with lpApplicationName not NULL If I use: CreateProcess(NULL, ...

Should I use Hungarian notation when coding WinAPI apps?

I've recently started learning Win32 API and I hate Hungarian notation (those stupid prefixes in variable names which make the code looking ugly and almost unreadable), however as you may know it is absolutely everywhere in there! And this fact causes everyone to use it in their code too to keep kind of consistency... I suppose it is stu...

Performance of fopen() on win32

I am trying to write some code that works on both Linux and Win32. The most noticeable difference I find between them (in my code) is performance of fopen(). Following code takes 5 sec on my Ubuntu and the same code takes more than 100 sec on windows XP. I would like to make a note here that ubuntu is VM while XP is on a real machine. ...