How is it possible to select which network interface to use?
I have multiple VPNs installed, Hamachi for example (25.0.0.0)
It is the first one in priority list in my "network adapters" window on Win7.
However, when I use sockets in SFML, it still uses my "local interface", which is 192.168.etc.etc.
Some games I saw are always using local interface, some of them are using the first one in priority list, some of them allow player/user to choose which one to use.
How is it handled in SFML?
I looked through documentation, but haven't found anything about it.
Google did not help too, probably because I don't know how to phrase my question properly.
Related
I've been looking into ways to programmatically manage my monitors using C++.
It looks like functions like EnumDisplayDevices, EnumDisplaySettings and ChangeDisplaySettings can be used to, e.g., change the resolution of individual display devices and attaching/detaching said devices to/from the desktop.
In addition to these operations, I want to be able to duplicate my desktop to multiple monitors.
A concrete example would be to go from this setup where the desktop spans two devices...
...to this setup, where the desktop is instead duplicated to said devices.
I have tried investigating the APIs on MSDN, and looking for similar questions, but cannot seem to find any indication as to whether or not this is possible to do.
Is it possible to use C++ to duplicate my desktop to multiple display devices, and if so, how? If not, is it then possible to do it some other way, e.g. using another programming language, or am I forced to use options like the Windows Control Panel to change such settings?
SetDisplayConfig and DISPLAYCONFIG_TOPOLOGY_CLONE
Here's a PAQ w/code using this function to switch to extended mode.
I'm creating a bukkit plugin that's making a world in Minecraft outside the ordinary and that includes having NPCs (bots) entities that look like actually players and not villagers. I've already got the bots working programming wise but I want to have each bot have a different skin based upon it's name. Can I do this with maybe a resource pack or something? currently they take the names of Minecraft players with the same name but I'd like to override this.
TL;DR
Can I change the appearance of player entities by name with:
a Resourcepack?
a server side command?
playerConnection.sendPacket?
This is currently not possible without modifications to the client. If you want to, you can use Spoutcraft, but this requires users of the plugin to have the Spoutcraft launcher for the textures to show correctly.
There's no way to do this with the vanilla client, however, short of buying a bunch of Minecraft accounts and assigning them appropriate skins.
You should try out the DisguiseCraft plugin for a quick fix. DisguiseCraft is currently available on the Bukkit website. Do keep in mind that it also requires ProtocolLib to function properly, and you will need to have both installed on your server. You may find a link for ProtocolLib through the DisguiseCraft page. I currently use the two on my server and have had no issues with functionality.
If you would prefer a more direct approach however, since you are coding your own plugin, consider looking over the Lib's Disguises Developer API. Like DisguiseCraft, it too requires ProtocolLib, but the source for Lib's is publicly available and is intended to target developers. Just like DisguiseCraft, you may find a link for ProtocolLib through the Lib's page.
I'm writing a metro app for Windows 8 (C# 5) to act as a power control app allowing the user to enable and disable various devices the computer will likely have. For now, I'm just thinking bluetooth and wireless network adapter. Eventually I'll add other devices, but one step at a time.
The main aspects I'm worried about is reliably finding devices, enabling and disabling them, and querying their state (is the device already enabled?). I need to be able to do any of these on a variety of machines with a variety of different devices, including multiple NIC or Bluetooth hardware setups.
I've looked into devcon on Win7, but I'm worried about reliably discovering the devices. If I grab the wrong devices, who knows what I'll be disabling, not to mention it won't disable what I intend to disable. Also I haven't tried it on Win8 yet and it may not be a portable app, I don't want people to install it and then my app.
WMI is powerful but always a bit intimidating to wander around in without a little guidance. If that's my best bet, I would appreciate some resources.
Command line or .Net library is what I'm hoping for, but I haven't tried this kind of stuff before so I'm open to any other alternatives. Also, any foresight into working with other devices like cellular network cards or devices I haven't thought of yet would be great.
Much of what you want (eg Bluetooth APIs) are indeed sandboxed away from Metro apps. There are some substitutes in the Windows namespace, though whether they will meet your needs I don't know. Take a look at http://msdn.microsoft.com/en-us/library/windows/apps/hh464945 which has links to the suggested alternatives for working with devices.
Specifically the Windows.Devices.Enumeration namespace says it's about finding devices. However as I read the page it seems like it's more about discovering and less about controlling. I wouldn't be surprised to find you can't control them. But that's where I'd start digging.
What is the best way to scan the local Windows system for attached USB devices using C++? I need to get a list of Vendor and Product IDs to match against the my device's IDs. If there is a way to scan for a specific VID/PID combination, that would be even better. My end goal is to retrieve the virtual COM port Windows has assigned to the device. If there's a way to do all that, it would be fantastic. As always, examples are much appreciated. Thanks.
This is pretty much an MSDN example of what you want:
http://msdn.microsoft.com/en-us/library/ff558728%28VS.85%29.aspx
It seems you'll need the WDK if you want to access this kind of functionality (every MSDN search I can think of suggests this).
I was able to resolve this by querying WMI for the needed information. Basically, I was able to start with Microsoft's example code, modify it a bit, and finally build it into my own class that does what I need.
http://msdn.microsoft.com/en-us/library/aa390423%28v=VS.85%29.aspx
This list of Computer System Hardware Classes was also helpful:
http://msdn.microsoft.com/en-us/library/aa389273%28v=VS.85%29.aspx
I used the WMI Code Creator to preview the results of what looked to be promising classes.
In the end I used the following:
Namespace: root\CIMV2
Class: Win32_SerialPort
Property: PNPDeviceID and DeviceID
What is the best way for, using WinApi, find a given control in a external program window?
For example, I'm trying to change Internet Explorer's url text box. I am having trouble getting programatically the handle to the text box. I know its type is "Edit" but I'd like to avoid having to search through all the child windows for the "Edit" control (that's how I'm currently doing).
Is there any kind of unique identifier for a given control on a window? I tried using "Control ID" but it doesn't seem to be working.
Thanks
When you're delving into the windows of another application that wasn't designed to give you any particular special access to its windows, then you don't really have any simple solution. Functions like FindWindowEx, GetWindow, EnumChildWindows, and the rest are what you have to work with.
However, it's often not a great idea to even do this. Internet Explorer may have certain types of windows in a certain hierarchy in the particular version that you're developing against right now. But those windows and hierarchy may be different in previous versions and could be considerably different in future versions. You have no guarantee about these things.
In some cases, you might do well to investigate if there are alternative and more official ways to control the other program. For instance, Internet Explorer exposes a COM object that can be used for many purposes. Because this is an official interface, you have better guarantees about what previous versions this will be supported on and that it won't break for future versions.
The best way to do it is find it step by step.. E.g. Find the IE window with FindWindow, then find the child of that with FindWindowEx, then find the child of that with FindWindowEx ... until you get down to the textbox.
There is 1 program I can think of that will generate VB code from dragging a icon from the application to any part of any other application.. VB is way old but it'll give you a very good idea how to do it!
It's called API Spy, found under 'Downloadable Applications (Windows Only)' on http://patorjk.com/blog/software/