|
I have created and displayed a file dialog to select multiple files. But when i select more then four files and hit enter or prell the ok button, the selection is erased and all that is left is the text in the entry box under the listbox. When trying to recover the files selected, the dialog box sends back nothing.
can some one help me pleeeeese
|
|
|
|
|
What flags do you pass to the constructor?
I usually use OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT
Maybe you can post some code?
Cheers,
/Fredrik
Do you Sonork? I do! 100.11430:PhatBoy
|
|
|
|
|
You have to allocate your own buffer for the returned files. The default buffer is too small.
TCHAR MyBuffer[1024];
CFileDialog fdlg;
fdlg.m_ofn.lpstrFile = MyBuffer;
fdlg.m_ofn.nMaxFile = 1024; Look up OPENFILENAME in MSDN.
---
Sonork 100.11743 Chicken Little
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|
|
IMHO, it is easier to use the functions of CFileDialog to retrieve the files.
Then you don't have to worry about buffer sizes.
CString strFileName("");
POSITION pos;
CStringList* strlistFileNames;
CFileDialog FileDlg(
true, // File Open dialog.
"*", // Default file name extension.
NULL, // No initial filename.
OFN_HIDEREADONLY | OFN_ALLOWMULTISELECT,
m_strNameMask + " (" + m_strSuffixMask + ")" + "|" + m_strSuffixMask + "|All Files (*.*)|*.*||"
);
FileDlg.m_ofn.lpstrTitle = "Select files";
pos = FileDlg.GetStartPosition();
while (pos != NULL)
{
strlistFileNames->AddTail(FileDlg.GetNextPathName(pos));
}
Cheers,
/Fredrik
Do you Sonork? I do! 100.11430:PhatBoy
|
|
|
|
|
From MSDN
<quote>
To allow the user to select multiple files, set the OFN_ALLOWMULTISELECT flag before calling DoModal. You need to supply your own filename buffer to accommodate the returned list of multiple filenames. Do this by replacing m_ofn.lpstrFile with a pointer to a buffer you have allocated, after constructing the CFileDialog, but before calling DoModal. Additionally, you must set m_ofn.nMaxFile with the number of characters in the buffer pointed to by m_ofn.lpstrFile.
</quote>
---
Sonork 100.11743 Chicken Little
It may be that your sole purpose in life is simply to serve as a warning to others.
|
|
|
|
|
Can someone point me in the right direction? The only way to access my app is via its tray icon. When Explorer does the nasty, it takes all the icons down with it. How can I detect that it has crashed and that my app needs to reinstall its icon?
I'm using Chris' CSystemTray, and PJ's CInstanceChecker, and Windows 98 (if that helps).
Thanks.
-Jason
nirgle.bitdevil.com
|
|
|
|
|
In Win 2K when explorer crashes [that's rare, very rare] it has the decency to bring back all the icons on the task tray
I guess what the user could do is to run your program again and your program can check for an earlier version using a mutex and then re-add the icon to the tray. You can check for its existence by sending a NIM_MODIFY message and if it fails it means the icon is not there [I hope so]
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
Not true. I have never had an explorer crash in W2K where the task try icons were restored properly.
Best Regards
|
|
|
|
|
Bill Leibold wrote:
Not true. I have never had an explorer crash in W2K where the task try icons were restored properly.
I think that Nish is just lucky enough to have apps on his system that correctly handle that situation (i.e. the "TaskbarCreated" message )!
Peace!
-=- James.
|
|
|
|
|
personally, i'd install a timer, and in the timer proc (attempt to) remove the icon and reinstall it again. doing this every 5 seconds or so won't take much cpu time and should work ok.
Sorry to dissapoint you all with my lack of a witty or poignant signature.
|
|
|
|
|
How about doing it the way that Microsoft recommends...
Look up the "TaskbarCreated" registered message (requires that IE 4.0 or greater is installed). It is sent by Explorer whenever the Taskbar is (re)created, so if Explorer crashes and restarts, your app will get sent the message, and can re-add its icon.
This is the way Services can install an Icon to the Taskbar's Status Area* when someone logs on.
* Calling it a "Tray Icon" is a common mistake.
Peace!
-=- James.
|
|
|
|
|
Thanks for the response; I'm looking into it now. And, what's the best way to crash Explorer (besides using it normally)?
Gotta love testing
-Jason
nirgle.bitdevil.com
|
|
|
|
|
> And, what's the best way to crash Explorer (besides using it normally)?
On NT/Win@K, Task Manager, Processes tab, select Explorer, right-click and select End Process.
On Win9x, CTRL-ALT-DELETE, (while the task list dialog is up, click on the Explorer window (the desktop) a few times for about 5-10 seconds, and select Explorer int the dialog and try to end it. You should get the end task dialog for Explorer.
Peace!
-=- James.
|
|
|
|
|
James R. Twine wrote:
Calling it a "Tray Icon" is a common mistake.
Err, why is that a mistake?
--Mike--
My really out-of-date homepage
He who laughs last, didn't get the punchline and is just laughing so he won't look silly.
Sonork - 100.10414 AcidHelm
Big fan of Alyson Hannigan.
|
|
|
|
|
Michael Dunn wrote:
Err, why is that a mistake?
Because calling the Taskbar Notification Area the/a "Tray" is actually a mistake. Hence, calling a Taskbar Noticification Area Icon a "Tray Icon" is also a mistake.
Sorta like the widely experienced mixup with "COM" being called both "Component Object Model" and "Common Object Model".
Peace!
-=- James.
|
|
|
|
|
assume a windows client 's height and width is yClient,xClient,
what's the relation between the ScrollInfo structure 's member nMin,nMax and
the yClient,xClient;
assume the font's height is ftheight, the client window should contain
yClient/ftheight lines buffer(buffer[yClient/ftheight][]).
if there is already yClient/ftheight LINES buffer displaying in the client area.
when the scroll box is moved , assume member nPos in the ScrollInfo structure
amount to 1, then the buffer[0] will dispear, and the Client Area shows the buffer from the 2nd row in the buffer, and so on.
then if nPos=yClient/ftheight,the the scroll box is showed in bottom of Scroll Shaft?
can anyone explains those concept about usage of ScrollBar?thanks in advance a lot
sorry for my poor english.
one is the other who absorbs the thoughts of others
|
|
|
|
|
There is a simple program (WinAPI only) that creates window and in WM_CREATE handler creates one button with:
HWND hButton = CreateWindowEx(0, WC_BUTTON, _T("Push me: AaBb"),
WS_CHILD | WS_VISIBLE | BS_PUSHBUTTON,
100, 100, 200, 20,
hwnd, NULL, g_hInstance, NULL);
It runs ok with old comctl32.dll
The problem appears when I want to switch to XP interface and create a file named "my_app_name.exe.manifest" with the following content:
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<description>Your application description here.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="X86"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
The button DOES NOT CREATE
GetLastError() returns "invalid window handle". What I am doing wrong?
Best Regards,
Maxim
|
|
|
|
|
I want to override standard conversion operators for fundamental types (like short(), char()), i.e.:
int i = 1234567;
short s;
s = short(i); <- I want to override it
How can I do that?
Thanks
|
|
|
|
|
Why, why, why ?
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
LOL
I was wondering how to reply to that and then decided to forget about it.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|
|
I want to show ASSERT, when we lose some of data.
I.e.
int a = 100000;
short b = a; // now a=-31072
Please, help me.
Przemek.
|
|
|
|
|
I guessed that was what you wanted thinking about it after my post. I don't believe it can be done.
Christian
I have come to clean zee pooollll. - Michael Martin Dec 30, 2001
Sonork ID 100.10002:MeanManOzI live in Bob's HungOut now
|
|
|
|
|
I’m trying to send data to console window using PostMessage with WM_KEYDOWN.
The third and fourth param for postmessage are
WPARAM wParam, // virtual-key code
LPARAM lParam // key data
i.e. PostMessage( hwndDOS, WM_KEYDOWN, ‘K’, 0X10250001 );
Any idea how to translate my array (ascii data such as abcd, <> fg etc ) to third and fourth parameter?
Thanks
|
|
|
|
|
Try this, haven't try it myselft but try you:
<br>::SendMessage(hWnd,WM_KEYDOWN, VK_K, 0);<br>
You have to vrite the virtual key (VK_K) not only K, the compiler doesn't recognize K.
I'm not sure it will work in console window!
A CONSOLE IS NOT A DOS APP!! REMEMBER THAT BUDDY!!
------------------------------
©0d3 ©®4©k3® - That's me!
------------------------------
|
|
|
|
|
I am not sure whether WM_KEYDOWN will work for a console app. You might have to do something else like redirecting STDIN or whatever.
Nish
Sonork ID 100.9786 voidmain
www.busterboy.org
If you don't find me on CP, I'll be at Bob's HungOut
|
|
|
|