|
|
Thanks Mike.... almost got it working
I'm a bit confused on the pidlroot, ITEMIDLIST for specifying the starting directory.
How exactly do I put a null string or a class string with the start path into this function?
TIA
|
|
|
|
|
It's easier to provide a callback function and set the starting dir there. Check out the wrappers classes here at CP, any wrapper worth its salt will have the code to do this, which you can then copy.
--Mike--
Just released - RightClick-Encrypt v1.3 - Adds fast & easy file encryption to Explorer
My really out-of-date homepage
Sonork-100.19012 Acid_Helm
|
|
|
|
|
Hi
you can specify the path in the constructor to the directory. You can then set a flag in the constructor to default to the dirctory you have specified.
CFileDialog( BOOL bOpenFileDialog, LPCTSTR lpszDefExt = NULL, LPCTSTR lpszFileName = NULL, DWORD dwFlags = OFN_HIDEREADONLY | OFN_OVERWRITEPROMPT, LPCTSTR lpszFilter = NULL, CWnd* pParentWnd = NULL );
Parameters
bOpenFileDialog
Set to TRUE to construct a File Open dialog box or FALSE to construct a File Save As dialog box.
lpszDefExt
The default filename extension. If the user does not include an extension in the Filename edit box, the extension specified by lpszDefExt is automatically appended to the filename. If this parameter is NULL, no file extension is appended.
lpszFileName
The initial filename that appears in the filename edit box. If NULL, no filename initially appears.
dwFlags
A combination of one or more flags that allow you to customize the dialog box. For a description of these flags, see theOPENFILENAME structure in the Win32 SDK documentation. If you modify the m_ofn.Flags structure member, use a bitwise-OR operator in your changes to keep the default behavior intact.
lpszFilter
A series of string pairs that specify filters you can apply to the file. If you specify file filters, only selected files will appear in the Files list box. See the Remarks section for more information on how to work with file filters.
pParentWnd
A pointer to the file dialog-box object’s parent or owner window.
Remarks
Call this function to construct a standard Windows file dialog box-object. Either a File Open or File Save As dialog box is constructed, depending on the value of bOpenFileDialog.
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.
To allow the user to resize an Explorer-style dialog box using either the mouse or keyboard, set the OFN_ENABLESIZING flag. Setting this flag is necessary only if you provide a hook procedure or custom template. The flag works only with an Explorer-style dialog box; old-style dialog boxes do not permit resizing.
The lpszFilter parameter is used to determine the type of filename a file must have to be displayed in the file list box. The first string in the string pair describes the filter; the second string indicates the file extension to use. Multiple extensions may be specified using ‘;’ as the delimiter. The string ends with two ‘|’ characters, followed by a NULL character. You can also use a CString object for this parameter.
For example, Microsoft Excel permits users to open files with extensions .XLC (chart) or .XLS (worksheet), among others. The filter for Excel could be written as:
I will send you an example tomorrow when I return to work.
Hope this helps
Des Mardle
|
|
|
|
|
Hears a constructor I use to specify a directory and a file type
CFreqInfoFile pFreqInfoFile(FALSE,"fqu","c:\\frequency data\\*.fqu", N_EXPLORER | OFN_OVERWRITEPROMPT,"Freq Data(.fqu)",pParent);
pFreqInfoFile.DoModal(); // to display dialog box
Des Mardle
|
|
|
|
|
Thank-you for all of your help, Des
|
|
|
|
|
Guys:
How will the NT-TaskManager gets the "Mem Usage" bytes? Is there any API(s) for that?
thanks
|
|
|
|
|
|
** NOTE: im working in Visual Studio .NET **
im having two problems relating to templates and the __declspec(dllexport) keywords or directives or whatever you call em
Problem 1
im using std::vector<int> in combination with __declspec(dllexport) when im making an exported class that uses the vector in a DLL project
my code:
struct __declspec(dllexport) MyStruct
{
int a, b;
};
extern template class __declspec(dllexport) std::vector<MyStruct>;
class __declspec(dllexport) MyClass
{
private:
std::vector<MyStruct> m_vec;
public:
}
when i try to compile, i get a warning:
c:\Program Files\Microsoft Visual Studio .NET\Vc7\include\vector(35) : warning C4251: 'std::_Vector_val<_Ty,_Alloc>::_Alval' : class 'std::allocator<_Ty>' needs to have dll-interface to be used by clients of class 'std::_Vector_val<_Ty,_Alloc>'
with
[
_Ty=MyStruct,
_Alloc=std::allocator<MyStruct>
]
and
[
_Ty=MyStruct
]
and
[
_Ty=MyStruct,
_Alloc=std::allocator<MyStruct>
]
C:\CPP\Test.h(9) : see reference to class template instantiation 'std::vector<_Ty,_Ax>' being compiled
with
[
_Ty=MyStruct,
_Ax=std::allocator<MyStruct>
]
can someone tell me why the hell that happens if i already used __declspec(dllexport)???
Problem 2
my second problem is an error, not a warning. (to me, warnings are just as bad as errors)
i declare an exported template function like so:
template <class T> __declspec(dllexport) void MyFunction(T tData);
and when i use it, i get an unresolved external!
any ideas?
- Roman -
|
|
|
|
|
Problem 1: The message seems rather indicative. Try exporting the allocator as well, with something like:
extern template class __declspec(dllexport) std::allocator<MyStruct>; prior to instantiating the vector.
Problem 2: You need to instantiate MyFunction for the types you're interested in. Not sure about the syntax, but I guess it'll be something like:
template void MyFunction(int);
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
thanks! i nailed down problem 2, but even with the allocator, the first problem is still bitching
- Roman -
|
|
|
|
|
oh wait, it worked for problem 1 also
THANKS!
- Roman -
|
|
|
|
|
I'm trying to use the CSMTPConn class in VS.Net but I get compile errors because of this:
CArray<csmtpaddress,csmtpaddress&> m_ToRecipients;
m:\apps\Utils\CSMTPConn\Smtp.h(147): error C2143: syntax error : missing ';' before '<'
What is happening??? I havent't changed the code at all!!!
---------------
http://www.edovia.com
|
|
|
|
|
never mind, i was just missing some includes...
---------------
http://www.edovia.com
|
|
|
|
|
Using the standard Win API how does one toggle between a window being Visible or Invisible? For example, how would one show/hide a button? Please include an example.
Thanks,
Clint
|
|
|
|
|
hide it:
::ShowWindow( hwnd, SW_HIDE );
show it:
::ShowWindow( hwnd, SW_SHOW );
|
|
|
|
|
When MSDN specifies that an API call is "NT Only", like WH_MOUSE_LL, does that include / exclude Win 2000 and XP... which are based on the NT architecture.
I need to use the WH_MOUSE_LL mouse hook, but it is an undeclared identifier even after including the neccesary includes: winuser.h & windows.h.
Is this because I'm developing on a Win2K machine? Or have I missed something else?
-serp13
|
|
|
|
|
It's supported on Windows NT 4.0 Service Pack 3 and greater. This includes 2K and XP, but in order to build a project you'll needed updated headers and includes.
MSDN says the version of winuser.h that ships with VC++ 5 doesn't have it, and I don't know about VC++ 6 off the top of my head. Either way, download or order a copy of the Platform SDK and install it to get newer versions of the headers.
Jeremy Falcon
Imputek
|
|
|
|
|
try adding the following to your code (before including windows.h and winuser.h)
#define _WIN32_WINNT 0x0500
I needed it for the function InitializeCriticalSectionAndSpinCount()
|
|
|
|
|
Since "Windows 2000" and "Windows XP" are just marketdroid names for NT5 and NT5.1, of course they are included in "NT only" stuff.
|
|
|
|
|
I have a dialog that runs on a timer to update the buttons (used like lights). The timer runs, the button values are updated, but they don't actually happen until I press them or pull a window over the top and then move it. I've tried the UpdataData() functions in different places but that doesn't work.
Any ideas?
Thanks!
|
|
|
|
|
Try with RedrawWindow .
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
I tried this and it does update, but it flickers like mad
|
|
|
|
|
|
Thanks for your help. I will give these a try...next week. I'm off to Tampa in a few minutes.
Thanks again!
|
|
|
|