|
Shog9 wrote:
Yes, this seems to be true... Had to do a test proggy to figure out why.
Another one of those cases where MFC looks far more simple than it is...
Yeah, I had to find out the hard way too, though it was a couple of years ago
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
As Nish pointed out, my original solution does not work. I think there should be a way that it could work, but i haven't figured it out yet; if i do i'll reply again
Otherwise you can do this:
- Make your main dialog the dialog you wish to appear second
- In the main dialog's
OnInitDialog() , create and show the first dialog.
The first dialog will then appear, and when it closes, the main dialog will appear.
--------
all the modern things
have always existed
they've just been waiting
to come out
and multiply
and take over Björk, The Modern Things
|
|
|
|
|
That seems to be a very good idea, since that way you are not breaking the MFC stuff.
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
How can i make a dialog be created but hidden? (modal or modeless does not matter).
I want someting as simple as this: Create a Dialog Mfc application and make it create the dialog hidden (so i put a tray icon) ive tried to put showwindow(SW_HIDE) in lots of events but none work, finally i did sometinhg in OnPaint, put the Dialog still show for a fraction os a second(like a flash, wich is ugly)
Thank you
|
|
|
|
|
To make a modeless dialog hidden, just use SW_HIDE in the ShowWindow call.
Modal dialogs, it is tougher and even the available solutions result in a momentary flash.
Nish
Check out last week's Code Project posting stats presentation from :-
http://www.busterboy.org/codeproject/
Feel free to make your comments.
|
|
|
|
|
In the OnPaint Method
void CRcmmsv1Dlg::OnPaint()
{
ShowWindow(SW_HIDE);
if (IsIconic() {
...
..
}
It would work
|
|
|
|
|
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
|
|
|
|
|