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
X

Xie Jinghui

@Xie Jinghui
About
Posts
10
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Can I do iPhone development with Windows (Visual Studio)
    X Xie Jinghui

    I was intensely curious to know.

    The Lounge visual-studio csharp ios

  • Problem about RegConnectRegistry [modified]
    X Xie Jinghui

    NETRESOURCE nr;
    memset(&nr, 0, sizeof(NETRESOURCE));

    nr.dwScope	= RESOURCE\_GLOBALNET;
    nr.dwType	= RESOURCETYPE\_DISK;
    nr.dwDisplayType = RESOURCEDISPLAYTYPE\_SHARE;
    nr.dwUsage	= RESOURCEUSAGE\_CONNECTABLE;
    nr.lpLocalName = "";
    nr.lpRemoteName = szAdminSharePath;	//value is "\\\\\\\\1-f-0-0-0-0-0-1.ipv6-literal.net" 
    					//the IPv6 Address of remote computer is 1:f::1
    nr.lpProvider = NULL;
    
    DWORD dwResult;
    dwResult = WNetAddConnection2(&nr,
    	(LPSTR)(LPCTSTR)m\_strPassword,
    	(LPSTR)(LPCTSTR)m\_strUser,
    	CONNECT\_UPDATE\_PROFILE);	
    

    WNetAddConnection2 succeeded, the return value is NO_ERROR. then, try to connect to remote registry.

    HKEY hkRemoteComputer;
    lResult = ::RegConnectRegistry( 
    		strRmt, 		//value is "\\\\\\\\1-f-0-0-0-0-0-1.ipv6-literal.net"
    		HKEY\_LOCAL\_MACHINE, 	
    		&hkRemoteComputer ) ;
    

    RegConnectRegistry failed. return value is 87

    Windows API help csharp windows-admin json

  • Problem about RegConnectRegistry [modified]
    X Xie Jinghui

    Sorry, i just copy the string from text not from code, i correct the message; I had try again. and I beleive the problem is not the string. thanks for your recommendation.

    Windows API help csharp windows-admin json

  • Problem about RegConnectRegistry [modified]
    X Xie Jinghui

    thank you. ;P in fact , the literal has two backslashes at the beginning.

    Windows API help csharp windows-admin json

  • Problem about RegConnectRegistry [modified]
    X Xie Jinghui

    I want to Establish a connection to a registry key on another computer, use windos API RegConnectRegistry; The program running on windows 2003 ,connect to remote windows xp, over ipv4, work well; The program running on Win7, connect to remote Windows XP, over ipv4, Failed. The program running on Win7, connect to remote Win7, over ipv6, Failed. before calling RegConnectRegistry, the WNetAddConnection2 succeeded; the Remote Registry service is running on the remote computer. the RegConnectRegistry Failed. the return value is 87(ERROR_INVALID_PARAMETERS); I don't know if RegConnectRegistry could work over ipv6, WNetAddConnection2 can. so I pass the parameter lpMachineName the IPv6 literal format string "\\\\2001-4898-9-3-c069-aa97-fe76-2449.ipv6-literal.net" just let it work, thanks for any idea.

    modified on Monday, March 28, 2011 10:42 AM

    Windows API help csharp windows-admin json

  • Second worker thread should start after first has finished it task.
    X Xie Jinghui

    Thank you, :) I always overlook the details,,, the program will be more efficient,

    C / C++ / MFC question help

  • Second worker thread should start after first has finished it task.
    X Xie Jinghui

    quite right

    C / C++ / MFC question help

  • Second worker thread should start after first has finished it task.
    X Xie Jinghui

    //
    #include "stdafx.h"

    #include "iostream"
    using namespace std;

    HANDLE hThread1 = NULL; //worker thread 1
    HANDLE hThread2 = NULL; //worker therad 2

    HANDLE hEvt1 = NULL;

    DWORD __stdcall ThreadProc_1( LPVOID lpParameter )
    {
    // populating the list ...
    for(int i = 0; i<10; i++)
    {
    cout<<"populating the list -- "<<i<<endl;
    }

    // after populate the list , set event, then the worker thread 2 will stop waiting and do operation on the list...
    ::SetEvent(hEvt1);
    
    return 0;
    

    }

    DWORD __stdcall ThreadProc_2( LPVOID lpParameter )
    {
    // wait
    while(::WaitForSingleObject(hEvt1, 5) == WAIT_TIMEOUT)
    {
    //keep waiting ...
    Sleep(5);
    continue;
    }

    // To do operation on that list...
    for(int i = 0; i<10; i++)
    {
    	cout<<"doing operation on that list -- "<<i<<endl;
    }
    
    return 0;
    

    }

    int _tmain(int argc, _TCHAR* argv[])
    {
    hEvt1 = CreateEvent(NULL, TRUE, FALSE, NULL);

    //Create the two worker threads
    hThread1 = CreateThread(NULL, 0, ThreadProc\_1, NULL, 0, NULL);
    hThread2 = CreateThread(NULL, 0, ThreadProc\_2, NULL, 0, NULL);
    
    // waiting , 
    while(::WaitForSingleObject(hThread2, 5) == WAIT\_TIMEOUT)
    {
    	Sleep(5);
    	continue;
    }
    
    if(hThread1)
    	::CloseHandle(hThread1);
    if(hThread2)
    	::CloseHandle(hThread2);
    
    if(hEvt1)
    	::CloseHandle(hEvt1);
    
    return 0;
    

    }

    C / C++ / MFC question help

  • how to simultaneously show 2 dialogs
    X Xie Jinghui

    Good advice, en,, I prefer to use pointer..

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

  • how to simultaneously show 2 dialogs
    X Xie Jinghui

    define dlg2 as a member varibale of CDlg1.

    CDlg2 * m_pDlg2;

    BOOL CDlg1::OnInitDialog()
    {
    // ...
    m_pDlg2 = new CDlg2();
    m_pDlg2->Create(IDD_DIALOG2, this);
    m_pDlg2->ShowWindow(SW_SHOW);
    // ...
    }

    void CDlg1::OnDestroy()
    {
    CDialog::OnDestroy();

    // TODO: Add your message handler code here
    if(m\_pDlg2)
        delete m\_pDlg2;
    m\_pDlg2 = NULL;
    

    }

    modified on Thursday, October 28, 2010 4:17 AM

    C / C++ / MFC c++ 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