winapi

How to use Watin 64-bit with MSIE 32-bit

Hi, I have a C#-application running on Windows 7. I am using Watin to test some flash and quicktime movies in Internet Explorer. I am running in x64 mode due to some memory limitations I encountered in x86-mode. So I run my application which uses Watin, which starts MSIE. Watin starts the 64-bit version of MSIE. So far so good. The pro...

Should I deal with files longer than MAX_PATH?

Just had an interesting case. My software reported back a failure caused by a path being longer than MAX_PATH. The path was just a plain old document in My Documents, e.g.: C:\Documents and Settings\Bill\Some Stupid FOlder Name\A really ridiculously long file thats really very very very..........very long.pdf Total length 269 charac...

Wanted: WinAPI calls logger

There was an "API Monitor" program, but it seems discontinued. Doesn't work on my system. Is there any such tool, which can work on Windows 7 x64? I need to log API calls from a selected set, better when parameter values. ...

Problem displaying the Message box in MFC

I have a simple MFC program which displays the progressbar..I used the below code to display the progress bar.. HWND dialogHandle = CreateWindowEx(0,WC_DIALOG,L"Proccessing...",WS_OVERLAPPEDWINDOW|WS_VISIBLE, 600,300,280,120,NULL,NULL,NULL,NULL); HWND progressBarHandle = CreateWindowEx(NULL,PROGRESS_CLASS,NULL,WS_CH...

EnumJobs not returning Copies & Total Pages

I'm using Windows API's EnumJobs to find the PageCount and Copies of a print job, but I found that these fields are almost always zero when called on a print server. Although it could be my timing is out, because the number of pages increment as the job prints and once it's done the print job cannot be accessed. So there is about half a...

Process.Start("IExplore.exe"); <-- Is this reliable ?

Process.Start("IExplore.exe"); Does this always work, on every machine ? If not, how to do it properly ? ... EDIT: ................................. The problem with Process.Start("http://www.example.com/"); is that we have to target a local html file, with some querystring specifying which page to load in the html frameset. So our UR...

Virtualization of Legacy API and co-existence with more modern API?

I don't mean for this question to be a flame bait but I'll be using Microsoft and their win32 API as a example of a legacy API. Now what I am wondering here is Microsoft is spending a lots of their money and energy in maintaining their legacy API, including all of the "glitches/bugs/workaround" that are needed to keep the API functionin...

C++: How do I correctly register and unregister file type associations for our application (programatically)

Time was when you set file associations in: HEY_CLASSES_ROOT\<.ext> However, that seems to be possible, but an incomplete solution anymore. There are additional associations throughout the registry. For example: HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Explorer\KindMap HKEY_LOCAL_MACHINE\Software\Microsoft\Window...

Resources for Win32 C/C++ programming

I have experience in a variety of languages (Java, Perl, C#, PHP, javascript, ansi-C for microprocessors, Objective-C and others), with Win32 programming not being an area I've done a lot of work in. Now part of my job entails maintaining a large Win32 codebase that stretches back 15 years and includes everything from C written originall...

WIN32 Logon question

We have developed a ASP.NET 3.5 web application with Web Server 2008 and has implemented a custom authentication solution using active directory as the credentials store. Our front end application uses a normal login form to capture the user name and password and leverages the Win32 LogonUser method to authenticate the user’s credentials...

DialogBox in Win32 - Prevent multiple instance

Hello all, I have a program which creates DialogBox window when user clicks the menu item from tray icon, case ID_OPTIONS: DialogBox ( GetModuleHandle ( NULL ), MAKEINTRESOURCE ( IDD_SETUP_DIALOG ), hWnd, reinterpret_cast<DLGPROC>(SetupDlgProc) ); return 0;...

Performing full screen grab in windows

I am working on an idea that involves getting a full capture of the screen including windows and apps, analyzing it, and then drawing items back onto the screen, as an overlay. I want to learn image processing techniques and I could get lots of data to work with if I can directly access the Windows screen. I could use this to build aut...

How to remove the MenuBar of an application using windows API ?

I am using the below code to remove the Title Bar of an application, which is working perfectly for notepad. Now i want to remove the Menu Bar also. How to achieve it ? //Finds a window by class name [DllImport("USER32.DLL")] public static extern IntPtr FindWindow(string lpClassName, string lpWindowName); //Se...

[winapi] Three questions about editbox ?

Hello! I have three questions about editbox control in WINAPI (i can't find information on msdn about this) 1. How to disable moving typeing cursor with mouse, arrows, backspace in editbox ? I want to make typing like in command line in dos, but with out backspace. Can I write some piece of text with red color, and another with blue ? ...

GetFirstChild in win32 ?

Hello All, I use EnumChildWindows to get all the Child windows from the main HWND window , But i would like to get only the first child of the given HWND window. BOOL CALLBACK EnumChildProc ( HWND hwndChild, LPARAM lParam) { // logic to call only once } Is it correct ? or any other simple way ? ~UK ...

How to protect an imported Win32 DLL into a .NET application from memory issues

I have a C# application that needs to use a legacy Win32 DLL. The DLL is almost its own application, it has dialogs, operations with hardware, etc. When this DLL is imported and used, there are a couple of problems that occur: Dragging a dialog (not a Windows system dialog, but one created by the DLL) across the managed code applicat...

In Ruby, how to I read memory values from an external process?

So all I simply want to do is make a Ruby program that reads some values from known memory address in another process's virtual memory. Through my research and basic knowledge of hex editing a running process's x86 assembly in memory, I have found the base address and offsets for the values in memory I want. I do not want to change the...

how to close ie8 tabs

This code below is not closing a tab in Internet Explorer 8. If I post wm_close command to Wnd it closes Internet Explorer but I want to close the current tab not the entire 'ieframe'. Is FindWindowEX(Wnd , 0, 'Frame Tab', nil) supposed to retun a handle to ie frame? If yes why is it not closing the current tab in Internet Explorer? var...

SwapBuffers causes redraw

I'm making a Win32 application with OpenGL in the main window (not using GLUT). I have my drawing code in WM_PAINT right now when I call swapBuffers it must be invalidating itself because it is constantly rerendering and using lots of cpu resources. How can I make it only render when it honestly receives WM_PAINT like when using GDI? Th...

Window screenshot using WinAPI

How to make a screenshot of program window using WinAPI & C#? I sending WM_PAINT (0x000F) message to window, which I want to screenshot, wParam = HDChandle, but no screenshot in my picturebox. If I send a WM_CLOSE message, all waorking (target window closes). What I do wrong with WM_PAINT? May be HDC is not PictureBox (WinForms) compone...