|
Steen Krogsgaard wrote: Damn. Beat me by mere seconds
Maxwell Chen
|
|
|
|
|
MFC: CFileDialog.
Win32: GetOpenFileName, GetSaveFileName
Cheers
Steen.
"To claim that computer games influence children is ridiculous. If Pacman had influenced children born in the 80'ies we would see a lot of youngsters running around in dark rooms eating pills while listening to monotonous music"
|
|
|
|
|
Thanks for all ur support
I am looking for Win32 support.
and i am trying to use GetOpenFileName as suggeted by you all.
The my code snippet is:
<br />
OPENFILENAME ofn; <br />
char szFile[260];<br />
HWND hwnd;<br />
HANDLE hf;<br />
<br />
ZeroMemory(&ofn, sizeof(ofn));<br />
ofn.lStructSize = sizeof(ofn);<br />
ofn.hwndOwner = hwnd;<br />
ofn.lpstrFile = (LPWSTR)szFile;<br />
ofn.lpstrFile[0] = '\0';<br />
<br />
ofn.nMaxFile = sizeof(szFile);<br />
ofn.lpstrFilter = (LPCWSTR)"All\0*.*\0Text\0*.TXT\0";<br />
ofn.nFilterIndex = 1;<br />
ofn.lpstrFileTitle = NULL;<br />
ofn.nMaxFileTitle = 0;<br />
ofn.lpstrInitialDir = NULL;<br />
ofn.Flags = OFN_PATHMUSTEXIST | OFN_FILEMUSTEXIST;<br />
<br />
DWORD err;<br />
if (GetSaveFileName (&ofn)==TRUE) <br />
{<br />
hf = CreateFile(ofn.lpstrFile, GENERIC_READ,0,<br />
(LPSECURITY_ATTRIBUTES) NULL,<br />
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,(HANDLE) NULL);<br />
}<br />
else<br />
err = CommDlgExtendedError();<br />
<br />
But i am returned with err = 0xFFFF .i.e.
CDERR_DIALOGFAILURE: The dialog box could not be created. The common dialog box function's call to the DialogBox function failed. For example, this error occurs if the common dialog box call specifies an invalid window handle.
Please help.
|
|
|
|
|
thanks for all the help.... but i also require the name of the function to open the open directory... like the one that opens when u try to set the directory for any application
|
|
|
|
|
Please check out Davide Calabro's CFileDialogST[^] class. Good luck and keep the good coding!
|
|
|
|
|
You still haven't told us if it's MFC or Win32, but if you just want to pick a directory you can use SHBrowseForFolder. Otherwise the function is actually GetOpenFileName. You can check out msdn[^] for more info
Cheers
Steen.
"Are you gonna check your makeup when you're done whining?" John Simmons, 05/31/2006
|
|
|
|
|
Hi,
I'm pretty new in programming in c++.net, and I was wondering if someone could help me out.
The goal is to control Abobe Acrobat so that it displays a pdf file in my own c++.NET application. I have found an example in the Acrobat SDK called ActiveView which is exactly what I want to achieve, but I have really no idea how it works.
Can anybody give me an explination of how it works, or how to make a start?
thanx!
Bas
|
|
|
|
|
Hello
I have a question ?
What is the advantage of writing ASSERT instead of VERIFYS ?
As far as I understood, there is no need of using ASSERT, as you can use VERIFY, because it works both in Debug and Release builds and ASSERT does not work in debug builds
Correct me if I am wrong.
Thank you
PS. I have written VERIFY(0) in my program(OnInitDialog) and built in Release mode, but it did not halt my program ?? why
-- modified at 5:59 Friday 2nd June, 2006
|
|
|
|
|
big_denny_200 wrote: As far as I understood, there is no need of using ASSERT, as you can use VERIFY, because it works both in Debug and Release builds and ASSERT does not work in debug builds
the answer is there in your question.
If u use VERIFY in ur project u may need to delete all assert statement which u have used for debuggin purpose. So if there is only debugging purpose, use ASSERT and if something "should not" occur in your program at any cost use VERIFY.
SaRath.
"Don't Do Different things... Do Things Differently..."
|
|
|
|
|
big_denny_200 wrote: As far as I understood, there is no need of using ASSERT
ASSERT or _assert is for developers to make sure there nothing wrong during the development. When he/she is sure that everything is just fine, he/she compiles it in release build. ASSERT is defined as "nothing" in release build.
Maxwell Chen
|
|
|
|
|
In release versions ASSERT evaluates to nothing. This means the statements given inside ASSERT are not executed. This could be trouble sometimes when you write statements like...
int i;
ASSERT( (i=GetI()) != 0 ); This statement won't execute in Release versions but will work fine in debug builds. In Release builds all statements depending on the value of 'i' will fail as the code expands to nothing.
In such cases use VERIFY . Which executes in both versions. But will only show an alert box in the debug versions.
int i;
VERIFY( (i=GetI()) != 0 );
Nibu thomas
A Developer
Programming tips[^] My site[^]
|
|
|
|
|
|
hi
i have write the code for that button on a form but whenever i call
it in menu then the button is not responding and i have also made
some member variable's for the combo box and initialize it in OnInitDialog() but these are also not show messege whenever call the form. and
I get this error only in this form of my project.
mailing me
Yogi
|
|
|
|
|
Few things you can try
1. Check for ON_BN_CLICKED(IDC_BTN_..., FuntionName)
is present in your messagemap BEGIN_MESSAGE_MAP
2. Check the ID of the dialog say IDD_DLG...
and the statement enum { IDD = IDD_DLG... }; in your dialogclass.
3. Check the value of ID of dialog IDD_DLG... in resource.h
check there that the ID contain uniqe value. and also other control id
that are making trouble contain unique value in resource.h
Regards
Anil
|
|
|
|
|
Hi All,
Can anyone tell me how to override the default implementation of windows's "Create Shortcut" menu handler for the context menu of "My Namespace Extension" icon?
Thanks and Regards,
Anil
|
|
|
|
|
http://www.codeproject.com/shell/shellextguide1.asp
http://www.codeproject.com/shell/shellextguide2.asp
http://www.codeproject.com/shell/shellextguide3.asp
http://www.codeproject.com/shell/shellextguide4.asp
http://www.codeproject.com/shell/shellextguide5.asp
http://www.codeproject.com/shell/shellextguide6.asp
http://www.codeproject.com/shell/shellextguide7.asp
this might help u
SaRath.
"Don't Do Different things... Do Things Differently..."
|
|
|
|
|
How can I create a menu with right-aligned shortcuts? I mean a menu that looks as follows:
-----------------
Search
-----------------
Find Ctrl+F
Find Next F3 <-- right-aligned
Because a standard menu looks like this:
-----------------
Search
-----------------
Find Ctrl+F
Find Next F3 <-- left-aligned
|
|
|
|
|
|
I think you missed to put a tab character ("\t") in your menu definition. Menu item strings with shortcuts must look like this: "Find\tCtrl+F", "Find Next\tF3".
|
|
|
|
|
I have *.rc file with
...
MENUITEM "Find\tCtrl+F", IDM_SEARCH_FIND
MENUITEM "FindNext\tF3", IDM_SEARCH_FINDNEXT
...
And the menu looks like this:
|___________________|
|_Find ______Ctrl+F_|
|_Find_Next__F3_____| <-- F3 is left-aligned
But I want the menu to look like this:
|___________________|
|_Find ______Ctrl+F_|
|_Find_Next______F3_| <-- F3 is right-aligned
|
|
|
|
|
It seems that the current implementation of Windows’ built-in menus does not support alignment you requested. Some other custom menu engines support this, for instance one used in C# applications.
In C++, you can try some third-party owner-drawn custom menus. For instance: BCMenu (http://www.codeproject.com/menu/bcmenu.asp[^]), which supports various features. Please see if it is suitable for you. Alternatively search for another one, if you are not going to implement you own menus.
|
|
|
|
|
Message Removed
modified 18-Jul-22 13:58pm.
|
|
|
|
|
whenever I use NetUserInfo() function i get error message "error C2065: 'NetUserGetInfo' : undeclared identifier" how to ues this fucntion in my program.
|
|
|
|
|
did you include Lmaccess.h; include Lm.h;
and import Netapi32.lib
whitesky
|
|
|
|
|
the NetUserGetInfo functions isn't supported under Windows 9x. So please compile your project with the following statements:
#ifndef WINVER // Allow use of features specific to Windows 2000 or later.
#define WINVER 0x0500 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif
#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later.
#define _WIN32_WINNT 0x0500 // Change this to the appropriate value to target Windows 98 and Windows 2000 or later.
#endif
#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 2000 or later.
#define _WIN32_WINDOWS 0x0500 // Change this to the appropriate value to target Windows Me or later.
#endif
#ifndef _WIN32_IE // Allow use of features specific to IE 5.0 or later.
#define _WIN32_IE 0x0500 // Change this to the appropriate value to target IE 5.0 or later.
#endif
|
|
|
|