|
Hi!
I'm really confused of what my program is doing.
I have typical MFC application, serving as FTP Server. For easier controlling, I put the most used commands into tray icon menu. These commands' identificators are equal to the appropriate commands in main menu of the application. (eg. ID_SHOW_STATISTICS etc...).
And now, the strange behavoiur - when some user is uploading data on the server (upload is performed in separate thread), and I choose on of the commands in tray menu, the server freezes up. In other words, uploading progress is frozen. I even exactly can see what routine my program stopped in - it is CAsyncSocket(or CSocket)::ConnectHelper(), function called from CSocket::Connect() routine. This routine never returns (I think that there is some calling of PumpMessage but I'm not sure...)
BUT, when I choose the SAME command from main menu (not from tray), this problem doesn't appear. Can anybody explain this behaviour to me please ? I really don't know what to do now.......
Any suggestion will be appreciated!
Thanks in advance.
Standa.
Celebrate Mr. Cesilko!
|
|
|
|
|
Hello
I have been working on an MDI program, in which two child windows are being used. I have been attempting to switch between these windows since I need user input in one, and to draw in the other. I have attempted to pass the window device context between modules, but I get a first chance exception error at run-time.
I also have been experimenting with getnextwindow(), setfocus() routines, but noothing happends when I use them.
Help
|
|
|
|
|
The "new folder' button seems wrong when you are opening a file in the OPen dialog, unless I'm missing something. How does one prevent it from showing? I didnt see an OFN_ flag to do that...
Thanks,
ns
|
|
|
|
|
For my browse folder I have the following flags set:
BIF_RETURNFSANCESTORS | BIF_RETURNONLYFSDIRS|BIF_NONEWFOLDERBUTTON
The compiler chokes on the last and says it doesnt know BIF_NONEWFOLDERBUTTON
Any ideas why?
Thanks,
ns
|
|
|
|
|
Never heard of this one,
ulFlags
Flags specifying the options for the dialog box. This member can include zero or a combination of the following values: BIF_BROWSEFORCOMPUTER Only return computers. If the user selects anything other than a computer, the OK button is grayed.
BIF_BROWSEFORPRINTER Only return printers. If the user selects anything other than a printer, the OK button is grayed.
BIF_BROWSEINCLUDEFILES The browse dialog will display files as well as folders.
BIF_DONTGOBELOWDOMAIN Do not include network folders below the domain level in the tree view control.
BIF_EDITBOX Version 4.71. The browse dialog includes an edit control in which the user can type the name of an item.
BIF_RETURNFSANCESTORS Only return file system ancestors. If the user selects anything other than a file system ancestor, the OK button is grayed.
BIF_RETURNONLYFSDIRS Only return file system directories. If the user selects folders that are not part of the file system, the OK button is grayed.
BIF_STATUSTEXT Include a status area in the dialog box. The callback function can set the status text by sending messages to the dialog box.
BIF_VALIDATE Version 4.71. If the user types an invalid name into the edit box, the browse dialog will call the application's BrowseCallbackProc with the BFFM_VALIDATEFAILED message. This flag is ignored if BIF_EDITBOX is not specified.
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
ulFlags
Flags specifying the options for the dialog box. This member can include zero or a combination of the following values: BIF_BROWSEFORCOMPUTER Only return computers. If the user selects anything other than a computer, the OK button is grayed.
BIF_BROWSEFORPRINTER Only return printers. If the user selects anything other than a printer, the OK button is grayed.
BIF_BROWSEINCLUDEFILES Version 4.71. The browse dialog box will display files as well as folders.
BIF_BROWSEINCLUDEURLS Version 5.0. The browse dialog box can display URLs. The BIF_USENEWUI and BIF_BROWSEINCLUDEFILES flags must also be set. If these three flags are not set, the browser dialog box will reject URLs. Even when these flags are set, the browse dialog box will only display URLs if the folder that contains the selected item supports them. When the folder's IShellFolder::GetAttributesOf method is called to request the selected item's attributes, the folder must set the SFGAO_FOLDER attribute flag. Otherwise, the browse dialog box will not display the URL.
BIF_DONTGOBELOWDOMAIN Do not include network folders below the domain level in the dialog box's tree view control.
BIF_EDITBOX Version 4.71. Include an edit control in the browse dialog box that allows the user to type the name of an item.
BIF_NEWDIALOGSTYLE Version 5.0. Use the new user interface. Setting this flag provides the user with a larger dialog box that can be resized. The dialog box has several new capabilities including: drag and drop capability within the dialog box, reordering, shortcut menus, new folders, delete, and other shortcut menu commands. To use this flag, you must call OleInitialize or CoInitialize before calling SHBrowseForFolder.
BIF_NONEWFOLDERBUTTON Do not include the "New Folder" button in the browse dialog box.
BIF_RETURNFSANCESTORS Only return file system ancestors. An ancestor is a subfolder that is beneath the root folder in the namespace hierarchy. If the user selects an ancestor of the root folder that is not part of the file system, the OK button is grayed.
BIF_RETURNONLYFSDIRS Only return file system directories. If the user selects folders that are not part of the file system, the OK button is grayed.
BIF_SHAREABLE Version 5.0. The browse dialog box can display shareable resources on remote systems. It is intended for applications that want to expose remote shares on a local system. The BIF_USENEWUI flag must also be set.
BIF_STATUSTEXT Include a status area in the dialog box. The callback function can set the status text by sending messages to the dialog box.
BIF_UAHINT When combined with BIF_NEWDIALOGSTYLE, adds a usage hint to the dialog box in place of the edit box. BIF_EDITBOX overrides this flag.
BIF_USENEWUI Version 5.0. Use the new user interface, including an edit box. This flag is equivalent to BIF_EDITBOX | BIF_NEWDIALOGSTYLE. To use BIF_USENEWUI, you must call OleInitialize or CoInitialize before calling SHBrowseForFolder.
BIF_VALIDATE
Thats from my MSDN (Oct 01 I think)
Thanks,
ns
|
|
|
|
|
OK. If it doesnt exist how to prevent the new folder button from showing up?
Thanks,
ns
|
|
|
|
|
I did a search of my Platform SDK header files and found,
#define BIF_NONEWFOLDERBUTTON 0x0200 // Do not add the "New Folder" button to the dialog. Only applicable with BIF_NEWDIALOGSTYLE.
Michael
"Time and tide melts the snowman."
-- The Doctor (Doctor Who: Time and the Rani
|
|
|
|
|
Thats great! I have to make sure the NEWDIALOGSTYLE doesnt cause problems on win 98 etc...but the info is terrific!
Thanks,
ns
|
|
|
|
|
I want to make a simple COM component in MFC (without using ATL). I know how to make it. But i want to fire events from this component, and i don't know how to do this. Is there any sample application you know that can do this ?? I searched here at CP but i only find applications that are made with support of ATL.
|
|
|
|
|
I have answered this question already, a day or two ago.
sometimes it helps to look at the IL generated code
a MS guy on develop.com "answering" .NET issues
|
|
|
|
|
in vc6, this short program run well
#include "stdafx.h"
#include "windows.h"
int main(int argc, char* argv[])
{
WORD w = 192;
BYTE l;
l = w;
return 0;
}
get l =192;
but the almost same piece of code in VC7, get l=0;
#include "stdafx.h"
#include "windows.h"
int _tmain(int argc, _TCHAR* argv[])
{
WORD w = 192;
BYTE l;
l = w;
return 0;
}
What's wrong? Is only my compiler go mad or all vc7 compiler get the same result?
|
|
|
|
|
Same result for me between VC6 and VC7. BYTE and WORD typedefs haven't changed so there is no good reason for a problem.
sometimes it helps to look at the IL generated code
a MS guy on develop.com "answering" .NET issues
|
|
|
|
|
Could it be the optimiser saying you don't use 'i' therefore I'm not gonna bother calculating it?
Blade[DMS]
|
|
|
|
|
That's interesting, I get 192 in VC7 and a debug build...
- Anders
Money talks, but all mine ever says is "Goodbye!"
|
|
|
|
|
The MSDN says:
CListCtrl::SetItemCountEx
This method sets the virtual number of items in a virtual list view control.
What's a virtual list view control?
And, when does I use SetItemCountEx and when SetItemCount?
--
Nice greets, Daniel.
|
|
|
|
|
MSDN:
Virtual list view description
A virtual list view is a list view control that has the LVS_OWNERDATA style. The LVS_OWNERDATA style enables the control to handle an almost infinite number of items. Specifically, the control can support an item count up to a DWORD. This is possible because the overhead of managing item data is placed on the owner. This allows the virtual list view control to lend itself for use with large databases of information, where specific methods of accessing data are already in place.
A virtual list view control maintains very little item information itself. Except for the item selection and focus information, all item information must be managed by the owner of the control. All other item information is requested from the owner using LVN_GETDISPINFO notification messages.
Because this type of list control is intended for large data sets, it is recommended that you cache requested item data to improve retrieval performance. The list view provides a cache-hinting mechanism to assist in optimizing the cache. The hint is implemented in the form of an LVN_ODCACHEHINT notification message.
SetItemCountEx is for virtual list view control
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Hi,
I have a problem with the recv() function.
it seems to hang!!!
There is a provision to exit out of recv() but doesn't seem to help!!!
Here's the extract!!
==========================================================
while ( ii != 0)
{
ii = recv(sd,aa,1000,0);
}
printf("%d %s",ii,aa);
}
===========================================================
Any Help would be appreciated!!!
Brgds,
John :
|
|
|
|
|
MSDN:
Return Values
If no error occurs, recv returns the number of bytes received. If the connection has been gracefully closed, the return value is zero. Otherwise, a value of SOCKET_ERROR is returned, and a specific error code can be retrieved by calling WSAGetLastError.
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
Does anyone can help discover way how to start folder dialog
by SHBrowseForFolder function into any folder chosen by me?
=how to set initial directory?
Thank you for your help.
|
|
|
|
|
check BROWSEINFO
Papa
while (TRUE)
Papa.WillLove ( Bebe ) ;
|
|
|
|
|
The BROWEINFO struct has a member lpfn where you define a Callback function. The Callback could the lokk like:
<br />
switch(uMsg) {<br />
case BFFM_INITIALIZED: {<br />
<br />
if(!m_biark.IsEmpty()){<br />
::SendMessage(hwnd,BFFM_SETSELECTION,TRUE,(DWORD) ((LPCTSTR)m_biark));<br />
}<br />
break;<br />
}<br />
<br />
<br />
default:<br />
break;<br />
}<br />
<br />
|
|
|
|
|
Is here any special parameter or something else for
MFC class CFileDialog to make its file dialog in style
as for example open dialogs in Office2000 look like.(with bar on left)
SDK function GetOpenFileName is doing it in WinME or Win2000
without any special flag, but with MFC class CFileDialog it
always looks like in Win95 (without bar .
Thank you for your help.
(I'm programming in VC++ 6.0)
|
|
|
|
|
Use that:
class CFileDialogEx : public CFileDialog
....
#pragma pack(4) // n=4
int CFileDialogEx::DoModal()
{
struct OPENFILENAMEEX
{
OPENFILENAME of;
void * pvReserved;
DWORD dwReserved;
DWORD FlagsEx;
};
OSVERSIONINFO osvi= {sizeof(OSVERSIONINFO)} ;
bool Win2000=false;
#if _MSC_VER < 1300 //В .NET идет станлартная реализация в MFC
Win2000=(GetVersionEx (&osvi)) &&
(((osvi.dwPlatformId == VER_PLATFORM_WIN32_NT) && (osvi.dwMajorVersion >= 5)) ||
((osvi.dwPlatformId = VER_PLATFORM_WIN32_WINDOWS) && (osvi.dwMajorVersion >= 4) && (osvi.dwMinorVersion >= 90)));
#endif
if (Win2000)
{
ASSERT_VALID(this);
ASSERT(m_ofn.Flags & OFN_ENABLEHOOK);
ASSERT(m_ofn.lpfnHook != NULL);
ASSERT(AfxIsValidAddress(m_ofn.lpstrFile, m_ofn.nMaxFile));
DWORD nOffset = lstrlen(m_ofn.lpstrFile)+1;
ASSERT(nOffset <= m_ofn.nMaxFile);
memset(m_ofn.lpstrFile+nOffset, 0, (m_ofn.nMaxFile-nOffset)*sizeof(TCHAR));
HWND hWndFocus = ::GetFocus();
BOOL bEnableParent = FALSE;
m_ofn.hwndOwner = PreModal();
AfxUnhookWindowCreate();
if (m_ofn.hwndOwner != NULL && ::IsWindowEnabled(m_ofn.hwndOwner))
{
bEnableParent = TRUE;
::EnableWindow(m_ofn.hwndOwner, FALSE);
}
_AFX_THREAD_STATE* pThreadState = AfxGetThreadState();
ASSERT(pThreadState->m_pAlternateWndInit == NULL);
if (m_ofn.Flags & OFN_EXPLORER)
pThreadState->m_pAlternateWndInit = this;
else
AfxHookWindowCreate(this);
int nResult;
OPENFILENAMEEX ofn_ex={0};
memcpy(&ofn_ex.of,&m_ofn,sizeof(m_ofn));
ofn_ex.of.lStructSize=sizeof(OPENFILENAMEEX);
if (m_bOpenFileDialog)
nResult = ::GetOpenFileName((LPOPENFILENAME)&ofn_ex);
else
nResult = ::GetSaveFileName((LPOPENFILENAME)&ofn_ex);
memcpy(&m_ofn,&ofn_ex.of,sizeof(m_ofn));
if (nResult)
ASSERT(pThreadState->m_pAlternateWndInit == NULL);
pThreadState->m_pAlternateWndInit = NULL;
if (bEnableParent)
::EnableWindow(m_ofn.hwndOwner, TRUE);
if (::IsWindow(hWndFocus))
::SetFocus(hWndFocus);
PostModal();
return nResult ? nResult : IDCANCEL;
}
else
return CFileDialog::DoModal();
}
#pragma pack()
|
|
|
|
|
I've created an mfc extension dll. Initialy, compiling and linking works fine.
But if I add a dialog to the resource using the resource editor, the sources compile but the .lib-files are not created anymore, so the dll cannot be created either (fatal link error).
Is there a good reason for that?
btw. Even if I comment all references to that dialog (simulate the dialog is not there anymore) the sources compile but the library isn't build.
The .obj-files are there, but no .lib-file is made.
using: [VISUAL STUDIO 6.0] [WIN98/2]
|
|
|
|