winapi

Is there an API call to start a scan for hardware devices

Related to this question, but... is it possible to trigger via API a new hardware device scan? I have a serial port Bluetooth device that I'm pairing automatically via API calls with 32feet.net .NET Bluetooth, which works quite nicely. While i can query for the serial services in the scanning of the device, the COM ports don't show up i...

how to send typing messages via WM_KEYBOARD_LL hook procedure

Hi there~ I'm trying to send a duplicate message to an editbox window in this code: extern "C" HOOK_DLL_API LRESULT CALLBACK GetMsgHookProc(int nCode, WPARAM wParam, LPARAM lParam) { if (nCode < 0) { CallNextHookEx(gMsgHook, nCode, wParam, lParam); } KBDLLHOOKSTRUCT *lpk = (KBDLLHOOKSTRUCT*) lParam; ...

Difference between GetLastError 5(Access denied) and GetLastError 1326(Unknown user or bad password)

I have a shared folder (New Folder) in a remote pc with current users (user1 and user2). When I try to access the shared folder with the ff credentials in a program, the GetLastError API returns 5 but I expect that GetLastError API should return 1326. path: \\PC1\New Folder user: 12345 pwd: 12345 Please explain to me the difference. T...

Is it possible to draw to a device context after DWM thumbnail is drawn?

I registered a thumbnail on a window of another window. (dwmRegisterThumbnail()) I want to draw on top of the thumbnail but I can't as drawing of thumbnail is handled by DWM. Is this possible? ...

Custom ComboBox for SearchBox

Hi, I'm implementing a custom combobox to behave like a searchbox. It is constructed from an Edit control, a Button and a Listbox. I'm trying to open the listbox on mouse click on the button, it seemed to be simple but become complicated. First I tried to manage the mouse click on the "BN_CLICKED", but then I discovered it's too late a...

what is invalidate,update methods do in VC++

Hi all, i have small doubt regarding the window functions in c++. what exactly "invalidate()" function do? what message does it sends?when we need to call this? also what is "update()" function? is "invalidaterect()" works similar to "invalidate()" function?. Thanks ...

Dnsqueryconfig returning junk characters!!

Hi iam trying to retrieve the domain name of a machine using the following code //if(FAILED(DnsQueryConfig( // DnsConfigPrimaryDomainName_UTF8, // FALSE, // NULL, // NULL, // cszDomainName, // &size // ))) //{ // //break; //} //LPWSTR lpcszContent ...

CreateProcess and strange nslookup error

I have this api routine that I use regularly to capture dos output. Recently a strange bug has been found where it doesn't seem to allow dns calls. For instance nslookup will return the "No response from server" error with Server: UnKnown. Ping will work if you supply it an IP address, but not if it has to make a dns call. This problem i...

Dock a control in native C++

I know how to do this in .Net but in native Win32, how does one dock a control. I'm trying to dock a trackbar I made like vlc's trackbar. Thanks dock it to the bottom of its parent window ...

How can I get the username of the person executing my program?

How can I get the username of the process owner (the user who is executing my program) in C++? ...

How to check open processes in C++?

In Windows I would like the C++ command or reference that would get the "tasklist" in C++ and output it to a buffer? ...

How to invoke NdrClientCall2() function directly?

Does anybody know how the NdrClientCall2() function in rpcrt4.dll can be called in code or how it can be used? We've gone through the MSDN help - http://msdn.microsoft.com/en-us/library/aa374215(VS.85).aspx, but didn't get any examples/samples how to use this function. Please provide help. Thank you. ...

Convert HDC to wxClientDC?

Is there a way to convert a HDC to a wxDC object? I know wxDC is abstract. Is it possible to convert to wxClientDC? ...

EnumServicesStatus and Windows 7

hello! All these years i have been successfully using EnumServicesStatus in combination with OpenScManager (with SC_MANAGER_ENUMERATE_SERVICE) to get a list of the services installed on a computer. This has been working well since NT 4 and up to Vista. Now, for some reason, in Windows 7 I'm not getting the whole list of the installed s...

How to get caption of ListBox control

How can I get the caption of ListBox control. I have handle to Listbox control. I tried with following , but it returned empty string SendMessage(hListBox,WM_GETTEXT,MAX_PATH,(LPARAM)wszCaption); Any suggestion of how to get the caption associated with ListBox. ...

FindWindowEx not able to find window handle.

I am trying to find the handle to a dialog as soon as it opens. Now as soon as dialog is opened I try to call FindWindowEx for that dialog in a separate thread but it returns NULL. I then put some sleep before calling FindWindowEx. It works some time after putting sleep. It looks like FindWindowEx is getting called before even dialo...

What good are thread affinity mask changes for the current thread?

Hello, I'm writing a game engine and I need a way to get a precise and accurate "deltatime" value from which to derive the current FPS for debug and also to limit the framerate (this is important for our project). Doing a bit of research, I found out one of the best ways to do this is to use WinAPI's QueryPerformanceCounter function. G...

Detect Window Move in Property Page (win32)

I implemented a wizard using property sheet. One one page I display tooltip if user enters something invalid. It is a tracking tooltip so I have to manually turn it on and off. Now I want to move the tooltip when the wizard page moves. It seems that only the property sheet window receives WM_MOVE event from Windows. The page does not. I...

Why does Loader Snaps not work when attaching to a process?

When I configure GFlags to show loader snaps on an image MYEXE.exe and run the executable from windbg I get loader snaps output in the debug window. But when I use windbg to attach to the process already running I do not, even though I enabled loader snaps before the process was started. How can I get loader snaps to work when attachin...

How do I place my app window in a certain position in the desktop window hierarchy on Windows using win32 api?

I want my application window to be in a certain spot in the window hierarchy. That is, say I have 3 windows on my desktop. At the very bottom I have Word, the window on top of word is explorer, and the active foreground window is itunes. I want to place my application window on top of word but beneath explorer. How can I achieve this wit...