winapi

Reading battery status for Windows CE based using win32 APIs

Hi friends I am developing an application for Windows CE based devices to read battery status. How would I do using win32 APIs? ...

Replacing FAR by nothing and PASCAL by __stdcall

I'm accessing a DLL through : int (__stdcall *Send) (char *); Send = (int (__stdcall *)(char *)) GetProcAddress(hmModule,"Send"); The original call uses: int (FAR PASCAL *Send) (char FAR *); Send = (int (FAR PASCAL *)(char FAR *))GetProcAddress(hmModule,"Send"); Is there any downside to replace FAR by nothing and PASCAL by __stdcal...

System Uptime in Delphi 2009

How can I code to see how long the computer has been on. Simple examples of code if possible. ...

Is there a Windows API call that will tell me if I'm running on a 64-bit OS?

Is there a Windows API call that will tell me if I'm running on a 64-bit OS? I have some legacy c++ code that makes a call to GetVersionEx to fill in a OSVERSIONINFO structure, but that only tells me (AFAIK) the OS (Vista, V7, etc.), but not the processing architecture. I can hack around this by simply looking for the existence of "C:\...

CreateProcess with WaitForSingleObject performance degradation

Everyone probably knows the code to run a program and wait for it to end: CreateProcess(... WaitForSingleObject(Process.hProcess, INFINITE It was used several times by myself. But recently I found that this call when it launches a program with a multimedia playback has worse performance than the same process being executed from ...

winapi CreateWindowEx -> create button with user system styles?

I want to make a button that looks just like the OK button when you go My Computer -> Help -> About Windows. I am creating a button like this: hButton = CreateWindowEx(WS_EX_CLIENTEDGE, TEXT("BUTTON"), TEXT("Text"), WS_CHILD | WS_VISIBLE | BS_DEFPUSHBUTTON, 10, 10, 30, 30, hwnd, (HMENU)IDC_MAIN_BUTTON, GetModuleHandle(NULL), NULL); ...

Lua Alien - Calling Specific API

Hello all, I have currently run into an issue while toying with Lua and the alien module to use Win32 API and such from Lua scripts. So far I have only had a single issue with alien which is with the use of API that use certain structures such as CreateFontIndirect. For example: HFONT CreateFontIndirectA( const LOGFONT& lplf ); LOGF...

Trying to compile Python using TDM-GCC on Win32, error in posixmodule.c

This is the line typedef BOOL (WINAPI *CRYPTACQUIRECONTEXTA)(HCRYPTPROV *phProv, LPCSTR pszContainer, LPCSTR pszProvider, DWORD dwProvType, DWORD dwFlags ); Where I get the error: Python-2.6.4\Modules\posixmodule.c|8299|error: expected ')' before '*' token| The compiler is GCC: gcc (TDM-1 mingw32) 4.4.1...

Find my Error in code

Point out my Error am doing some video process am render my video in a Picturebox.... here my problem is if i resize the picturebox i need to resize video also . [DllImport("user32.dll", EntryPoint = "SetWindowPos")] public static extern bool SetWindowPos(IntPtr hWnd, string hWndInsertAfter, int x, int Y, int cx, int cy, uint wFla...

Why do I get wrong text size for the toolbar?

In a Win32 GUI application I need to determine the width of area occupied by a string on a toolbar button so that I adjust the button width accordingly. The toolbar is plain old ToolbarWindow32 windows class. I use the following code: HDC dc = GetDC( toolbarWindowHandle ); SIZE size; GetTextExtentPoint32( dc, stringToMeasure, tcslen(...

TranslateAccelerator return value

The message loop generated by class wizard often looks like while( GetMessage() ) { if( !TranslateAccelerator() ) { TranslateMessage(); DispatchMessage(); } } Whereas TranslateAccelerator documentation says: If the function succeeds, the return value is nonzero. If the function fails, the return value is z...

Implementing Globalization / Multilingual feature in win32 API application.

I have developend a window application(Win32 API) in visual C++. I have to add multilingual feature in this application. Can any one Pls guide me how to get forward with this task. ...

Can I use WM_COPYDATA to copy a non-struct?

Lets say I have this class in foobar-shared.lib: class FooBar { std::string m_helloWorld; } And I have a call in foobar-from.exe using SendCopyData like so: extern HWND hMainWnd; // foobar-from.exe { FooBar fooBar; HWND hWnd = FindAppWindow(); // foobar-to.exe COPYDATASTRUCT cds; cds.dwData = ('f'|('o'<<8)|('o'<<16)); cds.cbDat...

Capturing text from controls on a Java Applet

Is it possible to capture the text of say a Edit Box or Label control on a Java Applet? In a more traditional Win32 program this can be accomplished using FindWindow, FindWindowEx together with things like GetWindowText. I have investigated with WinSpy but the Java Applet is just one large window with no children. I am wondering if th...

Windows CWnd::OnLButtonDown not called as expected on double click

I'm developing an interactive MFC application which displays a 3D object using my own algorithm, essentially using MFC as a framework, but using lots of pDC->Polygon(), pDC->Rectangle(), pDC->DrawText(), etc. calls. The UI has numerous clickable areas which all work well. However, the onscreen controls for rotating, spinning, etc. the ...

How do I destroy a Window correctly?

I'm programming a little game, and I set the lpfnWndProc to DefWindowProc and after that, I made a loop in that way: MSG lastMessage; while (true) { if (PeekMessage( &lastMessage, this->getWindow(), 0, 0, PM_REMOVE)) { TranslateMessage(&lastMessage); DispatchMessage(&lastMessage); } } So how do I hand...

SendMessage to Windows Explorer address bar

How to SendMessage to Windows Explorer address bar in C#? Thank you ...

Why is my owner-drawn combobox shown empty?

I'm subclassing a WTL combobox and I'm owner-drawing the items of the combobox. The control has the attributes CBS_DROPDOWNLIST | CBS_HASSTRINGS | CBS_OWNERDRAWVARIABLE and I'm using the mix-in class COwnerDraw to implement DrawItem() and MeasureItem(). When the drop down list is down, the items are drawn correctly. However when the drop...

How do I get the COM object from a HWND in Win32::OLE?

In Perl, if I have HWND of a window object, how can I get access to that COM object using that handle? I looked at Win32::OLE but the closest I got was the GetActiveObject method, which expects a class. ...

How to use Ruby to detect whether on Windows Platform, the SHIFT or ALT key is being pressed?

I wrote a script using Ruby to click on the screen automatically on Windows's apps. All is fine except there are situations where the program will keep on clicking and I have no opportunity to click on the Shell and click CTRL-C. So some "sleep" statement need to be placed somewhere in the loop, such as "sleep 3", so that there are 3 s...