|
|
That was the first thing I tried: that function is never called! To see for yourself if you want, use the wizard and make a UI/Background plugin for WMP. It's never called, possibly because it's a "background" plugin?
|
|
|
|
|
Not knowing anything about WMP9, but could you possibly hijack the window message handler for the main application window to intercept all the messages it is getting? You could respond to the ones you wanted and call the regular window handler for those you did not want?
|
|
|
|
|
I have no idea how I'd go about doing that, though; my plugin never gets a HWND.
I've actually worked around the no-hotkey problem by intuitively tying the function (don't skip this commercial) to the seekbar: if the user seeks twice inside a section containing a commercial within a few seconds, that commercial section is internally ignored.
|
|
|
|
|
Hello.
I have posted a question about this before but i wrote it bad. So i try again.
I'm working with a program that storage BMP and WAV files in one file. I'm almost finished with it but I want to make it show BMP files directly from the packed file without extracting it.
I have tried many times but I can't make function to put BITMAPINFOHEADER and BITMAPINFO correct data.
///////////////////////////////////////////////////////////////////////////////
LPTSTR szFileName = "C:\\Min Projekt\\MittPixelTest\\3_16.bmp";
CFile test;
test.Open(szFileName, CFile::modeRead);
DWORD m_nMaxSize = test.GetLength();
void *pBuf = (BYTE *) malloc(sizeof(BYTE) * m_nMaxSize);
test.ReadHuge((LPVOID) pBuf, m_nMaxSize);
LoadBMPImage(pBuf, m_nMaxSize, myBmp, &myPalette);
///////////////////////////////////////////////////////////////////////////////
BOOL CMyArchiveDlg::LoadBMPImage(void* vBits, DWORD len, CBitmap &bitmap, CPalette *pPal)
{
BITMAPFILEHEADER bmfHeader;
// Read file header
if (!memcpy((LPSTR)&bmfHeader, vBits, sizeof(bmfHeader)))
return FALSE;
// File type should be 'BM'
if (bmfHeader.bfType != ((WORD) ('M' << 8) | 'B'))
return FALSE;
// Get length of the remainder of the file and allocate memory
DWORD nPackedDIBLen = len - sizeof(BITMAPFILEHEADER);
HGLOBAL hDIB = ::GlobalAlloc(GMEM_FIXED, nPackedDIBLen);
if (hDIB == 0)
return FALSE;
// Read the remainder of the bitmap file.
if (!memcpy((LPSTR)hDIB, vBits, nPackedDIBLen))
{
::GlobalFree(hDIB);
return FALSE;
}
BITMAPINFOHEADER &bmiHeader = *(LPBITMAPINFOHEADER)hDIB ; // Gets wrong data
BITMAPINFO &bmInfo = *(LPBITMAPINFO)hDIB ;
// If bmiHeader.biClrUsed is zero we have to infer the number
// of colors from the number of bits used to specify it.
int nColors = bmiHeader.biClrUsed ? bmiHeader.biClrUsed :
1 << bmiHeader.biBitCount; // Color value is to high!!
LPVOID lpDIBBits;
if( bmInfo.bmiHeader.biBitCount > 8 )
lpDIBBits = (LPVOID)((LPDWORD)(bmInfo.bmiColors + bmInfo.bmiHeader.biClrUsed) +
((bmInfo.bmiHeader.biCompression == BI_BITFIELDS) ? 3 : 0));
else
lpDIBBits = (LPVOID)(bmInfo.bmiColors + nColors);
// Create the logical palette
if( pPal != NULL )
{
// Create the palette
if( nColors <= 256 )
{
UINT nSize = sizeof(LOGPALETTE) + (sizeof(PALETTEENTRY) * nColors);
LOGPALETTE *pLP = (LOGPALETTE *) new BYTE[nSize];
pLP->palVersion = 0x300;
pLP->palNumEntries = nColors;
for( int i=0; i < nColors; i++)
{
pLP->palPalEntry[i].peRed = bmInfo.bmiColors[i].rgbRed;
pLP->palPalEntry[i].peGreen = bmInfo.bmiColors[i].rgbGreen;
pLP->palPalEntry[i].peBlue = bmInfo.bmiColors[i].rgbBlue;
pLP->palPalEntry[i].peFlags = 0;
}
pPal->CreatePalette( pLP );
delete[] pLP;
}
}
CClientDC dc(NULL);
CPalette* pOldPalette = NULL;
if( pPal )
{
pOldPalette = dc.SelectPalette( pPal, FALSE );
dc.RealizePalette();
}
HBITMAP hBmp = CreateDIBitmap( dc.m_hDC, // handle to device context
&bmiHeader, // pointer to bitmap size and format data
CBM_INIT, // initialization flag
lpDIBBits, // pointer to initialization data
&bmInfo, // pointer to bitmap color-format data
DIB_RGB_COLORS); // color-data usage
bitmap.Attach( hBmp ); // Here it's stops. Debug error!
if( pOldPalette )
dc.SelectPalette( pOldPalette, FALSE );
::GlobalFree(hDIB);
return TRUE;
}
I guess I use wrong type to put bitmap data but if anyone knows what's wrong with this function it would be great
|
|
|
|
|
First:
if (!memcpy((LPSTR)hDIB, vBits, nPackedDIBLen))
well normaly I would have called GlobalLock() to get the pointer, but hDIB is realy a pointer so this should work ( LPSTR should be LPVOID ).
The problem with the line is that vBits points to the start of the buffer, where the BITMAPFILEHEADER is stored and you are trying to copy the information following it:
if (!memcpy((LPSTR)hDIB, (LPBYTE)vBits + sizeof(BITMAPFILEHEADER), nPackedDIBLen))
That should fix the following:
BITMAPINFOHEADER &bmiHeader = *(LPBITMAPINFOHEADER)hDIB ; // Gets wrong data
BITMAPINFO &bmInfo = *(LPBITMAPINFO)hDIB ;
(interesting use of references!)
Try takeing a look at the CDibData article; I wrote the class so that it could take a handle to a DIB (see CDibData::Attach()) just like the clipboard.
INTP
|
|
|
|
|
Hi!
I keep getting a "User Breakpoint called from code at 0x......." I do not have any breakpoints set, but my execution seems to keep halting.
I notice if i comment out a few function function calls, my program works ok. So it seems like this error occurs when my DLL becomes a certain size.
I've never seen this before and dont know where to start trying to figure out where/how to debug it. I'm not doing anything fancy: My project is a multithreaded dll, using MFC as a shared dll. I have classes defined w/ normal inheritance and I'm including version.lib and ws2_32.lib for libraries.
I've never seen my execution simply halt. Any help would be GREATLY appreciated!! TIA.
-C
|
|
|
|
|
what about using a debugger to trace the breakpoint? it is prolly a simple assert statement.
Don't try it, just do it!
|
|
|
|
|
Apparently CFormView doesn't handle Keyboard Accelerators. that is until you have selected a form element like a textbox or list. But since I would rather have the formview recognize an accelerator without having to go in this direction is there a way I can work around this.
I have this solution, but I don't think it is working the way it should or perhaps is the wrong solution. In a nutshell I have the following code which when a document in opened and the form appears, OnInitialUpdate() is called and I call LoadAccelerators and load the handle into a variable. Later I override PreTranslateMessage() and check for this handle then call ::TranslateAccelerator() which I'm thinking takes in a window handle, thus I used my main window handle where at the accelerator keys work, the accelerator handle then the message. Here is the code.
void CFormGameOnView::OnInitialUpdate()
{
m_haccel=LoadAccelerators(AfxGetInstanceHandle(),
MAKEINTRESOURCE(IDR_FORMGAMEONVIEW_TMPL));
...
}
BOOL CFormGameOnView::PreTranslateMessage(MSG* pMsg)
{
CMainFrame *pMain = (CMainFrame*)AfxGetMainWnd();
if(m_haccel)
{
if(::TranslateAccelerator(pMain->m_hWnd, m_haccel, pMsg))
return TRUE;
}
return CFormView::PreTranslateMessage(pMsg);
}
Is this the right approach or is there a better approach?
Thanks!
|
|
|
|
|
I've never posted in this board before. This is actullay the first time i've clicked on it.
Anyways, I was reading that in C# the only way to get parallel port access in Windows XP is via a kernal mode driver. Now, I did this and it worked fine.
But, i'm messing around with C, right now and I was using the _inp and _outp functions in conio.h
So, here's my question: Can I get hardware access directly with C in windows XP? Like on 95 and 98 where I can just to _outp and it goes to whatever port I say.
/\ |_ E X E GG
|
|
|
|
|
In case of C too you need a kernel mode driver in win2k and xp
|
|
|
|
|
that's not cool. thanks for your answer.
/\ |_ E X E GG
|
|
|
|
|
|
eggie5 wrote:
Can I get hardware access directly with C in windows XP? Like on 95 and 98 where I can just to _outp and it goes to whatever port I say.
No.
I'll write a suicide note on a hundred dollar bill - Dire Straits
|
|
|
|
|
thanks for your answer.
/\ |_ E X E GG
|
|
|
|
|
This function works great when I compile a project
using Unicode Debug. Is there any similiar function
if I just use Debug mode?
|
|
|
|
|
|
I get
BindStatusCallback.obj : error LNK2001: unresolved external symbol __imp__StrFormatByteSizeA@12
Debug/Setup.exe : fatal error LNK1120: 1 unresolved externals
Its the BindStatusCallback.cpp code that you posted on
December 24, 1999: Version 1.0. Any chance you updated it since 1999?
Please let me know. My email address is brinasas@yahoo.com
The code works fine for Unicode, but in Ansi, I keep getting that
error. Drives me nuts.
I love "...give me credit where it's due. I'll know if you
don't. bwa ha ha ha ha!"
Sincerely
Danielle Brina (an overworked graduate student)
|
|
|
|
|
Hello...
I'm currently writing a program that has to read in data from the serial port and then process it. But I thought before I tackle that part, I should write a small sample one to test to see that I can actually receive data.
I got this sample program off the MSDN website and made a couple of minor changes (original can be found here: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/devio/base/monitoring_communications_events.asp ) to reflect the fact that it's supposed to look for any characters received.
#include [windows.h]
#include [assert.h]
#include [conio.h]
#include [iostream]
void main()
{
HANDLE hCom;
OVERLAPPED o;
BOOL fSuccess;
DWORD dwEvtMask;
hCom = CreateFile( "COM1",
GENERIC_READ,
0,
NULL,
OPEN_EXISTING,
FILE_FLAG_OVERLAPPED,
NULL
);
if (hCom == INVALID_HANDLE_VALUE)
{
return;
}
fSuccess = SetCommMask(hCom, EV_CTS | EV_DSR);
if (!fSuccess)
{
return;
}
o.hEvent = CreateEvent(
NULL,
FALSE,
FALSE,
NULL
);
o.Internal = 0;
o.InternalHigh = 0;
o.Offset = 0;
o.OffsetHigh = 0;
assert(o.hEvent);
if (WaitCommEvent(hCom, &dwEvtMask, &o))
{
if (dwEvtMask & EV_RXCHAR)
{
cout << "received!";
}
if (dwEvtMask & EV_CTS)
{
}
}
getch();
}
This program, when compiled, does not output "received!", even though I know there is data being sent to the serial port (COM1). Any suggestions as to why? Is there a better way to monitor for the reception of characters through the serial port? Any help is appreciated.
Thanks in advance.
|
|
|
|
|
The ReadFile function also has me a bit concerned.
Assuming WaitCommEvent works, and the "event" is that a character has been received (EV_RXCHAR), would this piece of code output the character that was received (data)?
OVERLAPPED obj;
BOOL fsuccess;
HANDLE hCom;
BYTE data;
DWORD event = EV_RXCHAR;
DWORD transferred;
if (WaitCommEvent(hCom, &event, &obj))
{
cout << "IT DETECTED SOMETHING! ";
fsuccess = ReadFile (hCom, &data, 1, &transferred, &obj);
if (fsuccess)
{
cout << "IT READ A CHARACTER: " << data;
}
getch();
}</code>
Oh, in both of the above programs, the serial port is constantly being fed data continuously. Thanks for any help.
|
|
|
|
|
You (or the MSDN example) does not configure the timeout values for the communications port. These timeouts MUST be specified, otherwise the last settings which were effect on the port (by another application or by system defaults) are applied, and may cause serious misbehaviour.
For information how to configure the timeouts and what timeouts are needed, see MSDN with the keyword 'SetCommTimeouts'. Also, if you need a non-overlapped I/O sample, see this CodeProject article and browse through it's source code.
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
I'd like to make an ActiveX control, but deriving it from MFC's CListCtrl class. Is this possible? I try the regular MFC ActiveX control wizard and choose 'none' for which class to subclass, but when I try to replace all instances of the COleControl, I get a bunch of errors. Can anyone help? I want to do a little extending to the MFC control and allow VB users to use it. Thanks in advance!!!;);)
If it's broken, I probably did it
bdiamond
|
|
|
|
|
It might be that your terminology is a bit wrong, but let's see now...
An ActiveX control is a control of it's very own type. Just like a CListCtrl represents a list control, an ActiveX control represents an ActiveX control
Normally, the ActiveX control contains a normal window. This window can then contain other controls, like the list control you specified.
The most effective way here would be to use the wizards to create a standard, windowed ActiveX control. Then, in the construction routine of the window, initialize a member variable of type CListCtrl. On the creation routine (of the window), create a standard Windows child list control, for which the ActiveX control's window works as a parent.
This way, the actual control class will expose the interfaces that are required to make it an ActiveX control. The window and the child list control can be used just like a normal CWnd-class window that has a list control.
Just remember to add properties and necessary methods to the ActiveX controls for VB users to control all the necessary features of the control. And of course remember to implement all these properties so that they'll also do something
-Antti Keskinen
----------------------------------------------
The definition of impossible is strictly dependant
on what we think is possible.
|
|
|
|
|
thank you!!! that was just what I needed;P;P
If it's broken, I probably did it
bdiamond
|
|
|
|
|
|