|
The problem with that sample is that it load the template when it creates the new doc, but what I need is to let the user load in the same window, later another document
m_ctrl = new CXOfficeCntrItem(this,path);
|
|
|
|
|
I am writing an application that the user will have to log into using their network password. I woudl like to be able to send their username and password to a server and validate it. If anyone could help me with this, I would appreciate it. Thanks
T
|
|
|
|
|
Well you could try to validate the user
by logging into the server.
BOOL LogonUser(
LPTSTR lpszUsername, // user name
LPTSTR lpszDomain, // domain or server
LPTSTR lpszPassword, // password
DWORD dwLogonType, // type of logon operation
DWORD dwLogonProvider, // logon provider
PHANDLE phToken // receive tokens handle
);
|
|
|
|
|
I think that function LogonUser() could help you.
|
|
|
|
|
The problem with LogonUser() is, it requires WinNT/2000. What happens if this app is intended to use from 95/98??
Some time back I did 'change password' thing. In that I loaded 'NetApi32.DLL' and got the func ptr for 'NetUserChangePassword' and used it to change the password for user under any domain. There are some more 'NetUser*' functions available in the dll. I am sure inthat, there will be a 'login' kind of function in 'NetApi32.Dll'.
The advantage of this way is the app can be run on any Windows machine.
|
|
|
|
|
NetUserChangePassword
is not for Win 9X Systems
the foll. is from the MSDN.
Requirements
Windows NT/2000 or later: Requires Windows NT 3.1 or later.
Windows 95/98/Me: Unsupported.
Header: Declared in Lmaccess.h; include Lm.h.
Library: Use Netapi32.lib.
|
|
|
|
|
OOPS!! I am sorry. You are right.
I recollect it now (I just opened the my old project code in soursafe
).
While changing the passwords, what I did was: For Win 9x I loaded Mpr.Dll and used some functions like PwdSetPasswordStatus, PwdChangePassword to change the network password. For other OSs I loaded NetApi32.Dll.
bye bye.
|
|
|
|
|
Srini Kella wrote:
I woudl like to be able to send their username and password to a server and validate it.
I understood you would like to validate user at the server
I guess your server is not running Win9x, so that scenario could work.
|
|
|
|
|
I'm learning MFC trough internet so I don't have a book. But I haven't found any tutorial on how to make a simple "open file" dialog. Where can I find one? Thanks
|
|
|
|
|
Just take a look here:
http://msdn.microsoft.com/library/en-us/vcmfc98/html/_mfc_cfiledialog.3a3a.cfiledialog.asp
http://msdn.microsoft.com/library/en-us/vcmfc98/html/_mfc_cfiledialog.3a3a.domodal.asp
Best regards,
Vladimir
|
|
|
|
|
I'm using CSTScreenBuffer class to load image and get bitmap handle, and I'm
manipulating bits to display Images on windows-CE based paltform( pocket PC2002).
It just works fine while i'm using small sized JPG images (around50-60KB)
, but it has problem with big sized JPG images.
i can't get any valid bitmap handle at all. handle is always NULL!!!
i tried so many ways to solve this problem all weeks.
can anybody give me any clue for this trouble!!!
Of course, i used VOImage class for my project. But it has low speed and quality...
And one more question - can i use memory-mapped related functions to read
JPG image file? i tried, but it failed. ((->>jpeg_read_header(&cinfo, TRUE);))
here's my source code
//*********************************************************************8
HBITMAP CPhotoListCtrl::LoadJPG(CString strFilePath)
{
CSTScreenBuffer sts;
FILE * pFile;
JSAMPARRAY pBuffer;
int nRowSize;
ByteArray imageData(320*240*3);
struct jpeg_error_mgr jerr;
struct jpeg_decompress_struct cinfo;
if ((pFile = _tfopen(strFilePath, _T("rb"))) == NULL) {
CString strError;
strError.Format(_T("Can't open file '%s'"), strFilePath);
AfxMessageBox(strError);
return 0;
}
cinfo.err = jpeg_std_error(&jerr);
jpeg_create_decompress(&cinfo);
jpeg_stdio_src(&cinfo, pFile);
jpeg_read_header(&cinfo, TRUE);
jpeg_start_decompress(&cinfo);
nRowSize = cinfo.output_width * cinfo.output_components;
pBuffer = (*cinfo.mem->alloc_sarray)
((j_common_ptr) &cinfo, JPOOL_IMAGE, nRowSize, 1);
while (cinfo.output_scanline < cinfo.output_height) {
jpeg_read_scanlines(&cinfo, pBuffer, 1);
imageData.Append(pBuffer[0], nRowSize);
}
//************************************************************
HBITMAP hBitmap = sts.CreateBitmapByRGBArray(imageData.GetData(), cinfo.output_width, cinfo.output_height);
//***********************************************************
// ======>>> hBitmap is NULL !!!!
jpeg_finish_decompress(&cinfo);
jpeg_destroy_decompress(&cinfo);
fclose(pFile);
return hBitmap;
}
//*********************************************************************
|
|
|
|
|
Anyone got the function to do this? Its a pain in the arse!
Cheers.
Pete
|
|
|
|
|
time_t mktime(struct tm* ptr);
Maxwell Chen
People say "No news is good news". Then, no code is good code!?
|
|
|
|
|
|
There's probably a simple explaination..
On my spin button when I press the down arrow it increments the integer value in an edit box and when I press the top arrow it decrements it. How do I fix it so that up means up and down means down!
Thanks.
|
|
|
|
|
Assign a variable of type CSpinButtonCtrl (, and SetRange32(...) ), then it becomes what you want it to be......
Maxwell Chen
People say "No news is good news". Then, no code is good code!?
|
|
|
|
|
Excerpt from MSDN for CSpinButtonCtrl
Anonymous wrote:
"
Note The default range for the spin button has the maximum set to zero (0) and the minimum set to 100. Since the maximum value is less than the minimum value, clicking the up arrow will decrease the position and clicking the down arrow will increase it. Use CSpinButtonCtrl::SetRange to adjust these values.
"
|
|
|
|
|
have a program that has two views . rich edit view and edit view . I have done some syntax coloring in the rich edit view. But the probelm is that when I use the keys ctrl-x and ctrl-v in edit view the program gives debug assertion failure sighting some error in the viewrich.cpp . Can anyone help me
Samir Sood
Samir Sood
|
|
|
|
|
|
Hi..
I write a miltithreaded MFC application so a worker thread
performs a lengthy operation.
I want the worker thread to notifty the UI thread when it
finishes the operation. So I use SendMessage()
function.
the code is something like this:
<br />
class CInfo
{<br />
public:<br />
HWND hwnd;<br />
}<br />
In the dialog class :
<br />
private:<br />
CWinThread* m_pThread;<br />
CInfo info;<br />
<br />
void CMyDlg::OnStartWorkerBtn()<br />
{<br />
info.hwnd=this->m_hWnd;<br />
m_pThread=AfxBeginThread(CWorker::Work,&info,<br />
THREAD_PRIORITY_NORMAL,0,CREATE_SUSPENDED);<br />
<br />
m_pThread->m_bAutoDelete=FALSE;<br />
m_pThread->ResumeThread();<br />
}<br />
<br />
void CMyDlg::OnWorkerMessage()<br />
{<br />
}<br />
The worker thread code:
<br />
UINT CWorker::Work(void* arg)<br />
{<br />
CInfo* info=(CInfo*)arg;<br />
<br />
<br />
<br />
SendMessage(info->hwnd,WM_USER+1,0,0);<br />
}<br />
The code works fine in the debug version but an ( Access
violation ) error occures in the release version when the UI
thread receives the message while dragging the window with the
mouse.
can any one help with that?
|
|
|
|
|
Have you tried PostMessage instead?, it does not look like you need your worker thread to be blocked anyway.
Here are the remarks for SendMessage:
"If the specified window was created by the calling thread, the window procedure is called immediately as a subroutine. If the specified window was created by a different thread, Windows switches to that thread and calls the appropriate window procedure.
"
As to why this should be a problem?, i guess that is between God and Gates...
"It could have been worse, it could have been ME!"
|
|
|
|
|
thank you
but i do need to block the worker thread
any way the problem was solved
|
|
|
|
|
There are few problems that I see at the moment. First, don't use SendMessage betweem threads. It can lead to deadlocks. Use PostMessage or PostThreadMessage instead.
But your problem is not a deadlock, so this is only a suggestion.
I know that you HAVE to declare your custom messages handler function properly, because it can lead to such things like Access Violations in release versions. So I think this is your case. OnWorkerMessage should be full-declared, like this:
...
afx_msg LRESULT OnWorkerMessage(WPARAM wParam, LPARAM lParam);
ON_MESSAGE(WM_USER+1, OnWorkerMessage)
....
LRESULT CMyDlg::OnWorkerMessage(WPARAM , LPARAM )
{
...
}
Uncomment wParam and lParam if you want to use them
Philip Patrick
Web-site: www.stpworks.com
"Two beer or not two beer?" Shakesbeer
Need Web-based database administrator? You already have it!
|
|
|
|
|
thank you Philip
it worked using SendMessage()
the problem was that I did not declare the function with parameters
thank you again
|
|
|
|
|