|
you can find this in Mike Dunn's FAQ.
http://www.codeproject.com/cpp/cppforumfaq.asp
Gaurika Wijeratne. // www.gaurika.com
|
|
|
|
|
How does one make a program with which the user can press an "Imput" button to brows their computer for a certain file, press a "Run" button to run it through another program which then produces an output into a directory they choose by pressing an "Output" button. Sounds simple, but being just a beginner, I just have no clue.
|
|
|
|
|
Use GetOpenFilename() to select a file, use CreateProcess() to run a program (pass the file as a command line argument), and see this article for one way to select a folder.
/ravi
"There is always one more bug..."
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
Hey Guys
I am using closehandle to close a file handle and it returns FALSE so therefore means its failed but when i do get last error it says operation completed successsfully. Any ideas?
Im don't think a later function overwrites the lasterror either since it is only closing a handle. I might be wrong
Peter
|
|
|
|
|
Use GetLastError() and FormatMessage() . If you want, just make your code display the result of GetLastError() and use Error Lookup to see the corresponding message.
Michel
It is a lovely language, but it takes a very long time to say anything in it, because we do not say anything in it, unless it is worth taking a very long time to say, and to listen to.
- TreeBeard
|
|
|
|
|
|
Yeah, and i used it to write to a file with no problems.
I also formated the message and viewed the last error and it says operation completed successfully
Peter
|
|
|
|
|
the following code works great on win98 but on win2000 i get the error
Cannot Delete File: Cannot read from the source file or disk.
The program resides on a network drive and is shared between the 98 and 2000 machine. I have debugged dirname and it is the same on both machines.
thank you for any help.
wsprintf(dirname,"%s\\%s%s",Td.Dest_Dir,GetSubDir(),"\0");
HANDLE hFind = FindFirstFile(dirname,&FindFileData);
if(hFind != INVALID_HANDLE_VALUE && FindFileData.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY){
SHFILEOPSTRUCT shf;
memset(&shf,0,sizeof(shf));
shf.hwnd = selcompany::GetSafeHwnd();
shf.wFunc = FO_DELETE;
shf.pFrom = dirname;
shf.pTo = "\0\0";//NULL;
shf.fFlags = FOF_ALLOWUNDO | FOF_NOCONFIRMATION;
shf.fAnyOperationsAborted = FALSE;
shf.hNameMappings = NULL;
shf.lpszProgressTitle = " ";
if(SHFileOperation(&shf)==0){
//////////////////////clear vars reset window
}
}else{
////////////not valid .....
}
|
|
|
|
|
Forget about it, this anwer was obviously wrong.
shf.lpszProgressTitle = " "; I don't konw if this is the reason of your problem, but I think it should be
shf.lpszProgressTitle = L" ";
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
Do you have WRITE permissions on the share?
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
You cannot sprintf a null character using %s, because "\0" looks the same as "", which is no characters at all. You'll need to put the extra null char there yourself - I usually zero out the entire buffer beforehand so I don't have to worry about finding the exact end of the string and tacking on an extra 0.
--Mike--
Buy me stuff!
Like the Google toolbar? Then check out UltraBar, with more features & customizable search engines!
My really out-of-date homepage
Big fan of Alyson Hannigan and Jamie Salé.
|
|
|
|
|
|
Hi
I am using IActiveDesktop::SetWallpaper to change ative desktop wallpaper.
//--------------------------------------------------------------------------
HRESULT hr;
WCHAR wszWallpaper [MAX_PATH];
IActiveDesktop* pDesktop;
CoInitialize(NULL);
hr = CoCreateInstance (CLSID_ActiveDesktop, NULL, CLSCTX_INPROC_SERVER,
IID_IActiveDesktop, (void**) &pDesktop);
if (SUCCEEDED(hr))
{
mbstowcs(wszWallpaper, strFileName, sizeof wszWallpaper);
hr = pDesktop->SetWallpaper(wszWallpaper, 0);
pDesktop->Release();
}
CoUninitialize();
//---------------------------------------------------------------------------
But it does not work. No error, the old wallpaper simply stays. Does somebody has any idea?
thx
|
|
|
|
|
I think ActiveDesktop works only if it is enabled. Try to set manually a JPEG (not BMP) file as a wallpaper and if it asks you to enable Active Desktop, so that was the problem
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|
ActiveDesktop is enabled.
I tried to change Wallpaper with
SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, strFileName, SPIF_SENDCHANGE).
It changes wallpaper, but only if I choose 'Refresh' from desktop popup menu. If Classic Desktop enabled, this function works perfectly.
|
|
|
|
|
I know the problem.
I forgot to apply changes I made with IActiveDesktop::ApplyChanges.
|
|
|
|
|
Is there a way to use the cast operator L"test" with a CString object like
CString text = "test"; ?
|
|
|
|
|
Be careful about this. Depending on whether you're building for Unicode settings or not, CString s will hold exclusively Unicode (w_char based) or ANSI (char based) strings, but not both at the same time in the same program.
That said, if you want to transform a LPCSTR (const char * ) to a LPWSTR (w_char * ), have a look at the helper macro A2W (valid both in MFC and ATL.)
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
Just be careful with A2W() because it uses the stack for the conversion, so it's very dangerous to use in loops or with large strings. If you use VC7, try to take a look at CA2W(), it uses the heap (if needed), and is safe to use in loops
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
When I create a new dialog class and display it with the DoModal() command, I can't interact with anything else on the screen until I close the dialog. How do I create a dialog that will stay up on the screen and allow me to still access everything else (menus, etc in my actual MDI, SDI application). Similar to the properties dialog in visual studio.
|
|
|
|
|
A Modal dialog locks down the user interface until the user exits the dialog. When you call DoModal, you are creating a Modal dialog.
You want to create a Modeless dialog. You can do this by declaring an instance of your dialog, calling the Create method, then calling the ShowWindow method and setting the dialog to visible.
When you want this dialog to disappear, you can call ShowWindow again to hide the dialog.
Build a man a fire, and he will be warm for a day Light a man on fire, and he will be warm for the rest of his life!
|
|
|
|
|
try to create the dialog object using the create command(supplying the parent handle). This creates a Modalless dialog box
|
|
|
|
|
http://www.codeproject.com/useritems/gettingmodeless.asp
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
I want to add a variable for an edit box. But the only choices are CString, int, long, UINT... is there some way I can have the variable be a float or a double?
|
|
|
|