Click here to Skip to main content
15,909,897 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
QuestionGDI+ Image.Save Function? Pin
Andy Brace8-Jul-02 9:41
Andy Brace8-Jul-02 9:41 
GeneralExe/Dll Dependancies. Pin
Mike Doner8-Jul-02 9:34
Mike Doner8-Jul-02 9:34 
GeneralRe: Exe/Dll Dependancies. Pin
Oliver Daniel8-Jul-02 10:08
Oliver Daniel8-Jul-02 10:08 
GeneralRe: Exe/Dll Dependancies. Pin
Mike Doner9-Jul-02 9:06
Mike Doner9-Jul-02 9:06 
GeneralRe: Exe/Dll Dependancies. Pin
-Dy10-Jul-02 23:45
-Dy10-Jul-02 23:45 
GeneralRe: Exe/Dll Dependancies. Pin
Mike Doner12-Jul-02 2:59
Mike Doner12-Jul-02 2:59 
GeneralWNetAddConnection2 fails with error code 1312 Pin
alma8-Jul-02 9:24
alma8-Jul-02 9:24 
GeneralRe: WNetAddConnection2 fails with error code 1312 Pin
alma11-Jul-02 1:49
alma11-Jul-02 1:49 
The solution i found is to use the CreateService function with user and password parameters set.
Ex:
--------------------------------------------------------------------------------

CString user = _T(".\\User");
CString pswd = _T("pswd");
LPSTR u = user.GetBuffer(user.GetLength()+1);
LPSTR p = pswd.GetBuffer(pswd.GetLength()+1);

SC_HANDLE hService = ::CreateService(
hSCM, m_szServiceName, m_szServiceName,
SERVICE_ALL_ACCESS, SERVICE_WIN32_OWN_PROCESS,
SERVICE_DEMAND_START, SERVICE_ERROR_NORMAL,
szFilePath, NULL, NULL, _T("RPCSS\0"), u, p);

--------------------------------------------------------------------------------



To create the connection:
--------------------------------------------------------------------------------

NETRESOURCE nr;

char* a = new char[MAX_PATH];
memset(a, 0, MAX_PATH);

char* b = new char[MAX_PATH];
memset(b, 0, MAX_PATH);

strcpy(a, (char*)"\\\\alma\\geza");
strcpy(b,(char*)"x:");

char pswd[20] = "pswd";
char account[20] = "user";


nr.lpRemoteName = a;
nr.lpLocalName = b;
nr.lpProvider = NULL;
nr.dwType = RESOURCETYPE_DISK;

DWORD flags = CONNECT_UPDATE_PROFILE;
DWORD res;

res = WNetAddConnection2(&nr, (char*)pswd, (char*)account, flags);

delete []a;
delete []b;

if (res == NO_ERROR)
return TRUE;
else
return FALSE;

GeneralSTL question - Moving Items around in a list Pin
#realJSOP8-Jul-02 9:13
professional#realJSOP8-Jul-02 9:13 
GeneralRe: STL question - Moving Items around in a list Pin
Chris Losinger8-Jul-02 9:38
professionalChris Losinger8-Jul-02 9:38 
GeneralRe: STL question - Moving Items around in a list Pin
#realJSOP8-Jul-02 9:45
professional#realJSOP8-Jul-02 9:45 
GeneralRe: STL question - Moving Items around in a list Pin
Chris Losinger8-Jul-02 9:53
professionalChris Losinger8-Jul-02 9:53 
GeneralRe: STL question - Moving Items around in a list Pin
Tim Smith8-Jul-02 10:14
Tim Smith8-Jul-02 10:14 
GeneralRe: STL question - Moving Items around in a list Pin
Chris Losinger8-Jul-02 10:16
professionalChris Losinger8-Jul-02 10:16 
GeneralRe: STL question - Moving Items around in a list Pin
#realJSOP9-Jul-02 2:31
professional#realJSOP9-Jul-02 2:31 
GeneralRe: STL question - Moving Items around in a list Pin
jbarton9-Jul-02 5:23
jbarton9-Jul-02 5:23 
GeneralGeting Explorer Drop Target - Help Pin
zarco18-Jul-02 8:43
zarco18-Jul-02 8:43 
GeneralHooking windows Pin
S van Leent8-Jul-02 7:59
S van Leent8-Jul-02 7:59 
GeneralRe: Hooking windows Pin
Oliver Daniel8-Jul-02 10:11
Oliver Daniel8-Jul-02 10:11 
GeneralRe: Hooking windows Pin
S van Leent9-Jul-02 1:43
S van Leent9-Jul-02 1:43 
GeneralWindows XP Socket BUG Pin
8-Jul-02 7:22
suss8-Jul-02 7:22 
GeneralRe: Windows XP Socket BUG Pin
Tim Smith8-Jul-02 10:12
Tim Smith8-Jul-02 10:12 
GeneralScreensaver problem Pin
jancsi8-Jul-02 7:08
jancsi8-Jul-02 7:08 
GeneralRe: Screensaver problem Pin
Gary Kirkham8-Jul-02 7:15
Gary Kirkham8-Jul-02 7:15 
GeneralRe: Screensaver problem Pin
Gary Kirkham8-Jul-02 7:16
Gary Kirkham8-Jul-02 7:16 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.