winapi

Windows API - CreateProcess() path with space

How do I pass path with space to the CreateProcess() function? The following works STARTUPINFO si; PROCESS_INFORMATION pi; ZeroMemory( &si, sizeof(si) ); si.cb = sizeof(si); ZeroMemory( &pi, sizeof(pi) ); if( !CreateProcess(_T("c:\\installer\\ew3d.exe"), // No module name...

How much stuff does .net do that isn't required?

As the title states; how much work (as a rough percentage figure, if that's possible) does the .Net BCL do for a typical Windows application that isn't strictly required as far as Windows itself is concerned? Presumably everything that Winforms does that has an analogous functionality in MFC, the latter is the ultra-efficient implementat...

UDP multicast from specific network card

I'm looking for some networking gurus to help me with a problem. I have many computers running my software which uses UDP multicasting. This works fine if the computers are connected ONLY to one network (network A). My computer (which is also running said software) will listen on port XXXX for the multicasts. This computer has two networ...

Problem waking up multiple threads using condition variable API in win32

Hi everyone, I have a problem in understanding how the winapi condition variables work. On the more specific side, what I want is a couple of threads waiting on some condition. Then I want to use the WakeAllConditionVariable() call to wake up all the threads so that they can do work. Besides the fact that i just want the threads starte...

Why doesn't Createfile() have a binary flag

One of the great joys of windows programming is remembering to put 'wb' or 'rb' or ios::binary in all the file open calls so that Windows doesn't merrily convert all your 0x13s. I just had to convert a bunch of nicely standard code to use Createfile() to get a certain flag - and it occurred to me that there is no way to specify binary. ...

TransmitFile + SChannel

I'm using the TransmitFile API with I/O completion ports for an efficient multithreaded file server on Windows. This all works fine, but I've now also implemented secure sockets using SChannel. Because TransmitFile streams the file directly to the socket, I don't see a way to call EncryptMessage - will I need to read the file in chunks,...

Draw to HDC with user allocated memory

I have an windowless IViewObject object. I want to call its Draw function to render into Opengl PBO memory (alternatively OleDraw is simpler). Right now i first create an HBITMAP using CreateDIBSection (which allocates its own memory) and then copy from this into my PBO memory. However, I'd like to avoid this extra copy. I believe this...

LogonUser and others return error 1337 in Windows Server 2003 x86

After some update, I see following issue on all Windows Server 2003 member servers (x86 only): LogonUser, and LogonUserEx calls are failing with error 1337 (The security ID structure is invalid). Basically, following code fails: HANDLE token; BOOL b = LogonUserA( "username", "DOMAIN", "password", LOGON32_LOGON_INTERACTIVE,...

Windows API - ShellExecuteEx() didn't wait on USB drive and CD drive

I am writing a master installer with the following ShellExecuteEx() function that call a few Advanced Installer created installers (installing multiple products) one by one through a loop construct. // Shell Execute bool CFileHelper::ShellExecute(CString strCommandPath, CString strOptions) { CString strQCommandPath = CString(_T("\...

will Delphi applications become smaller in future

already delphi win32 exe size is ~850 kb , do they have any roadmap of making exe size bit smaller,(i know that the size is because of vcl unicode RTTI and many more ),delphi compiles the whole unit even only a small function in the unit is needed. so is there any facilities to do so,or third party products are there , (i know kol and mc...

Silently catch windows error popups when calling LoadLibrary()

Is it possible to silently catch errors popup like "the procedure entry point xxx could not be located int the dynamic link library xxx" when calling LoadLibrary() ? ...

win32 createfilemapping and ACL

Hi all! I totally dislike win32 API, but I need to do one thing, so I came here to ask you for help ) The task is to create shared between two processes file mapping. The problem is in specifying properly security attributes (second parameter). I need somehow to set this atributes in order to: Allow reading from file map. Deny reading...

How do you empty a cache when we you measure function's performance.

CPU cache always interrupts what we test a performance of some codes. gettime(); func1(); gettime(); gettime(); func2(); gettime(); // func2 is faster because of the cache.(or page faults of func1()) // But we often misunderstand. When you measure your code performance, how do you remove the cache's influence. I'm finding some funct...

Force closing shared file: NetFileClose

Hi, I'm trying to make a program that force the connection to a shared file. I found the system call NetFileClose and it seems to be very simple; but when I call it, it retourned me always the error code number 53. Like parameter I give servername NULL (I try also with 0 but with the same result) and fileid a correct value. I logged in ...

ShowWindow within WM_CREATE

The way I see it, one use of a Window Procedure's WM_CREATE message is to relieve the caller of the burden of executing static code at window initialization. My window is to execute some code in the WM_CREATE message, including the ShowWindow function. I also want the ShowWindow to behave properly according to the nCmdShow parameter in W...

win32/C dialog box: "modern" look / style for a combo box

I want my dialog box (resource) in a Win32/C app to have a "modern" look/style, particularly its combo boxes. By "modern", I mean that a "drop list"-type combo box looks like a solid button, with just a small "arrow" icon on the side, as opposed to the "old" look: flat edit box with a separate arrow button. In the VS dialog editor, the c...

How to prevent arrow keys from changing the UI state?

I am developing a Tetris game using C++ in combination with the plain old WinAPI, GDI and GDI+. The applications window contains a few UI controls along with a static control that is used for painting the game state. I am using a keyboard hook so that I can respond to the arrow keys to move the current block and the space bar to drop the...

How can I produce an OSD in Windows?

I want to create an on-screen display, i.e. text or simple graphics that appear on top of everything else being displayed. I know in Linux this is achieved with xosd, but how do you do it in Windows? (Assume XP and up if it makes it easier, and I would also be interested in knowing if the method is different in Vista/7) ...