|
Hi all,
How can I pass to a string variable the content of an environment variable?
for example
string a;
I want the content of a the value of the environment variable TEMP?
Thanks,
Jayjay
|
|
|
|
|
Does this GetEnvironmentVariable(/*parameters*/) help
Somethings seem HARD to do, until we know how to do them.
_AnShUmAn_
|
|
|
|
|
Thanks Anshuman it works now
|
|
|
|
|
Hi,
I am not sure about data type of environment variable, but if you know the data type, you can use CString variable and format it.
Refer here:CString::Format[^]
What compiler are you using?
Regards,
Suman
--
"Programming is an art that fights back!"
|
|
|
|
|
I have an application which need to start the audio/video settings on a button click. I have written code for that:
************start of code**********************************************
HRESULT hr = CoInitialize(0);
if (FAILED(hr))//CoInitialize failed
return hr;
//Obtain a pointer to the IUccPlatform interface
//by way of the cocreatable UccPlatform class.
CComPtr <IUccPlatform> pIUccPlatform;
hr = CoCreateInstance
(
__uuidof(UccPlatform),
NULL,
CLSCTX_INPROC_SERVER,
__uuidof(IUccPlatform),
(LPVOID *)&pIUccPlatform
);
if (FAILED(hr))
{
AfxMessageBox(IDS_STR_ERROR_COCREATE_INSTANCE);
return hr;
}
CComBSTR bstrAppName = _T("application");
hr = pIUccPlatform->Initialize( bstrAppName);
if (FAILED(hr))
{
AfxMessageBox (IDS_STR_ERROR_INITIALIZE);
return false;
//device settings
}
CComPtr<IUccMediaDeviceSettings> spMediaDeviceSettingsPtr;
pIUccPlatform->QueryInterface( &spMediaDeviceSettingsPtr );
spMediaDeviceSettingsPtr->InvokeTuningWizard((OAHWND)theApp.m_pMainWnd->m_hWnd, UCCTWP_AUDIO | UCCTWP_AUDIO_NONPRIVATE | UCCTWP_AUDIO_NOTIFICATION);
//AfxMessageBox(IDS_STR_ERROR_INVOKE_TUNING_WIZARD);
pIUccPlatform->Shutdown();
*****************End of Code************************
and as I know we have to add the three dlls(UCCAPIRES.dll,UccApi.dll,RTMPLTFM.dll) in application project, I have done that and I also got success in that. But when I run my application on other system after clicking button to start the audio/video settings I got an error message "Error CoCreateInstance ".
If any idea then please share.
Configuration for apllication is
WindowsXp
C++ .net2005
|
|
|
|
|
Hai all,
I need to build the genprint application which is available in ..../Windows DDK../src/print/genprint sample.. application.
Please help me.
|
|
|
|
|
What did you try?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
|
Well, you haven't answered my question. What did you try? Where and what is the problem?
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Realy i don't know how to build. I tried by build using BUILD command in dos
|
|
|
|
|
Hi all,
I am trying to create Program group shortcut both in vista and xp, and then after that i want to delete these shortcut through coding...
How can i do this......
Thanks in advance
|
|
|
|
|
|
Here[^] is the developer's guide for Picasa Web albums Data API, here[^] is the reference and here[^] is the group, where you could discuss with other developers (about specific issues) while developing applications with that very API.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
I'm writing a App to scroll the window which is not foreground with the mouse wheel, And Use the Mouse hook In my code, first i reDirect the message like this:
POINT pt;
::GetCursorPos(&pt);
pMHSEX->MOUSEHOOKSTRUCT.hwnd=::WindowFromPoint(pt);
but this do not take effert so i change the code :
POINT pt;
::GetCursorPos(&pt);
pMHSEX->MOUSEHOOKSTRUCT.hwnd=::WindowFromPoint(pt);
::SendMessage(pMHSEX->MOUSEHOOKSTRUCT.hwnd,WM_MOUSEWHEEL,pMHSEX->mouseData,0);
return TRUE:
this works in many windows (foreground or not foreground with scrollbar inside) when the mouse move on it with the wheel scrolled, these window were all act,but when the mouse move to the IE window with Scrollbar then scroll the mouse wheel it does work
I have searched some article, and some about the window whose class name is "Internet Explorer_Server", and i try to test:
#define ID_IE_ID_ADDFAV 2384
::SendMessage( pMHSEX->MOUSEHOOKSTRUCT.hwnd, WM_COMMAND,MAKEWPARAM(LOWORD(ID_IE_ID_ADDFAV),0x00), 0);
it appear a IE add favorite window, but how do i send a Scroll meesage to this window ?
Can someone help me? Thanks
modified on Tuesday, June 24, 2008 7:14 AM
|
|
|
|
|
I have to get the total count of the files present in a folder.I have to do a file transfer from that folder to another on a button click.Any help?Im using vc++
|
|
|
|
|
try FindFirstFile() and FindNextFile() or its MFC wrapper CFileFind to find the number of files in a folder
If you want to copy the entire contents of folder at once use SHFileOperation or if you want to copy one by one, use CopyFile() .
|
|
|
|
|
Please check my code...
void CMydlgtestDlg::Oncount()
{
int count=0;
CFileFind f;
CString file="D:\\mframes";
if(f.FindFile(LPCTSTR(file)))
{
count++;
f.FindNextFile();
}
AfxMessageBox(count);
|
|
|
|
|
Like this..
int count=0;
CFileFind f;
CString file="D:\\mframes\\*.*";
BOOL bFound = f.FindFile(file);
while( bFound )
{
bFound = f.FindNextFile();
if( !f.IsDirectory())
{
count++;
}
}
modified on Tuesday, June 24, 2008 2:14 AM
|
|
|
|
|
i get a debug assertion failure when the code is run.it is written inside a member function of a button.
|
|
|
|
|
Press the Retry button while debugging and check the call stack to find the assertion location.
|
|
|
|
|
I gave an AfxMessageBox at the end ,it is there the error is displayed..it is just given to display the count;
|
|
|
|
|
You cannot put a int variable directly in a AfxMessageBox() function like in VB.If you want to show the count in message box, modify as follows
CString csCount;
csCount.Format( _T("%d"), count );
AfxMessageBox( csCount );
|
|
|
|
|
Thanks..it worked now...Now how to copy the files?
I have to copy all files from "D:\mframes" to "D:\new"
Have declared both as below.
mframes is declared as such to copy all files in it.
CString file="D:\\mframes\\*.*"; <br />
CString next="D:\\new";
|
|
|
|
|
CFileFind f;
CString file="D:\\mframes\\*.*";
CString next="D:\\new\\";
BOOL bFound = f.FindFile(file);
while( bFound )
{
bFound = f.FindNextFile();
if( !f.IsDirectory())
{
CString csFilePath = f.GetFilePath();
CString csNewPath = next + f.GetFileName();
CopyFile( csFilePath, csNewPath, TRUE );
}
}
|
|
|
|
|
Count is one more than the actual and the fioles are not copied to d:\new.rather they are just copied to d:\
|
|
|
|