I was intensely curious to know.
Xie Jinghui
Posts
-
Can I do iPhone development with Windows (Visual Studio) -
Problem about RegConnectRegistry [modified]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
-
Problem about RegConnectRegistry [modified]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.
-
Problem about RegConnectRegistry [modified]thank you. ;P in fact , the literal has two backslashes at the beginning.
-
Problem about RegConnectRegistry [modified]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
-
Second worker thread should start after first has finished it task.Thank you, :) I always overlook the details,,, the program will be more efficient,
-
Second worker thread should start after first has finished it task.quite right
-
Second worker thread should start after first has finished it task.//
#include "stdafx.h"#include "iostream"
using namespace std;HANDLE hThread1 = NULL; //worker thread 1
HANDLE hThread2 = NULL; //worker therad 2HANDLE 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;
}
-
how to simultaneously show 2 dialogsGood advice, en,, I prefer to use pointer..
-
how to simultaneously show 2 dialogsdefine 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