winapi

c++ win32 get utf8 char from keyboard

hello, how would i read keystrokes using the win32 api? i would also like to see them from international keyboards like german umlauts. thanks ...

Windows API Programming....

Hello There... Its me Vijay.. I m Trying to make a CrossHair(some kind of cursor) On The Screen while running a Game (Counter Strike)... so i did this... ############################# #include<iostream.h> #include<windows.h> #include<conio.h> #include<dos.h> #include<stdlib.h> #include<process.h> #include <time.h> int main() { ...

Using OpenGL in a regular window (Win32)

I want to use OpenGL in my WndProc but I'm not sure how. I also don't want GL to occupy the whole screen, just a portion of the screen. In the end I basically want to make a drawing win32 app but use OGL instead of GDI. so how can I tell GL to use my control (a panel) 's hdc for drawing? Thanks ...

Getting the vector points of a letter in a truetype font

Since True Type fonts are just vectors, I was wondering if there was a way to get the vectors (array of points) for a letter given that i'm using the WinAPI. Thanks ...

About the signature: int WINAPI WinMain (HINSTANCE p1, HINSTANCE p2, LPSTR p3, int p4)

Why can WinMain have two return types? If I remove it,will report this warning: warning C4007: 'WinMain' : must be '__stdcall' Or I'm reading int WINAPI wrongly? UPDATE I tried these two variants which are said to be the same as WINAPI,none work: int __declspec WinMain int __declspec(stdcall) WinMain ...

Win32 scrolling examples

Could anyone point me to (or provide?) some nice, clear examples of how to implement scrolling in Win32? Google brings up a lot of stuff, obviously, but most examples seem either too simple or too complicated for me to be sure that they demonstrate the right way of doing things. I use LispWorks CAPI (cross-platform Common Lisp GUI lib) i...

Is there a way to find out the current count of a win32 semaphore?

I'm looking for a way with no side effects. Ideally, the following code would do the trick: long currentCount = 0; ::ReleaseSemaphore(h, 0, &currentCount); But unfortunately 0 is not allowed as the value of lReleaseCount, so the call returns FALSE. ...

FillRect won't draw anything

I'm trying to create a simple window in Win32 and draw a rectangle in it, but for some reason FillRect isn't working for me. Here's my source: #include <windows.h> #include "resource.h" RECT rect; LRESULT CALLBACK WndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lParam) { static PAINTSTRUCT ps; static HDC hDC; switch(ms...

Application built using VS2010 does not work in VS-Express2008 - C

Hello, I have wrote an application that consists of two projects in a solution, each project contains only 1 .c source file. I was using Visual Studio 2010 Ultimate but due to the University only supporting 2008 I decided to create a blank solution and copy the source files into the new one. After creating a new solution in VS2008 expr...

WM_SYSCOMMAND oddities

An application recieves the WM_SYSCOMMAND message when the user selects a menu item command on the system menu, and so wParam can be SC_CLOSE, SC_CONTEXTHELP, SC_MAXIMIZE, SC_MINIMIZE, SC_RESTORE etc. That's logical. (Of course you can also send these messages by clicking on the minimize, maximize, close buttons etc.) But one can also s...

How to list all installed ActiveX controls?

I need to display a list of ActiveX controls for the user to choose. It needs to show the control name and description. How do I query Windows on the installed controls? Is there a way to differentiate controls from COM automation servers? ...

Retrieving virtual disk file name from disk number

When I list virtual disks within diskpart: DISKPART> list vdisk VDisk ### Disk ### State Type File --------- -------- -------------------- --------- ---- VDisk 0 Disk 2 Attached not open Fixed C:\Disk.vhd Interesting part for me here is file name. I tried to find equivalent of functio...

Does Watir work under ruby 1.9.1?

Here is the .rb program: require 'watir' b = Watir::Browser.new the 2nd line will trigger a ""The program can't start because msvcrt-ruby18.dll is missing from your computer!" error. I am using 1.9.1p378 on win32 ruby 1.9.1p378 (2010-01-10 revision 26273) [i386-mingw32] How can I fix this? Thanks for your attention. ...

Terminate long running thread in thread pool that was created using QueueUserWorkItem(win 32/nt5).

I am programming in a Win32 nt5 environment. I have a function that is going to be called many times. Each call is atomic. I would like to use QueueUserWorkItem to take advantage of multicore processors. The problem I am having is I only want to give the function 3 seconds to complete. If it has not completed in 3 seconds I want to te...

Does OpenGL stencil test happen before or after fragment program runs?

When I set glStencilFunc( GL_NEVER, . . . ) effectively disabling all drawing, and then run my [shader-bound] program I get no performance increase over letting the fragment shader run. I thought the stencil test happened before the fragment program. Is that not the case, or at least not guaranteed? Replacing the fragment shader with one...

Is it possible to change a exe's icon without recompiling it?

Hi all, I have lot of executable that I have compiled (long time back) for many of which I don't have sourcecode now. But when I compiled them I didn't put any icons for them, so they all look like same dull, bald default icon. So my questions are, (1) is it possible for me to write a software that can change the resources section of ...

My multithread program works slowly or appear deadlock on dual core machine, please help

I have a program with several threads, one thread will change a global when it exits itself and the other thread will repeatedly poll the global. No any protection on the globals. The program works fine on uni-processor. On dual core machine, it works for a while and then halt either on Sleep(0) or SuspendThread(). Would anyone be able ...

Memory mapping of files and system cache behavior in WinXP

Our application is memory intensive and deals with reading a large number of disk files. The total load can be more than 3 GB. There is a custom memory manager that uses memory mapped files to achieve reading of such a huge data. The files are mapped into the process memory space only when needed and with this the process memory is wel...

Adding a transparent bitmap to a windows button

It's a while since I've done this, but I'm trying to add a custom button graphic to a windows button, with some transparent areas. I've tried various schemes but can't seem to get the transparent areas to show. Here's my code: hbmpUpDisabled = LoadImage(instance,MAKEINTRESOURCE(IDB_UPARROWDISABLED), IMAGE_BITMAP, 0, 0, LR_DEFAULTSIZE ...

Is it possible to design our own algorithm to create unique GUIDs?

GUID are generated by the combination of numbers and characters with a hyphen. eg) {7B156C47-05BC-4eb9-900E-89966AD1430D} In Visual studio, we have the 'Create GUID' tool to create it. I hope the same can be created programmatically through window APIs. How GUIDs are made to be unique? Why they don't use any special characters like #,...