Windows Socket API Programming Examples
Has 408 reading 2010-05-19 13:50
fromFind a simple demo on the Internet:First look at the server-side program:#include #include using namespace Std;#define Port_server 6666//Custom Port 6666#define Num_clients 10#pragma comment (lib, "Ws2_32.lib")int main (int argc, char* argv[]){cout Wsadata Wsadata;WORD sockversion = Makeword (2, 0);if (0!= WSAStartup (sockversion
typedef struct _SYSTEM_POWER_STATUS { BYTE ACLineStatus; BYTE BatteryFlag; BYTE BatteryLifePercent; BYTE Reserved1; DWORD BatteryLifeTime; DWORD BatteryFullLifeTime;} SYSTEM_POWER_STATUS, *LPSYSTEM_POWER_STATUS; SYSTEM_POWER_STATUS sysPower = {0}; GetSystemPowerStatus(sysPower);"Note" This API can only read a piece of battery power information, corresponding to the Windows device multiple battery informatio
In the previous article, I briefly explained the differences between NTFS file sharing and FAT32 file sharing in Windows XP. In the second half, I will not talk nonsense, directly paste the key code that sets the read and write permissions for file sharing.
First, set the folder as the shared code:
Code highlighting produced by Actipro CodeHighlighter (freeware)http://www.CodeHighlighter.com/-->// Set a folder for net share
NET_API_STATUS AddNetShare
Windows API one-day training (75) systemparametersinfo Function
In the face of the gorgeous windows desktop, I may feel a lot better at work, but I will always lose interest after a long time, and I always want to update the desktop images on a regular basis. How do software developers need to meet such requirements? Try to find the
Run ASP. NET Core Web API application in docker (with AWS Windows Server 2016 widt Container case), dockerawsEnvironment preparation
1. Amazon EC2 Windows Server 2016 with Container
2. Visual Studio 2015 Enterprise (Update required for Profresianal)
3.. NET Core 1.0.0-VS 2015 Tooling Preview 2. Click here to install
4. Microsoft. NET Core SDK, which can be downlo
Environment preparation1. Amazon EC2 Windows Server with Container2. Visual Studio Enterprise (profresianal to install update 3)3.. NET Core 1.0.0–vs Tooling Preview 2. Please click here to install4. Microsoft. NET Core SDK, can download and install to Microsoft Official websiteExperimental stepsFirst, Docker environment preparationAmazon EC2 Windows Server with container has built-in Docker, as follows:Cli
Windows API one-day training (73) getversionex Function
Windows development is still very fast, from Win95 to Win98, to Win2000 and XP systems. Each system has different functions. to distinguish different systems in a program, you need to obtain the system version information. For example, there is a firewall in XP, but not in other previous systems. However, s
Windows has two mainstreamProgramInstallation Technology: Compile the setup.exe file, read the INF configuration file during program installation, release the files stored in the cab file to the specified location, and set the environment. The second method is to use the Windows Installer Service to create an MSI file. The Windows Service reads the configuration
Ii. Heap Management
The memory allocated by the user's memory allocation function is in the heap. Therefore, using the heap management function to allocate and release the memory is the most direct method.
In Windows, each process has its own heap, and the number of heap processes varies.In Windows, the so-called heap is not a memory block, but an object used for memory management and a memory
information stored in the database includes the services installed by the system, each service includes how to start each service, the security attributes of each service, and control interfaces.
The functions provided by SCM are used to design service programs, service configuration programs, and service control programs.
3. A service program is an executable program required to run the service. SCM starts and stops the service by running and terminating the service program.
4. S
, IntPtr.Zero, "Tpanel", "Print Preview");
What I want to say is: Parameter hwndchildafter can write IntPtr.Zero,lpszclass and Lpszwindow can be null.
I usually use the enumeration method: Enumerate the list of all the handles of this window, and then filter the list to get the desired handle. On the code:[DllImport ("user32.dll", ExactSpelling = True)]public static extern bool Enumchildwindows (IntPtr hwndparent, Enumwindowsproc lpenumfunc, int lParam); [DllImport ("User32.dll")]public
need to wait for you to unlock first.The workaround is to set the shared lock on the read of the file. Multiple threads can read files at the same time. Do not clog each other. Then set the exclusive lock when you want to write to the file. Add an exclusive lock so that other threads cannot read or write at this time.Windows provides a shared/exclusive lock called Slim to resolve the issue. But then. Slim is only supported in Vista and Windows Server
Windows API one-day training (63) regopenkeyex and regcreatekeyex Functions
Because the computer is often shut down, or applications are often closed, but some parameters need to be saved frequently. For example, when you open a program and set the window size, you want to set the window size to the size of the previous window. In this way, you need to save the size of the window. What about the window siz
Qt sends messages to Win32 very easily, but it is very complicated to obtain Windows messages. Finally, I thought of a method that is not perfect, but it is also the only way that I can achieve it now, the basic principle is to use VC to compile an mfc dll, which creates a transparent form and uses this DLL to obtain Win32 API messages.
The source code has been tested in vs2010 vs6.0 QT 4.7
Below is an i
hide. To get more error messages, please call GetLastErrorNumber.Note: You can aw_hor_positive or aw_hor_negtve with aw_ver_positve or aw_ver_negativeCombination to activate a window.**********************************************************************}Scroll up from belowProcedure Tform1.formcreate (Sender:tobject);BeginAnimateWindow (Handle, +, Aw_slide + aw_ver_negative);EndGradually fade awayProcedure Tform1.speedbutton4click (Sender:tobject);BeginAnimateWindow (Handle, N, aw_slide + aw_bl
1. Create 1 Azure accounts, log in and create 1 azurestorage, and the lower left manage access will see primary access key and storage account, remember their location, Wait for the configuration to be configured in Web. config.2. Create Web.api project, upload the image code:[HttpPost] public async taskContains two action,postfile and Azureimageurls, which are used to receive a post-file object, which is used to get a URI from Azure back to the client.First, when uploading, you need to set this
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.