天道酬勤,学无止境

winapi

WM_MOUSEMOVE - packing x and y positions

I am using a crude system to control a Flash movie from a C++/win32 program by sending WM_MOUSEMOVE events directly to the Flash window. It works well for one axis: SendMessage( m_targetWindowHWND, WM_MOUSEMOVE, 0, xpos); However I'd like to now send both x and y values. I know these are packed into a WM_MOUSEMOVEs lparam. In C++ this could be unpacked with MAKEPOINTS or GET_X_LPARAM/GET_Y_LPARAM. But how do I pack the x and y, basically doing the reverse of the macros above. My guess: DWORD packed = y << 8 + x; Thanks

2022-01-19 02:31:27    分类:问答    c++   winapi   visual-c++

How to print bold string in C++?

I got an old application which was written in a C++. I have 0 experience with it but I am suppose to make some changes in app. One of them is to change some text. Problem is that part of updated text needs to be bold, but i have no idea how to do that. I googled but with no much success. Only think I now is to go to new line with \nand new tab with \t. Any clever advise? EDIT: Example of code: BEGIN STRING1 "First Example" STRING2 "Second Example" And place where STRING1 is used: // WelcomeTip ---------------------------------------------// LPSTR idsWelcomeTip = (LPSTR)GlobalAlloc(GPTR, sizeof

2022-01-19 01:54:27    分类:问答    c++   string   winapi   bold

How to make a multi-line textbox's tab-stop working in win32api application

I have a win32api application written in c here. All controls in main window are created manually like this: hEditSource = CreateWindowEx(WS_EX_CLIENTEDGE, L"EDIT", NULL, WS_VISIBLE | WS_CHILD | WS_TABSTOP | ES_MULTILINE | ES_READONLY, someLeft, someTop, someWidth, someHeight, hWndMain, NULL, hInst, NULL); At first I didn't apply IsDialogMessage test in main message loop so all controls' tab stop won't work. Now I have it done, every control are OK except the multi-line textbox above. Indeed nothing happens when press tab in it. No focus moving, no tab charactor inserting(it will discard read

2022-01-18 23:56:59    分类:问答    c   winapi   tabs

How to Get TCanvas DC in Firemonkey?

What I need I need to get the DC of a Firemonkey component's TCanvas. I need this to use Win API drawing functions not accessible through Firemonkey, mainly 100% control over font rendering. Obviously, this is a pure Windows Application, so any compatibilities with OSX isn't an issue. What I did I managed to get hold of the TForm's handle and convert it into a HWND, then getting the DC with GetDC(FmxHandleToHWND(Handle)); This is the OnPaint handler for the Character_PaintBox control. HWND hWND = FmxHandleToHWND(Handle); HDC hDC = GetDC(hWND); int x = PreviewBack_Rectangle->Position->X +

2022-01-18 18:05:28    分类:问答    winapi   c++builder   firemonkey   gdi

Unicode text appears as question marks in edit box, even though I use SetWindowTextW()

I have a problem with unicode filenames appearing as question marks in my edit boxes. When I paste unicode characters in an edit box, for example Arabic or Thai, they show correctly, but after I run this code, they become question marks. How come? WCHAR buf[100]; GetWindowTextW(hWndEditBox, buf, 100); SetWindowTextW(hWndEditBox, buf); Another thing - the project is ANSI (we have code that can't be ported so the entire project stays ANSI), i.e. _UNICODE macro is undefined, but I explicitly use the Unicode versions of the filenames.

2022-01-18 16:38:26    分类:问答    c++   winapi   unicode

How to check/switch the airplane mode programmatically in Windows 8?

I have to check if the Airplane Mode is enabled in Windows 8 and maybe switch its state. I am currently working on a C# .NET 4.0 Windows Forms application but the answers in this question shouldn't be limited by that.

2022-01-18 16:26:44    分类:问答    winapi   windows-8   wireless   airplane

Iterating files in a directory without using FindFirstFile

On the Windows operating system, how do you iterate the files in a given directory without the use of third-party libraries or the use of FindFirstFile, FindNextFile, etc?

2022-01-18 14:22:52    分类:问答    windows   winapi   file   directory   loops

C++ program works on XP SP2 only after installing Visual Studio

I have a C++ program. It's quite simple - shows an image (splash screen) and launches another application, then closes when that other application is started. Actually, this one: http://www.olsonsoft.com/blogs/stefanolson/post/A-better-WPF-splash-screen.aspx with very minor changes (my splash screen image and my program is launched instead of the sample one). It works good on my Windows 7 developer machine. Also it works on another (virtual) machine with Windows XP SP2 and Visual Studio 2008 installed. But it doesn't work on just the same virtual Windows XP SP2 machine without Visual Studio

2022-01-18 10:30:26    分类:问答    c++   visual-studio   winapi   windows-xp

the application was unable to start correctly 0xc00007b

I have a win32 application. Trying to run in windows 7 64-bit OS in VisualStudio 2008. Have installed x64 Environment. So when i'm trying to run my project i'm getting this error "the application was unable to start correctly 0xc00007b". I have no link errors too. Anyone any suggestions please.

2022-01-18 07:52:18    分类:问答    visual-studio-2008   winapi   windows-7   64-bit

What windows messages are used by Delphi to notice changes in a combo box?

I have a Delphi application A, which I need to control from a .NET application B. Among other things, I need to automate this process: User selects item X from a combo box. Application A notices the change and reacts by displaying a certain panel. This works fine, if I do it manually. But when the application B selects a combo box value, no panel is displayed. This is the problem. Potential cause of it: When I select a combo box item, a certain windows message is fired. Some Delphi routine reacts to this message. When I select a combo box item programmatically, the only message I send is CB

2022-01-18 07:02:40    分类:问答    delphi   winapi   delphi-2009