|
No, it's a Win32 API call. See this[^] usage example.
/ravi
|
|
|
|
|
I assumed you were building a Win32/MFC application. You should have posted your question in the C#[^] forum.
In any case, use the FileName [^] property to obtain the name of the selected file.
/ravi
|
|
|
|
|
So rather than using an OpenFile Dialog, I create an OPENFILE structure and initialize, then call this->GetOpenFileName and this will open a dialog for me, and i can access the path of the file name if OK is clicked through lpstrFile.
Does that sound right?
|
|
|
|
|
Sorry. I just started using Visual Studio this week. I wasn't aware that I was using C# rather than C++. Thanks for all the help
|
|
|
|
|
michmela44 wrote: Is GetOpenFilename() a member function of the openFileDialog?
GetOpenFilename() is a function (belonging to no class). OpenFileDialog is a Java class, and a .NET class.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
What do you need,exactly?
|
|
|
|
|
Have the openfiledialog return a string, and set the picture box picture to that string.
ex: picturebox->image = "c:/mypic.jpeg";
or picturebox->image = mystringfromopendialog;
|
|
|
|
|
Hi all,
Lets say you have a dll. And you where giving an username and a password....
How would one use that username and password to check the authenticity of the windows logon.
Plz, can someone help, cause I'm clueless..
Thanx alot ... in advanced
Regards
Programm3r
|
|
|
|
|
What about LogonUser() ? As long as you aren't too particular, it'll probably get you by. If not, see here.
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
Perhaps you could use LogonUser() [^] (followed by a CloseHandle() , if successful)?
Caveat: This is just an educated guess. There may be a safer and more appropriate way to authenticate a user.
/ravi
|
|
|
|
|
Thanx guys, I'll try that...
Regards
Programm3r
|
|
|
|
|
I have a login dialog box that will need to be placed over two connected monitors.
1)I see in the MFC Library Reference that I can call CWinApp::SetDialogBkColor to set the background color for this dialog, but exactly how is this called? What if I don't have an InitInstance() member function --- do I need to define one?
2)Also, the login dialog must be modal so that access cannot be gained until an ID and PIN are valid. Is there a way to call two objects of the login dialog and have each one placed over each monitor?
3) Can a dialog box be positioned using CWnd::SetWindowPos(.....). If so, how is this accomplished with two monitors?
Thanks for the assistance.
John P.
|
|
|
|
|
Hi John,
jparken wrote: I can call CWinApp::SetDialogBkColor to set the background color for this dialog
As per the MSDN documentation, this function is obsolete. To set the background color of the dialog box, you must handle WM_CTLCOLOR. This message changes the color of the specified dialog box only.
jparken wrote: What if I don't have an InitInstance() member function --- do I need to define one?
This function creating the primary thread (WinMain) for the application. without this function, your application will not be spawned.
jparken wrote: Also, the login dialog must be modal so that access cannot be gained until an ID and PIN are valid. Is there a way to call two objects of the login dialog and have each one placed over each monitor?
i dont know more about this. please refer MSDN for more information. I think it is not a beset practice to show login on two screens.
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Pattern
|
|
|
|
|
Thnaks for the info --- my refernce books are a few years old. This is Microsoft's way of keeping the revenue stream coming in, I guess )
John P.
|
|
|
|
|
It's not happening in C++/Microsoft technologies, but also happens with popular languages like and Java and all.
SaRath.
"Where I am from, there is no plan B. So, take advantage of today becuase tomorrow is not promised. - 50 Cent"
My Blog | Understanding State Pattern
|
|
|
|
|
(1) You can use WM_CTLCOLOR or WM_PAINT
(2) Hope I understood your question See CWnd::DoModal()
(3)for set position from a window see SetWindowPos(..) or MoveWindow(...)
I hope its helful for you
|
|
|
|
|
I need to send a CString into a parameter that is of LPVOID type. I've tried:
CString stuff = _T("...");
LPVOID info = stuff.GetBuffer();
foo ( info );
stuff.ReleaseBuffer();
but the data is lost. How should I go about doing this?
|
|
|
|
|
Try:
foo((LPVOID) ((LPCTSTR) stuff));
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I tried that too, same thing. What I am trying to do is send form data to the wininet SendRequest(LPCTSTR, DWORD, LPVOID, DWORD) function. the LPVOID parameter is the POST data that you send with a HTTP Post header.
|
|
|
|
|
epicyeti wrote: ...same thing.
How are you confirming this?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
what does work is something like this:
CString header = _T("Content-Type: application/x-www-form-urlencoded");
CString m_data = _T("target=wininet");
char data[] = "target=wininet";
LPVOID postdata=data;
pFile->SendRequest(header, header.GetLength(), stuff, mdata.GetLength)
basically i'm sending to the URL www.codeproject.com the data to the search form on the main page. The code above will return an html file with the search results.
The calls to SendRequest() with the double cast and the call to GetBuffer() both return html files that have no search results. I'm inferring from this that no post data got sent.
|
|
|
|
|
epicyeti wrote: what does work is something like this:
So what's the problem then (if you have a working solution)?
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
The problem is that I can't set the char data[] in the last example. I have a CString variable that has the POST data in it, however I can't get the data in CString because it returns a const char*, and I can't set that to the char data[]. I also have no idea what the post data will be, and thus can't hard code it as I did in the working example.
That was me hard coding my test. In the release it can't be hard coded.
Is there a way I could effectively do this:
CString m_data = _T("...");
char data[];
data = m_data.GetBuffer();
|
|
|
|
|
epicyeti wrote: Is there a way I could effectively do this:
CString m_data = _T("...");
char data[];
data = m_data.GetBuffer();
If data actually had a size associated with it:
char data[100];
strcpy(data, m_data); Or:
const char *data = m_data;
"Money talks. When my money starts to talk, I get a bill to shut it up." - Frank
"Judge not by the eye but by the heart." - Native American Proverb
|
|
|
|
|
I finally got it to work.
So the CString::GetBuffer() returns a const wchar_t* not a const char*, I was mistaken. Howerver I could still use the method you suggested:
const wchar_t* data= m_data.GetBuffer();
If I send that into the SendRequest function the wide char data is lost or not converted or something. So I had to convert it to a char*:
const wchar_t* data= m_data.GetBuffer();
m_data.ReleaseBuffer();
char* Cdata;
Cdata = new char[m_data.GetLength()+1];
size_t num=m_data.GetLength();
wcstombs_s(&num, Cdata, num+1, data, num);
LPVOID postdata=Cdata;
This seems sloppy to me, but it gives the correct output when I use postdata in the SendRequest function. Thanks for all your help!
-- modified at 15:42 Tuesday 1st August, 2006
|
|
|
|