|
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]
|
|
|
|
|
You have at least two options :
- in your project settings, check the "Force output" box in the Link / Customize tab.
- add a fake exported function, such like __decl(dllexport) void suckmeall(){} , this will force the linker to produce a .lib library.
sometimes it helps to look at the IL generated code
a MS guy on develop.com "answering" .NET issues
|
|
|
|
|
None of your proposed solutions work
The only files produced are these:
- testdlg.obj
- test.obj
- test.pch
- test.res
- stdafx.obj
- vc60.idb
- vc60.pdb
But no test.dll, nor test.lib
Before I added the dialog, it worked. But now, even when I "comment" the references to testdlg, it doesn't. So, it has something to do with that dialog I guess...
using: [VISUAL STUDIO 6.0] [WIN98/2]
|
|
|
|
|
After completely removing the dialog from the resource, and deleting the dialog's header and source file from the project, the project created a lib- and dll-file again.
There's still a resource in the project (string table and version info).
So, can't we add a dialog into a dll using the resource editor?
Do I have to use mfc-extension dll or regular dll using shared or static mfc-dll?
using: [VISUAL STUDIO 6.0] [WIN98/2]
|
|
|
|
|
Hi, i'm writing an app which will have its own DB that it will add information to
from searches from various databases (so they have a local copy of search results etc)
Now, which database option should i use, bearing in mind that its a stand alone app and the user could be anywhere ?
I'm told there is a free sybase db, i could use the jet engine?
erm what do people recommend?
Bryce
|
|
|
|
|
I want to remove popup menu that popup when I right mouse click on CHtmlView.
First, I try to map message WM_INITMENUPOPUP in CMyHtmlView, but my message handler has not been execute.
I don't know how can I remove the popup menu.
Please help me.
|
|
|
|
|
erm i use a bit of html code
eg
<br />
<BODY onLoad="start()" bottomMargin=0 leftMargin=0 topMargin=0 rightMargin=0 scroll = 'no' oncontextmenu="return false" bgColor=white><br />
bryce
|
|
|
|
|
hi,
I'm using a CComboBox in toolbar.when i try to resize it,a separator appears behind the combo box.I tried removing TBBS_SEPARATOR but then it does shrinks back to toolbar button width.Also.if I try to specify CRECT right value, then it overwrites the next button.this separator can be seen when toolbar button size is increased
How to remove it?
thanx in advance !
viraj
|
|
|
|
|
Hi all,
For years I've been using C format strings to create output strings that are written in message boxes, in files, ... You know, constructions like this:
printf ("Error found on line %ld in file %s", LineNumber, FileName);
This constructions makes it easy to add translations to your application:
printf (Translate("Error found on line %ld in file %s"), LineNumber, FileName);
The Translate function can then translate this english string to a french string.
There are some problems with this construction. First, the order of arguments in the format string must remain the same throughout all languages. Second, errors in the translations can crash your application.
Using C++ iostreams makes things much better, but I have to write things like this:
cout<<"Error found on line "<<LineNumber<<" in file "<<FileName;
Now try to add translate functionality to this, without translating silly strings like " in file ".
I once saw a construction where they used :1, :2, ... to replace the format specifiers, but I can't remember where I saw it. Format strings looked something like:
"Error found on line :1 in file :2".
The translated string could then be:
"Error dans le fichier :2 sur la ligne :1"
Notice how the order of the arguments was changed.
So this construction has the advantage that the sequence of :1 and :2 can be modified in other languages, and that the application will not crash if there's an error in the translation.
There's probably some nice C++ class to implement such construction.
Now how do I specify that :1 is my LineNumber, and :2 is my FileName?
Is it possible to put something like this functionality in a C++ class, and make it work similar like cout? Or does this already exist? Anyone ideas on how to find or write this ?
Enjoy life, this is not a rehearsal !!!
|
|
|
|
|
You can use sprintf to use a normal printf style formatting into a char array, and then cout that
e.g.
szErrorFormat = "Error found on line %ld in file %s";
sprintf( szOutputBuffer, szErrorFormat, nLineNumber, szFileName );
cout << szOutputBuffer;
(this code is just an example - don't expect it to compile!)
--
Help me! I'm turning into a grapefruit!
|
|
|
|
|
That's a solution, but not the one that I was searching for.
I am rather hoping/searching for a solution like this:
<br />
class StringFormatter;<br />
StringFormatter myFormatter("Error found on line :1 in file :2");<br />
myFormatter << LineNumber << FileName;<br />
cout << myFormatter;<br />
The StringFormatter could also automatically translate the given string. The order of the :1 and :2 would not matter (in contrast with using %ld and %s in a normal C format string), so it could be translated into:
Erreur dans le fichier :2 sur la ligne :1
(I hope this is right since my french is a bit rusty).
Does such class exist?
If I would want to write something myself, what would be a good starting point, or what pitfalls should I avoid?
Maybe a good idea for a CP article?
Enjoy life, this is not a rehearsal !!!
|
|
|
|
|
You could use the Win32 function ::FormatMessage to format your strings. It allows specifying arbitrary order on the arguments. It is a little bit of a pain to use, but you could easily wrap it inside an object to simplify the calls.
If you are using MFC and CString, you can use the FormatMessage member of CString, which wraps the Win32 function so that it is easier to use.
Best regards,
John
|
|
|
|
|
i want to get info from file manage, i.e. files, directories etc. i mean, directly, not by findfile functions.
but i have no idea how to accass to file manage, is it private property of microsoft, so we can't use it directly?
thx
includeh10
|
|
|
|
|
You mean accessing NTFS data structures directly? Sure, anyone can do that. You just have to hand over a small amount of cash and you can buy your way into the world of NTFS drivers.
If your bankaccount is below 6 numbers in US$ better forget it.
...if you're under 8 or younger. Chris Maunder, the Lounge
|
|
|
|