|
Have you by chance redefined ThreatStruct within the function, thereby causing it to be zero although the *real* ThreatStruct variable contains 1.234?
/ravi
Let's put "civil" back in "civilization"
http://www.ravib.com
ravib@ravib.com
|
|
|
|
|
I've only defined it in one place and extern it everywhere else. I also get a lot of other stuff out of it just before this problem area...
This is very strange...
Thanks for the help.
|
|
|
|
|
Hi!
I have a little problem with a mfc application!
I have a sdi application with a scrollable view (CScrollView), where I draw some things with gdi.
So, to reduce flicker I draw the things first in a memory device and blit it than to the view.
I have also overwritten the "OnEraseBkgnd(CDC* pDC)" funktion (to reduce flicker free drawing):
BOOL CLmsView::OnEraseBkgnd(CDC* pDC)
{
return FALSE;
}
It works fine, but when I am open a dialog (like the Info Dialog of the app) and move the dialog on the view of the app, the view will not be repainted and so the moving dialog is working like a "rubber".
That looks very terrible... what can I do???
(SORRY FOR MY BAD ENGLISH!!!)
--
Nice greets, Daniel.
|
|
|
|
|
What does your OnDraw() function look like?
Ty
"The significant problems we face cannot be solved at the same level of thinking we were at when we created them." -Albert Einstein
|
|
|
|
|
Hi!
I have fixed the problem... It was a bug in the flicker free drawing function... I only repainted the clip-region instead of the full view...
so it works fine!
Thanks for your answer!!!
--
Nice greets, Daniel.
|
|
|
|
|
Hi!
I have fixed the problem... It was a bug in the flicker free drawing function... I only repainted the clip-region instead of the full view...
so it works fine!
--
Nice greets, Daniel.
|
|
|
|
|
Hello,
I'm trying to change my CListCtrl text for each line. With the following code, I've been able to do it successfully. However, when it comes time to AUTOSIZE (GetListCtrl().SetColumnWidth(col, LVSCW_AUTOSIZE_USEHEADER)), it seems to use the system default font to determine how wide to make each column. So to get the widths right, do I have to bite-the-bullet and calculate it all myself? Or is there a way to tell CListCtrl what type of text is in the columns?
Thanks!
JennyP
...else if ( CDDS_ITEMPREPAINT == pLVCD->nmcd.dwDrawStage ) {
....
CFont newFont;
newFont.CreateFont(15,0, 0, 0, FW_NORMAL, 0, 0, 0, 0, 0, 0, 0, 0, "Arial");
CDC* pListDC;
pListDC = pListDC->FromHandle(pLVCD->nmcd.hdc);
pListDC->SelectObject(&newFont);
newFont.Detach();
newFont.DeleteObject();
pListDC->SaveDC();
|
|
|
|
|
In the acmStreamOpen function i need to specify a function name, but the type is DWORD_PTR, and i get an error when i cast it to that type.
MMRESULT acmStreamOpen(
LPHACMSTREAM phas,
HACMDRIVER had,
LPWAVEFORMATEX pwfxSrc,
LPWAVEFORMATEX pwfxDst,
LPWAVEFILTER pwfltr,
DWORD_PTR dwCallback,
DWORD_PTR dwInstance,
DWORD fdwOpen
);
What do i do, is it something with function pointers?
Thanks.
|
|
|
|
|
You need to cast...
acmStreamOpen(phas, had, pwfxSrc, pwfxDst, pwfltr, (DWORD_PTR)Callback, dwInstance, fdwOpen)
... where 'Callback' is name of your callback function.
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
When i do that the compiler says:
Context does not allow for disambiguation of overloaded function
and in the tast list:
d:\ConvertAudio\MP3ORGANIZER\ConvertAudio\main.cpp(222): error C2440: 'type cast' : cannot convert from 'overloaded-function' to 'DWORD_PTR'
|
|
|
|
|
You have more than one function with name you're passing to acmStreamOpen. Give the callback unique name.
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
If you compile this on a WIN32 system, DWORD_PTR is an unsigned long.
(and it's __int64 if you compile using WIN64, which is 8-byte).
See <basetsd.h>
MS quote (http://www.microsoft.com/ddk) : As of September 30, 2002, the Microsoft® Windows® 2000 DDK, the Microsoft Windows 98 DDK, and the Microsoft Windows NT® 4.0 DDK will no longer be available for purchase or download on this site. Support for development will ship at the same time as the Windows XP Service Pack 1 (SP1) release.
|
|
|
|
|
How do i get the index of the selected item in list control?
|
|
|
|
|
int itemIndex = m_lstFoo.GetNextItem(-1, LVNI_SELECTED);
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
Thanks, I am able to get the index.
I have 1 more Qs.
I have written an message hanler for the list control for the message LVN_ENDLABELEDIT.
After i edit the selected field , I want to put the newly typed data in it. So, i tried to use the listctrl.GetNextItem();
listctrl.GetItemText(); --- But this fucntion has the original text & not the new text
and listctrl.SetItemText().
|
|
|
|
|
All you need to set the item text in LVN_ENDLABELEDIT handler is to return TRUE. If you're using MFC, then you need to set *pResult to TRUE.
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
|
BYTE *sSourceBuffer;
DWORD dwSourceBufferSize = 176400;
sSourceBuffer = (BYTE *)LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT, dwSourceBufferSize);
memset(sSourceBuffer, 0, dwSourceBufferSize);
When i get to the memset line i get an unhandled exception message;
Unhandled exception at 0x00414085 in MP3.exe: 0xC0000005: Access violation writing location 0x00911000.
And i jumps to some asm code:
; Set dword-sized blocks
mov ecx,edx ; move original count to ecx
and edx,3 ; prepare in edx byte count (for tail loop)
shr ecx,2 ; adjust ecx to be dword count
jz tail ; jump if it was less then 4 bytes
rep stosd <----- CURSOR IS HERE
Here's the values of the different variables:
ecx = 43079
edx = 0
tail = 0x0041408b tail
(From the command window)
Anyone know what could be wrong?
Thanks in advance.
|
|
|
|
|
Are you sure LocalAlloc call succeeds?
Tomasz Sowinski -- http://www.shooltz.com
To some its a six-pack, to me it's a support group
|
|
|
|
|
The function returns a valid handle to a piece of memory and not NULL, so it should have succeeded, BUT, i've found out that the when i allocate two pieces of memory after each other (which is what i do in my program) the second allocation is only 8 bytes away from the first one.
sSourceBuffer = (BYTE *)LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT, dwSourceBufferSize);
sDestBuffer = (BYTE *)LocalAlloc(LMEM_MOVEABLE | LMEM_ZEROINIT, dwDestBufferSize);
The first one gets the address 0x0091000c and the seconds gets 0x00910014. What could be wrong here?
BTW, at runetime the dwDestBufferSize is 73599, and the dwSourceBufferSize is 176400.
Thanks.
|
|
|
|
|
LocalAlloc() does not return a pointer, it returns a handle, aka HLOCAL. Your memset fails because the address you're sending is not really an address at all. In order to translate that HLOCAL into a valid pointer to physical memory, call LocalLock(). LocalLock will return an actual pointer to physical memory which you can then use. BTW, you wouldn't have to call memset there and initialize the buffer to zero, since you're specifying LMEM_ZEROINIT in the call to LocalAlloc()... it's redundant
DWORD dwBufferSize = 176400;
HLOCAL hBuffer = NULL;
LPVOID lpBuffer = NULL;
__try
{
hBuffer = LocalAlloc( LMEM_MOVEABLE | LMEM_ZEROINIT, dwBufferSize );
if( hBuffer )
{
lpBuffer = LocalLock( hBuffer );
if( lpBuffer )
{
}
}
}
__finally
{
if( hBuffer )
{
LocalUnlock( hBuffer );
LocalFree( hBuffer );
}
}
</code>
Ty
|
|
|
|
|
By specifying LMEM_MOVEABLE , LocalAlloc is not returning a pointer to memory, but a handle. Either use LMEM_FIXED instead, or use LocalLock to convert the handle to an actual pointer.
Joaquín M López Muñoz
Telefónica, Investigación y Desarrollo
|
|
|
|
|
|
I developed a dialer which creates an entry in DUN but the problem is tht it can't disable multilink programatically. It doesnt work with my client as it doesnt connect to their ISP as long as multilink is enabled. It works on WinXP because it can disable multilink.
I dont want to disable it globally through registry. ANybody has any thought plz share it with me if it is gonna be helpful to me.
In my dream, I was dorwning my §orrow§
But my §orrow§, they learned to §wim
|
|
|
|
|
ok I have read a few post now so I know that you have to handle the WM_KICKIDLE message to be able manipulate menus in a dialog nased app. What I now need to know is do I update the menu in the menus UPDATE_COMMAND_UI or do I have to create a CMenu object and pull and manipulate the menu in a user function? If someone could give me ALL the code snipits they used or walk my dumb @$$ through this I would apreciate it.
Darroll
Not one person lives in the present. Only the past. I can prove it.
|
|
|
|