|
To be honest, i do not see what´s wrong, sorry ... Ain´t it any MovieWindowSize() function like specified in MSDN ??
~RaGE();
|
|
|
|
|
Ah, thanks for your help anyway. We couldn't find anything wrong with it either. There is a MovieWindowSize() function, but it only takes a long as a parameter, 0 1 2 or 3. This doesn't seem to limit the size of the video to a point where I can get a decent resize factor. Anyway, thanks for giving it a shot. If you come up with anything else, let me know. Thanks.
|
|
|
|
|
Is it possible to draw a window directly on the memory dc as we are drawing on the screen.
|
|
|
|
|
Does anyone knows how to use FilgraphManager Object(directx object) in VC?
Thanks a lot.
No pains, no gains.
|
|
|
|
|
Hi,
I need to parse a small amount of code. The best way to do this is probably to create a parser but I don't like the idea of writing a parser from scratch. Besides, there are a number of parser generators out there which should be able to create a parser that does all I need.
But what parser generator should I use? I downloaded the spirit parser generator but haven't tried it out yet.
I'm using C++ but the code I have to parse is actually VBA. Not that it matters much - the code is not very complicated and uses only a small subset of the VB language.
Any comments would be appreciated.
With best regards,
Daniel
|
|
|
|
|
You could try Antlr..or (if you're more masochistic) Lex&Yacc or Flex&Bison. I've also used Visual Parse++ (that costs money, though), but I'd give Antlr the prize for most intuitive specification language - it also generates easy to understand & debug code, mainly because it generates a recursive descent parser rather than one based on an FSM.
Like you, I've downloaded Spirit, but not tried it out...
Stuart Dootson
'Java, Basic, who cares - it's all a bunch of tree-hugging hippy cr*p'
|
|
|
|
|
I there something similar as flock() on Unix machines?
I'd like to get exclusive file access or shared read access. Thanks for help.
|
|
|
|
|
|
thanks.
How can I use them together with old libc/CRT funtions fopen() , flose() ? Or which would be the best functions to lock files when using fopen etc?
|
|
|
|
|
It would be better to use CreateFile and lock it by passing 0 as the share mode.
bibamus, edamus, cras moriemur [eat, drink, for tomorrow we die]
|
|
|
|
|
The problem is portability here.
Right now my core code works on Windows, Unix, whatever. I'd like to keep that, once you have it it's neat to have it. perhaps there is a workaround, to still work with fopen()?
|
|
|
|
|
How can you talk about portability if you are using Unix's flock()? I doubt this function is in the ANSI standard.
Best regards,
Alexandru Savescu
|
|
|
|
|
oh... good point. sorry, didn't want to say that Unix way good, Windows bad.
Let me ask for a portable way - or - a way to do file access locking on Windows when using fopen()? Thanks in advance.
|
|
|
|
|
You may do this:
#ifdef WIN32
#else
#endif
Best regards,
Alexandru Savescu
|
|
|
|
|
May I ask for an short example how I use CreateFile together with fopen?
|
|
|
|
|
Hi,
I am using Visual C++ version 6.0 and am having an interesting compiler bug. Maybe someone has experienced this before. I also have Service Pack 5.0 (Is it the most recent?) installed, but does not help.
I have declared a variable in CMainFrame. This variable is of the type CMyClass.
When I compile my code, the compiler complains about the variable I have declared. What I do next is to comment out the variable I have declared and re-compile. The compiler then complains about lines of code using the now commented out variables.
The next step is to re-declare the variables previously commented out and re-compile. And voila, the compiler now has no errors. It is then possible to run my application and it works fine.
The problem I now have is that I would like to compile the code in Release Mode. But the above-mentioned trick does not work now.
This is because the compiler compiles all files in Release mode whenever a change is made and not only changed files as in Debug mode.
So, my question now is: Has anyone seen this before and do they have a solution?
Thanks
Regards
Rui
Rui
|
|
|
|
|
Ruca wrote:
So, my question now is: Has anyone seen this before and do they have a solution?
I had it yesterday, and a clear/rebuild all solved the problem, in Release Mode. I´ve already observed that this kind of situation comes up every now and then when using own defined classes object, such as CMyClass MyObject .
A few other tricks to solve extraterrestrial compiler bugs:
- Be careful not to have included files which are not in the file browser (solution: delete the
#include or add the corresponding files with Add Files to Project) - Watch if you are not making changes to a file which as the same name as a file which is in your project, but which is actually in another directory
...
~RaGE();
|
|
|
|
|
I had once a stranger bug. The compiler generated different code depending on some comments placed at different positions (the same comments, not different piece of code commented) and that difference influenced a bug.
Most of the times a rebuild and a restart fixes problem. Also, if the same thing happens when compiled on 2 different machines then there is a problem with your code, if not it's the compiler.
Best regards,
Alexandru Savescu
|
|
|
|
|
Thanks for your comments Alexpro and Rage. You gave me the determination to solve the problem. I definitely thought it was a compiler bug, which I did not care too much about because I could get around it. But when I tried to compile in Release Mode, the workaround did not work anymore.
After reading your comments I started to try new things and found that I had a circular include, i.e. I included file A in B and B in A (although not as simple as that). After sorting this out, the problem was resolved.
Thanks once again
Regards
Rui
|
|
|
|
|
Hi,
I have a property sheet, from one ATL control, when the user presses enter the property sheet is closed ( ), I need to handle the enter key to do other operation ( and of course avoid closing the Property sheet), How can I skip the Enter key for the property sheet? ( in ATL there is no Pretranslatemessage... ).
Thanks in advance, Greetings
Braulio
|
|
|
|
|
Hello, folks,
I got some trouble on sorting items in my CListCtrl. That is, I have a list control (i.e, of type CListCtrl), and this list control has 4 columns.
I want to sort the items on this list control by a given column (i.e, clicking the column header on the GUI of this list control.)Now, I found some sample codes from MSDN but I don't understand. I posted the MSDN sample as follows.
My question is: where and how to pass the 2 parameters (lParam1 and lParam2) to the callback function ?
Because I don't know the sample code has something to do with passing 2 parameters (lparam1 and lparam2) to the callback function (MyCompareProc).
And, this MyCompareProc callback function just compares 2 items ? If my list control has more than 2 items, what is the mechanism about this compare function ? And how can I use this callback function to sort many many items in my list control ?
Thanks for your help ! Any response would be greatly appreciated !
Example
// Sort the item in reverse alphabetical order.
static int CALLBACK
MyCompareProc(LPARAM lParam1, LPARAM lParam2, LPARAM lParamSort)
{
// lParamSort contains a pointer to the list view control.
// The lParam of an item is just its index.
CListCtrl* pListCtrl = (CListCtrl*) lParamSort;
CString strItem1 = pListCtrl->GetItemText(lParam1, 0);
CString strItem2 = pListCtrl->GetItemText(lParam2, 0);
return strcmp(strItem2, strItem1);
}
void snip_CListCtrl_SortItems()
{
// The pointer to my list view control.
extern CListCtrl* pmyListCtrl;
// Sort the list view items using my callback procedure.
pmyListCtrl->SortItems(MyCompareProc, (LPARAM) pmyListCtrl);
}
|
|
|
|
|
Hello,
try this !
::SendMessage(pmyListCtrl->GetSafeHwnd(), LVM_SORTITEMS, (LPARAM)this, (LPARAM)(PFNLVCOMPARE)CRightView1::MyCompareProc);
Marco
|
|
|
|
|
You will never call by youself MyCompareProc().It is called by SortItem which internaly implement some kind of sorting algoritm witch need to have a way to compare 2 elements.
So your list may have any number of elements ...
Bye,
Orbital^
...the night is long ... but not long enought to do some real coding ...
|
|
|
|
|
Hi again,
here a snipit from MSDN:
The comparison function has the following form:
int CALLBACK CompareFunc(LPARAM lParam1, LPARAM lParam2,
LPARAM lParamSort);
The lParam1 parameter is the 32-bit value associated with the first item being compared, and the lParam2 parameter is the value associated with the second item. These are the values that were specified in the lParam member of the items' LVITEM structure when they were inserted into the list. The lParamSort parameter is the same value passed to the LVM_SORTITEMS message.
U have to fill the params associated with the items/subitems first.
For instance, pointer to the DataClass instance. Then u can get/compare
everything from inside the class.
I had implemented today, and this is the fastest and easiest way to do
sorting in a listcontrol.
Marco
|
|
|
|
|
>>U have to fill the params associated with the items/subitems first.
>>For instance, pointer to the DataClass instance. Then u can get/compare
>>everything from inside the class.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Thanks ! I have tried it.
But I still got some problems on this lParam1 and lParam2.
That is, when I implement the Compare Function just like the sample from MSDN,
as follows:
int CALLBACK CSortListCtrl::CompareFunction(LPARAM lParam1, LPARAM lParam2, LPARAM lParamData)
{
CSortListCtrl* pListCtrl = reinterpret_cast<csortlistctrl*>( lParamData );
ASSERT( pListCtrl->IsKindOf( RUNTIME_CLASS( CListCtrl ) ) );
CString strItem1 = pListCtrl->GetItemText( lParam1, pListCtrl->m_iSortColumn );
CString strItem2 = pListCtrl->GetItemText( lParam2, pListCtrl->m_iSortColumn );
return strcmp(strItem2, strItem1);
}
I always got lParam1 and lParam2 the SAME !! That is, the Compare Function is always comparing the same thing ! (The first item always ! And I found the lParam1 and lParam2 are always 0 !!)
The following is how I added items to my list control:
/// m_CtrlEntryList is of type CSortListCtrl, which is also of type CListCtrl
//// add subitem 0 first
m_CtrlEntryList.InsertItem( iItemNo, szString );
LV_ITEM lvitem;
ZeroMemory( &lvitem, sizeof( lvitem ) );
/// then add subitem 1 ~ 3
lvitem.mask = LVIF_TEXT;
lvitem.iItem = iItemNo;
lvitem.pszText = szString;
lvitem.iSubItem = iSubItemNo;
lvitem.lParam = iItemNo; // <------ I DO specify this lParam
m_CtrlEntryList.SetItem( &lvitem );
I used something like above to add items to my list control, and it really worked and displayed fine. I don't know why when I get them compared, the 2 parameters passed to compare function are always 0.
Anything wrong ?
|
|
|
|
|