|
Hello all !
I have a custom drawn virtual list view (in icon view) to display thumbnails. Everything behaves as expected, except when I try to du multiple selection using shift+click or shift+cursor key. It selects an extra row of thumbnails, as if the end thumbnail was moved one row down and 1 column to the right.
If I intercept LVN_ODSTATECHANGED, the start and end numbers are wrong.
When I do ctrl+click, it works fine. If I remove OWNERDATA flag, it works fine. In details view it works fine. Do you have any ideas what this might be?
Best regards,
Jan
|
|
|
|
|
I am reading some code like this:
// the line below declares fGetType as a pointer
//to a function which takes an int type parameter
// and returns an int value, right?
typedef int (* fGetType) (int);
//other two declarations
static void SetColumnType(fGetType func) { ......};
int _List_Type( int col ){......};
//below is where I can not understand:
// the function _List_Type return an int type
//value, how can it be cast into the type
//fGetType which returns a pointer to int?
SetColumnType ( (fGetType)_List_Type );
--------------------
thank you very much!
-------------------
I am learning C++ and English
|
|
|
|
|
The cast (which might not really be required) works because the type fGetType is really specifying the signature of the function. In this case, that signature is "function taking an int that returns an int ". It does not return pointer-to-int , it only looks that way at first glance because of the asterisk used in the typedef .
The _List_Type function is already a function that takes an int that returns an int .
Here is the trick: function names, when they are being used to call a function, are really pointers behind the scenes. They point to the address of the start of the function. When you apply the parens to it, the parens become the "function call operator", and cause a jump to the beginning of the address of the function (and it starts being executed). Each function pointer has an implicit type, and that type is basically its signature (although things are a little bit different when dealing with C++ object members).
Take the following examples:
typedef int (*PFSomeFuncType)(int);
int SomeFunc( int iValue )
{
return( iValue + 42 );
}
double SomeOtherFunc( double iValue )
{
return( iValue + 42 );
}
int main( int iArgC, char *pArgVp[] )
{
DWORD dwFuncAddr = (DWORD)SomeFunc;
int iRet = 0;
iRet = ((PFSomeFuncType)dwFuncAddr)( 42 );
return( 0 );
} In the above example, the "type" of SomeFunc is int (__cdecl *)(int) , and the "type" of SomeOtherFunc is double (__cdecl *)(double) . Note that this looks a bit like the typedef above...
If you compile and execute the above code snippet, what do you think iRet will be equal to right before main(...) returns?
Peace!
-=- James If you think it costs a lot to do it right, just wait until you find out how much it costs to do it wrong! Tip for new SUV drivers: Professional Driver on Closed Course does not mean your Dumb Ass on a Public Road! DeleteFXPFiles & CheckFavorites (Please rate this post!)
|
|
|
|
|
thank you very much, james.
but I don't know wy I can't see where I can rate your post.
-------------------
I am learning C++ and English
|
|
|
|
|
How do you create nice looking GUIs with your own design ideas. For example, I have some button, tool bar, and even user interface ideas i can design in photoshop or 3d software, but I don't know how to use those graphics in my GUI designs. How do I do that? For example, has anyone noticed the windows skins and skins on other applications that make the user interfaces look so good. How is that done?
Thanks good people.
Peace,
BP
|
|
|
|
|
Create your own control classes and make them owner drawn, then you can draw them however you like.
Or if it's an established UI, such as the Outlook look and feel, buy a product like the Ultimate Toolbox and get it all out of the box.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks...and I have one follow up question.
How do I do that?
Thanks again...
|
|
|
|
|
I guess the easiest way would be to look at some articles on this site for things like custom buttons. They will be owner drawn and hopefully the articles will step through the process involved, and give you a feel for how much work is involved.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Thanks...I appreciate it..
|
|
|
|
|
Hello,
Does anybody know how to obtain the FILETIME & FILESIZE from a file stored for example at:
http://www.people.zeelandnet.nl/marco01974/index.htm
http://www.people.zeelandnet.nl/marco01974/soldner4.pak
i searched trough msdn for some nice c++ code,but didn`t found what i was looking for.
Thanx.
|
|
|
|
|
Hi all,
I'm stuggling to resolve a memory leak. The code below gets updated every few seconds and changes the image displayed depending on the state of m_bOn..
CDC* pDC = CDC::FromHandle( lpDrawItemStruct->hDC );
if ( pDC )
{
CRect rect = lpDrawItemStruct->rcItem;
int nSavedDC = pDC->SaveDC();
pDC->SelectStockObject( NULL_BRUSH );
pDC->FillSolidRect( rect, ::GetSysColor( COLOR_BTNFACE ) );
if( m_bOn )
{
pDC->BitBlt( m_ptCentre.x, m_ptCentre.y, m_nWidth, m_nHeight, &m_dcMem, 1 * m_nWidth, 0, SRCCOPY );
}
else
{
pDC->BitBlt( m_ptCentre.x, m_ptCentre.y, m_nWidth, m_nHeight, &m_dcMem, 0 * m_nWidth, 0, SRCCOPY );
}
pDC->RestoreDC( nSavedDC );
}
I know the leak is here somewhere but I can't see what would be wrong! I'd really appreciate some help or some pointers in the right direction.
Many thanks
Tom
|
|
|
|
|
_Tom_ wrote: pDC->SelectStockObject( NULL_BRUSH );
Does this have a return value ? When you select your own brush, a pointer to the old brush is returned and you need to grab it and select it back in to avoid a memory leak.
Christian Graus - Microsoft MVP - C++
|
|
|
|
|
Hi,
I have been attempting to extract the "Menu Bar" layout of MS Office Apps, say MS Word. I would appreciate any help. Here is my problem description.
MS Office "Menu Bar" is not accessible using the normal Windows HWND handles. However, they expose the IAccessible interface, which I am trying to use. The handle to the top level "Menu Bar" is first obtained, call it h. The "AccessibleObjectFromWindow()" function is then used with the handle h, in an attempt to get an IDispatch pointer to the menu. Here is the code snip.
IDispatch** ppMenu = NULL;
DWORD OBJID_NATIVEOM = ((LONG)0xFFFFFFF0);
int r = AccessibleObjectFromWindow(h, OBJID_NATIVEOM, IID_IDispatch, (void**)ppMenu);
if (r == S_OK) {printf("S_OK\n");}
if (r == E_INVALIDARG) {printf("E_INVALIDARG\n");}
if (r == E_NOINTERFACE) {printf("E_NOINTERFACE\n"); }
However, the returned value is always E_INVALIDARG. The handle 'h' has been obtianed by (recursively) enumeraing all windows (and child windows) of the MS Word top level window and selecting the one with name="Menu Bar" and class="MsoCommandBar".
I believe, the id OBJID_NATIVEOM is required for Office apps, since they implement their own menu.
If someone has any thoughts or experience with this type of situation, I would really apreciate their help.
Regards,
Ishan.
|
|
|
|
|
I am new to opengl programming and am having trouble using this to display text on my screen. Can anybody help?
|
|
|
|
|
i have a open gl book but i dont see some marks how to display text on youre screen.
i think that you have to calculate them with vectors or somthing like that
but i'm realy not that far in that stuf i'm a beginer
i dit look fast troug the book i have on open gl
but i don't see a remark on how to put text on the screen
i hope that some other person wil find the trik
-- modified at 17:33 Wednesday 9th November, 2005
|
|
|
|
|
Hi!
I'm coding a cache for Dynamic Object Loading. I'm using a third party library that throws some exceptions when it doesn't find the dynamic library that is requested. The thing is that I would like to store somewhere those exceptions and associate them to the object that the client was looking for. This way I could save a call to the third party library when I know that last time it failed: I would directly throw the exception that I saved the first time it failed (I also have a timer to clean up these associations and look for the library again...but that doesn't matter). The problem is that I don't know how to store in a container the exceptions, without risking to commit slicing and without hard coding the exceptions types of the third party library?
I would really appreciate any suggestion that you can give me.
Thanks,
Federico
|
|
|
|
|
hi im new to windows programming and i am studiing the book in dutch
so sorry for my bad english.
problem is this:
i can't get data from dialog box 1 in to dialog box 2
kan anny one tel me wy this is
thank you verry much m.t. dijkstra
this is the litle program
www.palcopy.com/down_load/comunication_between_variabel_of_2_windows.zip
you can down load it frome my home page
the problem is in
m_waardeChild = a box in the 2th window where the text must be displayed
and
m_TestOutput = a input box in the 1th window where you come in !!!!
this is wat the second window must do
if in the second dialog is kliked on buton problem
then get input variabel frome 1 dialog en write it down in second window
but it dos not work????
void CChildDialog::OnBUTTONproblem()
{
// TODO: Add your control notification handler code here
// m_waardeChild = "this works";
// m_waardeChild = CComunicationbetweenvariabelof2windowsDlg.m_TestOutput;// dos not work
// m_waardeChild = CComunicationbetweenvariabelof2windowsDlg->m_TestOutput;// dos not work
m_waardeChild = CComunicationbetweenvariabelof2windowsDlg* m_TestOutput;
// can anny one tel me how this works in c++ i dont understand
// to get data from the other window up in here?????
UpdateData(FALSE);
}
thank's verry much for helping
-- modified at 15:35 Wednesday 9th November, 2005
|
|
|
|
|
Which of these two best describes the relationship between the two dialogs?
Are both dialogs owned by the same parent:
parent
/ \
dlg 1 dlg 2 Or does one dialog own the other:
parent
|
dlg 1
|
dlg 2
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
parent
|
dlg 1
like this
in parent there is a variabel
in
dlg
there is a function who wil get the variabel frome the parent
void CChildDialog::OnBUTTONproblem()
{
geting data frome dlg1
}
how is this manegd
thank's verry much for helping
|
|
|
|
|
There are several ways to do this. The easiest, although not considered good OO practice, is to mark the variable as public in the parent class. Then in the child, simply call GetParent() . Or, mark the variable as private and use a get/set method instead.
Also, you could add the same type of variable to the child, mark it as public , and assign it a value before calling the dialog's DoModal() method.
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
m_TestOutput is in main window and is public
this is standing in dialog 1 under buttonproblem
void CChildDialog::OnBUTTONproblem() <br />
{<br />
CWnd *CParentWindow = GetParent();
<br />
m_waardeChild = CParentWindow->m_TestOutput;
<br />
<br />
UpdateData(FALSE); <br />
}
get folowing error
--------------------Configuration: comunication between variabel of 2 windows - Win32 Debug--------------------
Compiling...
ChildDialog.cpp
c:\sevc6\comunication between variabel of 2 windows\ChildDialog.cpp(54) : error C2039: 'm_TestOutput' : is not a member of 'CWnd'
c:\program files\microsoft visual studio\vc98\mfc\include\afxwin.h(1899) : see declaration of 'CWnd'
Error executing cl.exe.
comunication between variabel of 2 windows.exe - 1 error(s), 0 warning(s)
thank's verry much for helping
-- modified at 17:11 Wednesday 9th November, 2005
|
|
|
|
|
can any one help me whit this problem im a beginer in this
thank's verry much for helping
|
|
|
|
|
Mathieu Dijkstra wrote: UpdateData(FALSE);
My first suggestion would be to lose the calls to UpdateData() . They are unnecessary and will only confuse you further. Using SetWindowText() and GetWindowText() instead is much cleaner and less error-prone.
Mathieu Dijkstra wrote: m_waardeChild = CParentWindow->m_TestOutput;// dos not work ether
The compiler is telling you exactly what the problem is. Try:
CComunicationbetweenvariabelof2windowsDlg *pParent;
pParent = (CComunicationbetweenvariabelof2windowsDlg *) GetParent();
m_waardeChild = pParent->m_TestOutput;
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|
|
wel i tryd it and it wont work this is wat i dit in the function
--------------------------------------------
void CChildDialog::OnBUTTONproblem() <br />
{<br />
<br />
<br />
<br />
CComunicationbetweenvariabelof2windowsDlg *pParent;<br />
pParent = (CComunicationbetweenvariabelof2windowsDlg *) GetParent();<br />
m_waardeChild = pParent->m_TestOutput;<br />
<br />
<br />
<br />
<br />
UpdateData(FALSE);
}
-------------------------------------------------------------------------------
message by visual c++6 =
--------------------Configuration: comunication between variabel of 2 windows - Win32 Debug--------------------
Compiling...
ChildDialog.cpp
c:\sevc6\comunication between variabel of 2 windows\ChildDialog.cpp(60) : error C2065: 'CComunicationbetweenvariabelof2windowsDlg' : undeclared identifier
c:\sevc6\comunication between variabel of 2 windows\ChildDialog.cpp(60) : error C2065: 'pParent' : undeclared identifier
c:\sevc6\comunication between variabel of 2 windows\ChildDialog.cpp(60) : warning C4552: '*' : operator has no effect; expected operator with side-effect
c:\sevc6\comunication between variabel of 2 windows\ChildDialog.cpp(61) : error C2059: syntax error : ')'
c:\sevc6\comunication between variabel of 2 windows\ChildDialog.cpp(62) : error C2227: left of '->m_TestOutput' must point to class/struct/union
Error executing cl.exe.
comunication between variabel of 2 windows.exe - 4 error(s), 1 warning(s)
thank's verry much for helping
|
|
|
|
|
Mathieu Dijkstra wrote: c:\sevc6\comunication between variabel of 2 windows\ChildDialog.cpp(60) : error C2065: 'CComunicationbetweenvariabelof2windowsDlg' : undeclared identifier
Again, the compiler is telling you the problem. You have referenced an identifier that has not been declared. You need to include Comunicationbetweenvariabelof2windowsDlg.h at the top of ChildDialog.cpp .
"Take only what you need and leave the land as you found it." - Native American Proverb
|
|
|
|