Click here to Skip to main content
15,919,749 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
GeneralRe: help needed SafeArrayAccessData Pin
Tareq Ahmed Siraj9-Mar-05 19:40
Tareq Ahmed Siraj9-Mar-05 19:40 
QuestionHow to Transfer the image Captured using Screen Capture Code to other machine Pin
karmegakumar9-Mar-05 18:13
karmegakumar9-Mar-05 18:13 
AnswerRe: How to Transfer the image Captured using Screen Capture Code to other machine Pin
spinoza16-May-05 21:42
spinoza16-May-05 21:42 
GeneralMemory Problems with new, delete and CObArray Pin
NeoHobbit9-Mar-05 16:54
NeoHobbit9-Mar-05 16:54 
GeneralRe: Memory Problems with new, delete and CObArray Pin
Christian Graus9-Mar-05 17:05
protectorChristian Graus9-Mar-05 17:05 
GeneralRe: Memory Problems with new, delete and CObArray Pin
NeoHobbit9-Mar-05 17:14
NeoHobbit9-Mar-05 17:14 
GeneralGetOpenFileName in a service Pin
TheGreatAndPowerfulOz9-Mar-05 14:48
TheGreatAndPowerfulOz9-Mar-05 14:48 
GeneralRe: GetOpenFileName in a service Pin
TheGreatAndPowerfulOz9-Mar-05 14:52
TheGreatAndPowerfulOz9-Mar-05 14:52 
After some research, I answered my own question:

OPENFILENAME op;
ZeroMemory(&op, sizeof(op));

op.lStructSize = sizeof(op);
op.hwndOwner = m_hWnd;
op.lpstrFilter = L"JavaScript Files (*.js)\0*.js\0VBScript Files (*.vbs)\0*.vbs\0All Files (*.*)\0*.*\0\0\0";
op.lpstrFile = m_wsFilePathBuf;
op.nMaxFile = cPathSize;
op.lpstrFileTitle = m_wsFileNameBuf;
op.nMaxFileTitle = cNameSize;
op.lpstrTitle = title.Length() ? title : L"Product Name Title";
op.Flags = OFN_DONTADDTORECENT | OFN_FILEMUSTEXIST | OFN_PATHMUSTEXIST | OFN_ENABLESIZING | OFN_EXPLORER | OFN_HIDEREADONLY;

bool impersonated = false;
DWORD processID;
if (ProcessIsRunning(L"someuserprocess.exe", processID))
{
HANDLE processHandle;
HANDLE token = 0, duptoken = 0;
BOOL result;
DWORD size = 0;
processHandle = ::OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_DUP_HANDLE, FALSE,processID);
result = ::OpenProcessToken(processHandle, TOKEN_QUERY | TOKEN_IMPERSONATE | TOKEN_DUPLICATE, &token);
result = result ? ::DuplicateToken(token, SecurityImpersonation, &duptoken) : FALSE;
impersonated = (result ? ::ImpersonateLoggedOnUser(duptoken) : FALSE) == TRUE;
}
BOOL result = GetOpenFileName(&op);
if (impersonated)
{
RevertToSelf();
impersonated = false;
}

GeneralRe: GetOpenFileName in a service Pin
xxrl9-Mar-05 17:06
xxrl9-Mar-05 17:06 
GeneralRe: GetOpenFileName in a service Pin
Ryan Binns9-Mar-05 17:28
Ryan Binns9-Mar-05 17:28 
GeneralRe: GetOpenFileName in a service Pin
TheGreatAndPowerfulOz10-Mar-05 10:23
TheGreatAndPowerfulOz10-Mar-05 10:23 
Generalget exe path Pin
Marcus Spitzmiller9-Mar-05 14:07
Marcus Spitzmiller9-Mar-05 14:07 
GeneralRe: get exe path Pin
Christian Graus9-Mar-05 14:47
protectorChristian Graus9-Mar-05 14:47 
GeneralRe: get exe path Pin
Marcus Spitzmiller9-Mar-05 14:59
Marcus Spitzmiller9-Mar-05 14:59 
GeneralRe: get exe path Pin
gamitech9-Mar-05 21:13
gamitech9-Mar-05 21:13 
Generalmergesort Pin
Ylis9-Mar-05 9:24
Ylis9-Mar-05 9:24 
Generalhelp me!!! Pin
kookoorikoo9-Mar-05 9:06
kookoorikoo9-Mar-05 9:06 
GeneralRe: help me!!! Pin
Ylis9-Mar-05 9:27
Ylis9-Mar-05 9:27 
GeneralProblem with main MDI Frame window Pin
Anonymous9-Mar-05 8:56
Anonymous9-Mar-05 8:56 
GeneralRe: Problem with main MDI Frame window Pin
Ryan Binns9-Mar-05 17:30
Ryan Binns9-Mar-05 17:30 
GeneralInclude Help Needed Pin
Jeryth9-Mar-05 7:53
Jeryth9-Mar-05 7:53 
GeneralRe: Include Help Needed Pin
David Crow9-Mar-05 8:06
David Crow9-Mar-05 8:06 
GeneralRe: Include Help Needed Pin
Jeryth9-Mar-05 13:12
Jeryth9-Mar-05 13:12 
GeneralRe: Include Help Needed Pin
Steen Krogsgaard9-Mar-05 22:01
Steen Krogsgaard9-Mar-05 22:01 
GeneralRe: Include Help Needed Pin
Jeryth10-Mar-05 1:11
Jeryth10-Mar-05 1:11 

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.