answerstu

winapi - Child windows does not receive WM_DESTROY?

I packaged the winapi CreateWindowEx into a simple class. Since every window sharing a same wndProc(hwnd,msg,wparam,lparam), I put every window created by CreateWindowEx into a map to distribute msg, like this:wndProc(hwnd, msg, wparam, lparam){ if(map[hwnd]!=nil){ switch(msg){ map[hwnd].wndProc(...) } }}And each time a window or its parent window being destroyed, remove it from the map:case WM_DESTROY: delete(map, hwnd)But things like buttons do not receive WM_DESTROY. I printed all msg in WM_NOTIFY and WM_COMMAN...Read more

windows - Run jar file without admin rights

I have a runnable jar file, that I start with java -jar myFile.jaron Windows. A customer stated that he had problems starting the application (which is this jar file wrapped into an executable). I have the suspicion that it has something to do with admin rights. So I'd like to run my jar file without admin rights for testing purposes (because this way I get the System.out/err which helps greatly for debugging).I realize that I can just create a non-admin account and start the application there, but I'd like to know if there is a way to specific...Read more

windows - .bat file renaming folders, changing first letter of every word to uppercase

From C:\x\adrenaline_-_shut_the_fug_up_and_dance-2000to C:\x\Adrenaline_-_Shut_The_Fug_Up_And_Dance-2000I had this code but it capitalize every single letter instead@echo offsetlocal disableDelayedExpansionecho Renaming foldersfor /d %%F in (C:\x\*) do ( for /f "eol= " %%A in ("%%~nxF") do ( set "name=%%F" set "newName=%%A" setlocal enableDelayedExpansion for %%C in ( A B C D E F G H I J K L M N O P Q R S T U V W X Y Z ) do set "newName=!newName:%%C=%%C!" ren "!name!" "!newName!" endlocal ))thank you!...Read more

windows - SQL Server- connection forcibly closed during login process

The scenario is as follow:Connection from Windows Server 2003 to SQL Server 2005 works smoothly. Now a new Windows 2012 server which hosts the same .net web application unable to connect to the same SQL Server database, it fails with the following error: A connection was successfully established with the server, but then an error occurred during the login process. (provider: SSL Provider,error: 0 - An existing connection was forcibly closed by the remote host.)]As it is working fine from Windows 2003, I guess the issue could be one of these:Ba...Read more

windows - win32 / opengl and callback functions.. how are they structured?

I'm working on a win32 c/cpp project involving openGL. I'm just starting and had a few basic questions regarding how a standard win32 program works. Following a tutorial, I made the winmain create a new window, enable openGL for the window, and then enter the main loop where if there are messages, the program handles them, and otherwise, the program moves onto drawing openGL animations. Following that, I simply shut down openGL and destroy the window. I'm not too confused about what's happening in here, but this is where I get lost:LRESULT CALL...Read more

Is there an equivalent of 'which' on the Windows command line?

As I sometimes have path problems, where one of my own cmd scripts is hidden (shadowed) by another program (earlier on the path), I would like to be able to find the full path to a program on the Windows command line, given just its name.Is there an equivalent to the UNIX command 'which'?On UNIX, which command prints the full path of the given command to easily find and repair these shadowing problems....Read more

winapi - updating win32 window to display generated barcode

I am creating a barcode generator application in win32. I got the library to generate the needed barcodes and if I hardcode the UPC it displays the barcode fine. However I want to be able to enter a string in the text field and have it generate the barcode and display it on the window. I've looked into UpdateWindow, but the HWND variable that is in LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam)is out of scope in the function that I want to call it in, and I've also tried making a global HWND hWnd, but it throws ...Read more

windows - Why does this simple DLL crash before WM_ACTIVATEAPP arrives?

The minimal DLL below, which uses only the Win32 API, tries to do nothing more than create an MDI frame/client window and one child window, and destroy the frame window when the DLL unloads. The DLL crashes on Windows XP with an exception upon executing an INT x2B instruction in USER32.For testing, the DLL is simply invoked by a one-line application calling LoadLibrary('badcode.dll').The crash happens inside the final "DestroyWindow(framewindowhandle)" just before the DLL finishes, after FrameWindowProc receives WM_ACTIVATE but before it recei...Read more

windows - Generating a unique machine id

I need to write a function that generates an id that is unique for a given machine running a Windows OS.Currently, I'm using WMI to query various hardware parameters and concatenate them together and hash them to derive the unique id. My question is, what are the suggested parameters I should use? Currently, I'm using a combination of bios\cpu\disk data to generate the unique id. And am using the first result if multiple results are there for each metric.However, I ran into an issue where a machine that dual boots into 2 different Windows OS ge...Read more

windows - How to use DoEvents() without being "evil"?

A simple search for DoEvents brings up lots of results that lead, basically, to: DoEvents is evil. Don't use it. Use threading instead.The reasons generally cited are:Re-entrancy issues Poor performanceUsability issues (e.g. drag/drop over a disabled window)But some notable Win32 functions such as TrackPopupMenu and DoDragDrop perform their own message processing to keep the UI responsive, just like DoEvents does.And yet, none of these seem to come across these issues (performance, re-entrancy, etc.).How do they do it? How do they avoid the p...Read more

visual studio - Building a DLL on Windows that uses a static /MT lib

I have a third-party static lib, libTA.lib. It was built with /MT and I can't change that. I want to link libTA into a DLL I'm building, mydll.{lib,dll}. Of course my dll should be built with /MD; my dll will be used with /MD-built exes (also not under my control). Linking mydll with libTA.lib fails (correctly, I'd say) due to LNK2038, mismatch detected for RuntimeLibrary.So, what can I do about this? Building mydll with /MT seems like a terrible idea because I don't want to have multiple msvc runtimes.So my question is, what are my options? An...Read more