|
I use SHCreateStreamOnFile stream on the file. Something like this.
if (FAILED(hr = SHCreateStreamOnFile(szTempFile, STGM_CREATE | STGM_WRITE, &pOutFileStream)))
I appreciate your help all the time...
CodingLover
|
|
|
|
|
That stream creation call will be opening the file.
Then you'll need to make sure you call
pOutFileStream->Release ()
at a convenient moment.
Iain.
Codeproject MVP for C++, I can't believe it's for my lounge posts...
|
|
|
|
|
|
I have an application which uses the win API GetShortPathName to get the short path from a long path[read from registry].
The string is terminated with a '\'. Yet the path returned is not a short path. I do not have access to the machine. What could be the reasons for this. Is there any association with the registry key NtfsDisable8dot3.
|
|
|
|
|
Hi,
How to open command prompt for spacific folder?
|
|
|
|
|
I do this by adding a new menu item in the right click menu in windows explorer.
Create the following registry key.
HKEY_CLASSES_ROOT\Folder\shell\Command Prompt\command
Set C:\Windows\System32\Cmd.exe as the Default value.
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Use create process, specify a working folder which will be the starting folder for command prompt...
void OpenCmdInDir( LPCTSTR lpctszDir )
{
STARTUPINFO StrInf = { 0 };
StrInf.cb = sizeof( StrInf );
PROCESS_INFORMATION pi = { 0 };
VERIFY( CreateProcess( NULL, "C:\\Windows\\system32\\cmd.exe", NULL, NULL, FALSE, 0, 0, lpctszDir, &StrInf, &pi ));
CloseHandle( pi.hProcess );
CloseHandle( pi.hThread );
}
OpenCmdInDir( _T( "C:\\Windows\\System32\\Drivers" ));
|
|
|
|
|
I have used createProcess to run a process in a new window using CREATE_NEW_CONSOLE flag,
Can any one help to get the handle to the console that i have created so as to close that window.
code:
CreateProcess(_T("\\windows\\ceplayer.exe"),_T("c:\\folder\\new.wmv"), NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, NULL, &processInfo);
Thanks in Advance
|
|
|
|
|
You can use EnumWindows() or EnumThreadWindows() to enumerate top level windows and GetWindowThreadProcessid() to check if specific window is created by your process (processInfo.dwProceddId)
Slavisa
|
|
|
|
|
Thanks Slavisa,
I tried it. but it does nothing i donno why..
Could u please help me further with my code below:
(I want to close the console that created within 3 seconds but it is not moving into that if part (bold))
CreateProcess(_T("\\windows\\iesample.exe"),imFullPath, NULL, NULL, FALSE, CREATE_NEW_CONSOLE, NULL, NULL, NULL, &processInfo1);
Sleep(3000);
EnumWindows(&EnumProc,processInfo1.dwProcessId);
BOOL CALLBACK EnumProc(HWND hwnd, LPARAM param)
{
DWORD id = GetWindowThreadProcessId(hwnd, NULL);
if (id == (DWORD)param)
{
DestroyWindow(hwnd);
return false;
}
return true;
}
|
|
|
|
|
The return value of GetWindowThreadProcessId is the thread Id and not the process Id.
If you want the process Id, use the second parameter like so.
DWORD dwProcessId = 0;
GetWindowThreadProcessId(hwnd, &dwProcessId);
if (dwProcessId == (DWORD)param)
«_Superman_»
I love work. It gives me something to do between weekends.
|
|
|
|
|
Friens i used
GetWindowThreadProcessId(hwnd, &dwProcessId);
and also PostMessage(hwnd,WM_CLOSE,0);
but it is not moving into that if loop still
if(dwprocessid == DWORD(param))
i could not figure it out what i need to do now or IS there any other way to get the handle of the window
seeking ur help....
|
|
|
|
|
I think it is better to send WM_CLOSE to the window instead of calling DestroyWindow().
Slavisa
|
|
|
|
|
I suspect you've to use EnumThreadWindows [^], passing, as dwThreadId argument, the dwThreadId member of the PROCESS_INFORMATION struct filled by CreateProcess function.
It's just a guess: the test is up to you.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Friens i used
GetWindowThreadProcessId(hwnd, &dwProcessId);
and also PostMessage(hwnd,WM_CLOSE,0);
but it is not moving into that if loop still
if(dwprocessid == DWORD(param))
i could not figure it out what i need to do now or IS there any other way to get the handle of the window
seeking ur help....
|
|
|
|
|
Well, since you just want to close the program you could use TerminateProcess(hProcess, 0);
Slavisa
|
|
|
|
|
I am sorry not exactly i want to close the process slavisa i need to close that window alone and should open the next command line say next.wmv in that place
|
|
|
|
|
A hammer is another option.
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I am sorry i could get what does A hammer is.. could you please throw some light on this area..
|
|
|
|
|
Hammer [^].
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
I am in a serious deputation buddy...
|
|
|
|
|
vijaywithu wrote: I am in a serious deputation buddy...
You are a Member of Parliament?
If the Lord God Almighty had consulted me before embarking upon the Creation, I would have recommended something simpler.
-- Alfonso the Wise, 13th Century King of Castile.
This is going on my arrogant assumptions. You may have a superb reason why I'm completely wrong.
-- Iain Clarke
[My articles]
|
|
|
|
|
Hi,
CString strBuffer("");
int count=1;
count= m_cCombo.GetCurSel();
if(count!=CB_ERR)
{
m_cCombo.GetWindowTextW(strBuffer);
const char* temp=strBuffer;
m_nCount=atoi(temp);
}
|
|
|
|
|
Use LPCTSTR instead of const char* and _ttoi() instead of atoi().
- ns ami -
|
|
|
|
|
USING CONVERSION;
const char* temp=W2A(strBuffer);
|
|
|
|