Good article arrangement

Source: Internet
Author: User

1.

About # pragma warning

Http://dev.csdn.net/article/66/66106.shtm

2.

InstallShield usage:

Http://www.cnblogs.com/Cindy_weiwei/archive/2009/05/19/1460230.html

3.

Ntdll. dll): 0xc0000005: access violation problem:

 

 

A ------- it was found that the new operator was called during internal debugging.

I don't understand, in the DLL call new operator will have such a problem, search on the network, in the Microsoft msdn Forum (specific address: http://forums.msdn.microsoft.com/zh-CN/vclanguage/thread/951a04be-6b52-4617-b396-9c35e3755759/) to find related issues.

 

Then, according to the instructions, change the DLL generation method to "shared MFC mode"

Project properties-> General-> Project defaults-> Use of MFC

To set the properties "use MFC in a shared DLL"

In addition, I also found another article on the Internet, for console, solution: use C Runtime

Dynamic Link version of Library (set to ignore all default link libraries in your console project, and then link to msvcrt. Lib) (Address: http://www.poptool.net/software/p606/A60674501.shtml)

B ------ this problem occurs generally because the pointer is not initialized and other access violations occur. The error is described as follows:

Description: After the VC program adds the edit space (or other controls) and corresponding variables to the window (they are all added through the Class Wizard and are not considered a factor), compilation and connection can pass normally, however, 0xc0000005: Access

Violation error. After tracking and debugging, it is found that when the program runs in C ***** app: m_pmainwnd = in initinstance (),

An error occurs during the & DLG; statement.

Solution: Re-rebuilt all (re-build all) to re-compile.

4.

Crash address program debugging

Http://blog.csdn.net/guo_wei/archive/2007/09/29/1805978.aspx

5.

Memory Pool

Http://www.codeproject.com/KB/cpp/MemoryPool.aspx

 

6. Overlapping Io operations:

Http://hi.baidu.com/soulshape/blog/item/5ba8eec80034d91e7e3e6f7a.html

// Overlapped. cpp: defines the entry point of the console application. <Br/> // <br/> # include "stdafx. H "<br/> # pragma comment (Lib," ws2_32.lib ") <br/> # include <winsock2.h> <br/> # include <stdio. h> <br/> # define data_bufsize 1024 // size of the receiving buffer <br/> socket listensocket, <br/> acceptsocket [data_bufsize] = {0 }; <br/> wsabuf databuf [data_bufsize]; <br/> wsaoverlapped overlapped [data_bufsize]; // overlapping structure <br/> wsaevent eventarray [wsa_maximum_wait_events]; // event handle array used to notify the completion of overlapping operations <br/> DWORD Dwrecvbytes = 0, // The length of the received characters <br/> flags = 0; // wsarecv parameter <br/> DWORD volatile dweventtotal = 0; // total number of events in the Program <br/> // due to the limited number of events, up to 64 connections are currently supported <br/> DWORD winapi acceptthread (lpvoid lpparameter) <br/>{< br/> wsadata; <br/> wsastartup (makeword (2, 2), & wsadata); <br/> listensocket = wsasocket (af_inet, sock_stream, ipproto_tcp, null, null, wsa_flag_overlapped); <br/> sockaddr_in serveraddr; <br/> serverad Dr. sin_family = af_inet; <br/> serveraddr. sin_addr.s_un.s_addr = htonl (inaddr_any); <br/> serveraddr. sin_port = htons (1234); <br/> BIND (listensocket, (lpsockaddr) & serveraddr, sizeof (serveraddr); <br/> listen (listensocket, 100 ); <br/> printf ("listenning... /n "); <br/> int I = 0; <br/> sockaddr_in clientaddr; <br/> int addr_length = sizeof (clientaddr ); <br/> while (true) <br/> {<br/> while (acceptsocket [I] = 0 )& & (Acceptsocket [I] = accept (listensocket, (sockaddr *) & clientaddr, & addr_length ))! = Invalid_socket) <br/>{< br/> printf ("Accept % d IP: % s port: % d/N", I + 1, inet_ntoa (clientaddr. sin_addr), clientaddr. sin_port); <br/> eventarray [I] = wsacreateevent (); <br/> dweventtotal ++; <br/> memset (& overlapped [I], 0, sizeof (wsaoverlapped); <br/> overlapped [I]. hevent = eventarray [I]; <br/> char * buffer = new char [data_bufsize]; <br/> memset (buffer, 0, data_bufsize ); <br/> databuf [I]. buf = buffer; <br/> databuf [I]. len = data_bufsize; <br/> If (wsarecv (acceptsocket [I], & databuf [I], dweventtotal, & dwrecvbytes, & flags, & overlapped [I], null) = socket_error) <br/>{< br/> int err = wsagetlasterror (); <br/> If (wsagetlasterror ()! = Wsa_io_pending) <br/>{< br/> printf ("Disconnect: % d/N", I + 1); <br/> closesocket (acceptsocket [I]); <br/> acceptsocket [I] = 0; <br/> // wsacloseevent (eventarray [I]); // close the event <br/> databuf [I]. buf = NULL; <br/> databuf [I]. len = NULL; <br/> continue; <br/>}< br/> I = (I + 1) % wsa_maximum_wait_events; <br/>}< br/> return false; <br/>}< br/> DWORD winapi appsethread (lpvoid lpparameter) <br/>{< br/> dwor D dwindex = 0; <br/> while (true) <br/> {<br/> dwindex = wsawaitformultipleevents (dweventtotal, eventarray, false, 1000, false ); <br/> If (dwindex = wsa_wait_failed | dwindex = wsa_wait_timeout) <br/> continue; <br/> dwindex = dwindex-wsa_wait_event_0; <br/> wsaresetevent (eventarray [dwindex]); <br/> DWORD dwbytestransferred; <br/> wsagetoverlappedresult (acceptsocket [dwindex], & overlapped [dwindex], Dwbytestransferred, false, & flags); <br/> // first check whethre peer has closed the connection, and if so, close the socket. <br/> If (dwbytestransferred = 0) <br/> {<br/> printf ("Disconnect: % d/N", dwindex + 1 ); <br/> closesocket (acceptsocket [dwindex]); <br/> acceptsocket [dwindex] = 0; <br/> wsacloseevent (eventarray [dwindex-wsa_wait_event_0]); // close the event <br/> databuf [dwindex]. buf = NULL; <br/> databuf [dwind Ex]. len = NULL; <br/> continue; <br/>}< br/> // use data <br/> printf ("% s/n ", databuf [dwindex]. buf); <br/> memset (databuf [dwindex]. buf, 0, data_bufsize); <br/> If (wsarecv (acceptsocket [dwindex], & databuf [dwindex], dweventtotal, & dwrecvbytes, & flags, & overlapped [dwindex], null) = socket_error) <br/>{< br/> If (wsagetlasterror ()! = Wsa_io_pending) <br/>{< br/> printf ("Disconnect: % d/N", dwindex + 1); <br/> closesocket (acceptsocket [dwindex]); <br/> acceptsocket [dwindex] = 0; <br/> // wsacloseevent (eventarray [dwindex]); // close the event <br/> databuf [dwindex]. buf = NULL; <br/> databuf [dwindex]. len = NULL; <br/> continue; <br/>}< br/> return false; <br/>}< br/> void main () <br/>{< br/> handle hthreads [2]; <br/> hthreads [0] = createthread (null, 0, acceptthread, null); <br/> hthreads [1] = createthread (null, 0, deleethread, null); <br/> waitformultipleobjects (2, hthreads, true, infinite); <br/> printf ("Exit/N "); <br/> closehandle (hthreads [0]); <br/> closehandle (hthreads [1]); <br/>}< br/> 

7.

 

 

 

Contact Us

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.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.