Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
H

hanlei0000000009

@hanlei0000000009
About
Posts
84
Topics
57
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • How to modify context of packet in Ndis?
    H hanlei0000000009

    Ndis->passthru is a sample in WDK, passthru can get packet data by MPSendPackets()

    NdisQueryPacket( pPacket,NULL,NULL,NULL,&PacketSize);
    NdisAllocateMemory( &pPacketContent, 2000, 0,HighestAcceptableMax);
    NdisQueryBufferSafe(pPacket->Private.Head, &pBuf, &BufLength, 32 );
    i = BufLength;
    pNext = pPacket->Private.Head;
    for(;;)
    {
    if(pNext == pPacket->Private.Tail)
    break;
    pNext = pNext->Next;

    if(pNext == NULL)   			
    	break;  		  		
    
    NdisQueryBufferSafe(pNext,&pBuf,&BufLength,32);
    NdisMoveMemory(pPacketContent+i,pBuf,BufLength);
    i+=BufLength;  	
    

    }

    DBGPRINT(("(char*)&pPacketContent[54] : %s \n",(char *)&pPacketContent[54]));

    I want to modify data of pPacketContent[55], and remake the packet. Can anyone give me a sample? Thanks!

    System Admin tutorial question

  • How to change color in vs2008 feature pack?
    H hanlei0000000009

    CMFCVisualManagerOffice2007::SetStyle(CMFCVisualManagerOffice2007::Office2007Luna_Blue); this code is set my program's color blue. but I want red or another. How to create a style by myself? How to change the style that vs2008 feature pack? thanks!

    C / C++ / MFC tutorial question

  • Can I use select instead Sleep?
    H hanlei0000000009

    Thanks all. It's looked like I need transplant my project From Windows to Linux or Unix. timeval's member tv_usec is a value in microseconds. It declaration and used in UNIX first. So, I think UNIX, FreeBSD for example can do this as possible.

    C / C++ / MFC help question

  • Can I use select instead Sleep?
    H hanlei0000000009

    I need my program sleep 1 microsecond, but Sleep() can not do this. So, can I use select() instead Sleep() to do this? timeout.tv_sec=0; timeout.tv_usec=1; FD_ZERO(&readfd); ret=select(0,&readfd,NULL,NULL,&timeout); It's have any problem or not?

    C / C++ / MFC help question

  • How to get function name?
    H hanlei0000000009

    Thanks all!

    void fun()
    {
    string str;

    str = ???; //How to get the function("call") name which is call this function?

    cout << str << endl; // I want output "call"
    }

    void call()
    {
    fun();
    }

    modified on Wednesday, February 25, 2009 2:19 AM

    C / C++ / MFC tutorial question

  • How to limit cin to string?
    H hanlei0000000009

    char str[8];
    cin >> str;

    When run, if inputed string size more than eight byte, result run time error. So, how to limit cin >> size or only get eight byte when inputed more than eight? thanks!

    C / C++ / MFC help tutorial question

  • recv after select
    H hanlei0000000009

    timeval timeOut;
    timeOut.tv_sec = 0;
    timeOut.tv_usec = 3000*1000;

    fd_set fdread, fdExcept;
    FD_ZERO(&fdread);
    FD_ZERO(&fdExcept);
    FD_SET(sock,&fdread);
    FD_SET(sock,&fdExcept);

    int iRet = 0;
    iRet = select(0, &fdread, NULL, &fdExcept, &timeOut);

    if(FD_ISSET(sock,&fdread))
    {
    //can read
    int iRecv = recv(sock, strRecv, 512*1024, 0);// extern char strRecv[512*1024]
    /*
    If receive buffer has been received 1024 BYTE, recv() no problem. after recv(), iRecv equals 1024.
    If receive buffer has been received a lot data, 50*1024 for example, recv() has problem.
    strRecv has not got data what is from send() and iRecv not equals 50*1024.
    notes: If no select(), only use recv(), that no problem when recv() 50*1024 BYTE
    */
    }

    C / C++ / MFC help tutorial question

  • How to change the number of bits per pixel of BMP file?
    H hanlei0000000009

    I can load a BMP file into a CBitmap object. The number of bits per pixel of image is 32. How to change the number of bits per pixel to 16?

    C / C++ / MFC tutorial question

  • associate string in dll
    H hanlei0000000009

    my dll code:

    void Init()
    {
    ...
    CreateThread(NULL, 0, Fun, this, 0, &dw);
    ...
    }

    DWORD WINAPI Fun(LPVOID lParam)
    {
    int i = 0;

    while(1)
    {
    CString cstr;
    cstr = "abc"; // all right

    while(i++>10)
    {
    CString cstr2;
    cstr2 = "eee"; // runtime error!
    }
    }

    }

    but if I change while(i++>10) to while(i++>2) CString cstr2 = "eee"; was all right.

    C / C++ / MFC help

  • same name in two DLL
    H hanlei0000000009

    I need load two DLL, a.dll and b.dll. In a.dll has fun() function and b.dll has fun() too. How to distinguish between a.dll/fun() and b.dll/fun().

    C / C++ / MFC tutorial

  • in OnSize()
    H hanlei0000000009

    When dialog initialization, OnSize(UINT nType, int cx, int cy) run times more than one. The cx is Specifies the new width of the client area, but cx is not same in all times. How to get the right cx which is the real size?

    C / C++ / MFC tutorial question

  • How to resize control when screen resolution changed?
    H hanlei0000000009

    A single document project, view class inheritance from CFromView. In view from, have many controls, edit control, static control... When screen resolution changed or project runing from 16 by 10 screen to 4 by 3 screen, controls not printed right what printed right in 16 by 10 screen. I can use GetSystemMetrics(SM_CXFULLSCREEN) and GetSystemMetrics(SM_CYFULLSCREEN) to get screen resolution and then make controls size to fix to current screen,but controls are to many in from. I want to make all controls by simple way.

    C / C++ / MFC oop help tutorial question

  • About CreateProcessAsUser
    H hanlei0000000009

    HANDLE hToken;

    if(!GetTokenByName(hToken,"EXPLORER.EXE"))   
    {   
    	return   FALSE;   
    }   
    
    STARTUPINFO   si;   
    PROCESS\_INFORMATION   pi;   
    
    ZeroMemory(&si,   sizeof(STARTUPINFO));   
    si.cb=   sizeof(STARTUPINFO);   
    si.lpDesktop   =   TEXT("winsta0\\\\default");   
    
    
    BOOL   bResult   =   CreateProcessAsUser(hToken,"D:\\\\1.bat",NULL,NULL,NULL,   FALSE,NORMAL\_PRIORITY\_CLASS,NULL,lpCurrentDir,&si,&pi);  
    

    I use CreateProcessAsUser run 1.bat attach a database to sql server 2000. 1.bat:

    OSQL -E -Q "sp_attach_db @dbname = 'YDJC2', @filename1 = '%CD%\database 08-6-5\YDJC2_Data.MDF', @filename2 = '%CD%\database 08-6-5\YDJC2_Log.LDF'"

    But, this database is read only attribute in sql server 2000, why? I double click mouse button to run 1.bat is OK, database is read/write attribute in sql server 2000. How to use CreateProcessAsUser to solve this problem?

    C / C++ / MFC database sharepoint sql-server sysadmin help

  • How to auto put string into edit control and press button on web page?
    H hanlei0000000009

    thanks. But, google.com only a sample. If web page is an other and if after press a button web page not change to another page? So, I cannot work on all web page by this way.

    C / C++ / MFC c++ com tutorial question

  • How to auto put string into edit control and press button on web page?
    H hanlei0000000009

    I use CWebBrowser2 to open web page:

    CWebBrowser2 m_webBrow2;
    m_webBrow2.Navigate("http://www.google.com",NULL,NULL,NULL,NULL);

    When web page has been opend, I can put "my search" into google's search edit control by keyboard and press search button by mouse. But, how to do these by C++ code? Is CWebBrowser2 have member can do this?

    C / C++ / MFC c++ com tutorial question

  • GetWindowRect problem in CFormView::OnInitialUpdate()
    H hanlei0000000009

    void CMyView::OnInitialUpdate() { CFormView::OnInitialUpdate(); GetParentFrame()->RecalcLayout(); ResizeParentToFit(); RECT rect; GetWindowRect(&rect); // rect.top is 227 } void CMyView::OnBnClickedBtnTest() { RECT rect; GetWindowRect(&rect); // rect.top is 30, why? } After OnInitialUpdate() until I clicked test button(run OnBnClickedBtnTest() ), nothing to do.

    C / C++ / MFC help question

  • How to use OnTimer in modeless Dialog?
    H hanlei0000000009

    // dialog BOOL dlgWait::OnInitDialog(void) { CDialog::OnInitDialog(); SetTimer(1,500, NULL); return TRUE; } void dlgWait::OnTimer(UINT_PTR nIDEvent) { AfxMessageBox("aaaa"); CDialog::OnTimer(nIDEvent); } dlgWait waitDlg; waitDlg.Create(IDD_DLG_WAIT,NULL); waitDlg.ShowWindow(SW_SHOW); // AfxMessageBox("aaaa"); would't display Sleep(10000); /* If change waitDlg.Create(IDD_DLG_WAIT,NULL); waitDlg.ShowWindow(SW_SHOW); to waitDlg.DoModal(); AfxMessageBox("aaaa"); would display */

    C / C++ / MFC tutorial question

  • ADO _RecordsetPtr: how to PutCollect() a NULL value?
    H hanlei0000000009

    These code put a string into name which is a column in database table _RecordsetPtr rec; rec.CreateInstance(_uuidof(Recordset)); CString cstrSQL; cstrSQL.Format("SELECT * FROM ... where ..."); rec->Open(_bstr_t(cstrSQL), (IDispatch*)g_pConnections, adOpenDynamic, adLockOptimistic, adCmdText); rec->PutCollect("name",_variant_t("my name")); rec->Update(); But,how to PutCollect a NULL value into this column?

    C / C++ / MFC database tutorial question announcement

  • How to get appear times between 2 and 5 in a vector?
    H hanlei0000000009

    Thank you! your code is I need.

    C / C++ / MFC graphics tutorial question

  • How to get appear times between 2 and 5 in a vector?
    H hanlei0000000009

    extern vector v; // 1,2,3,4,5,5,5,6,6,7,7,7,7,7,7 I want to get the number list included 5, 6

    C / C++ / MFC graphics tutorial question
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups