 |

|
no, it works fine. It is definately not hardware. I could be that one mouse is fly wheel and other is not, or it could be that the code I'm using is wrong in someway
|
|
|
|

|
Could it be a "helpful hidden feature" of the mouse-driver?
|
|
|
|

|
Yes, but that would affect all applications, which it clearly isn't.
|
|
|
|

|
No, it would not; some programmers would simply take the first message, and ignore the repeating drivel, just like you would with spurious wm_mousemove messages.
Update the drivers
|
|
|
|

|
Not really. There's no way to tell which are real events and which are the spurious ones. At least, there's no way I know.
|
|
|
|

|
You haven't posted any code or shown what any of the "extra" WM_MOUSEWHEEL events you are getting look like and unfortunately, my crystal ball is in the shop, so you might want to post that kind of information. My guess is that its something in your code, but until I see the messages or your code, I can't really give you any advice beyond that. Darn crystal ball shop, they are taking FOREVER to get my ball fixed.
|
|
|
|

|
how write program paint in win32?
|
|
|
|

|
- Study the C/C++ languages.
- Learn the structure of Windows programs and how to create them.
- Study the Win32 API starting here.
- Decide on whether to use Windows GDI or GDI+.
- Design your application.
- Start coding.
One of these days I'm going to think of a really clever signature.
|
|
|
|

|
You are absolutely right Richard
|
|
|
|

|
First you should study what is win32 programming. If you don't know about win32 programming, then how can coding win32 programs? so first study win32 APIs
http://www.winprog.org/tutorial/
Also see Richards comments
|
|
|
|

|
Hi,
This is an article that can help you:
Guide to WIN32 Paint for beginners[^]
It doesn't explain how to create a Paint program, but how to paint shapes in your form.
In some cases, my signature will be longer then my message...
<em style="color:red">ProgramFOX</em> ProgramFOX
|
|
|
|

|
Follow the Book "Programming Windows 5th Edition - Charles Petzold"
|
|
|
|
|

|
May as well be asking how to skin a cat.
Steve
|
|
|
|

|
I want to playback videos with Microsoft Media foundation with a custom clock.
I am starting with the example found at http://archive.msdn.microsoft.com/Project/Download/FileDownload.aspx?ProjectName=mediafoundation&DownloadId=8413[^]
The idea is to replace the clock with one that is driven by UDP packets. The videos will be silent (the audio turned off, preferably not even decoded).
I have stubbed out what I think is a clock replacement, but what I can't figure out is why my calls to GetCorrellatedTime seem to only occur at the start of playback. I expected GetCorrellatedTime to be called by the playback engine repeatedly.... but that's just not happening. Here's the cpp code for my timesource. Note that it doesn't do much of anything yet... it is just a stub.
Any Ideas? Thanks in advance
#include "MFPlayer.h"
#include "TimeSource.h"
HRESULT STDMETHODCALLTYPE UDPClock::GetClockCharacteristics( __RPC__out DWORD *pdwCharacteristics)
{
*pdwCharacteristics = MFCLOCK_CHARACTERISTICS_FLAG_FREQUENCY_10MHZ;
return S_OK;
}
HRESULT STDMETHODCALLTYPE UDPClock::GetCorrelatedTime( DWORD dwReserved, __RPC__out LONGLONG *pllClockTime, __RPC__out MFTIME *phnsSystemTime)
{
m_Time = GetTickCount64();
m_System_Time = GetTickCount64();
*pllClockTime = m_Time;
*phnsSystemTime = m_System_Time;
return S_OK;
}
HRESULT STDMETHODCALLTYPE UDPClock::GetContinuityKey( __RPC__out DWORD *pdwContinuityKey)
{
*pdwContinuityKey = 0;
return S_OK;
}
HRESULT STDMETHODCALLTYPE UDPClock::GetState( DWORD dwReserved, __RPC__out MFCLOCK_STATE *peClockState)
{
*peClockState = MFCLOCK_STATE_RUNNING;
return S_OK;
}
HRESULT STDMETHODCALLTYPE UDPClock::GetProperties( __RPC__out MFCLOCK_PROPERTIES *pClockProperties)
{
pClockProperties->qwCorrelationRate = 1000000;
pClockProperties->guidClockId = GUID_NULL;
pClockProperties->qwClockFrequency = MFCLOCK_CHARACTERISTICS_FLAG_FREQUENCY_10MHZ;
pClockProperties->dwClockTolerance = MFCLOCK_TOLERANCE_UNKNOWN;
pClockProperties->dwClockJitter = 1; pClockProperties->dwClockFlags = MFCLOCK_RELATIONAL_FLAG_JITTER_NEVER_AHEAD;
return S_OK;
}
HRESULT STDMETHODCALLTYPE UDPClock::GetUnderlyingClock( __RPC__deref_out_opt IMFClock **ppClock)
{
*ppClock = this;
return S_OK;
}
HRESULT UDPClock::QueryInterface (REFIID riid, LPVOID * ppvObj)
{
if (!ppvObj)
return E_INVALIDARG;
*ppvObj = NULL;
if (riid == IID_IUnknown || riid == IID_IMFClock || riid == IID_IMFPresentationClock)
return NOERROR;
return E_NOINTERFACE;
}
ULONG UDPClock::AddRef()
{
InterlockedIncrement(&m_cRef);
return m_cRef;
}
ULONG UDPClock::Release()
{
ULONG ulRefCount = InterlockedDecrement(&m_cRef);
if (0 == m_cRef)
{
delete this;
}
return ulRefCount;
}
HRESULT STDMETHODCALLTYPE UDPClock::OnClockStart( MFTIME hnsSystemTime, LONGLONG llClockStartOffset)
{
return S_OK;
}
HRESULT STDMETHODCALLTYPE UDPClock::OnClockStop( MFTIME hnsSystemTime)
{
return S_OK;
}
HRESULT STDMETHODCALLTYPE UDPClock::OnClockPause( MFTIME hnsSystemTime)
{
return S_OK;
}
HRESULT STDMETHODCALLTYPE UDPClock::OnClockRestart( MFTIME hnsSystemTime)
{
return S_OK;
}
HRESULT STDMETHODCALLTYPE UDPClock::OnClockSetRate( MFTIME hnsSystemTime, float flRate)
{
return S_OK;
}
|
|
|
|

|
I am using ExtTextOut to print unicode characters in memory DC. We create font using CreateFontIndirect to print characters in different orientations. When we use GB2312_CHARSET (chinese character set) with lfEscapement/orientation set to 270 degrees the characters are printed in reverse order.
If the character to be printed is 'Chinese', it is printed as 'esenihc'. The same character set works fine if lfEscapement/orientation is set to 0 deg.
The issue is present only in WINCE. The same code works fine in a Win32 application.
I have written a sample application.Find below the code from sample app
CSampView::OnDraw (CDC* pDisplayDC)
{
HDC hDC = CreateCompatibleDC(NULL);
HBITMAP hBmp = CreateCompatibleBitmap(hDC, width, height);
BITMAPINFO biBitmapInfo;
// font size may vary if screen resolution changes
biBitmapInfo.bmiHeader.biSize = sizeof(BITMAPINFOHEADER);
biBitmapInfo.bmiHeader.biWidth = 500;
biBitmapInfo.bmiHeader.biHeight = 500;
biBitmapInfo.bmiHeader.biPlanes = 1;
biBitmapInfo.bmiHeader.biBitCount = 1 ;
biBitmapInfo.bmiHeader.biCompression = BI_RGB;
biBitmapInfo.bmiHeader.biSizeImage = 0;
biBitmapInfo.bmiHeader.biXPelsPerMeter = 0;
biBitmapInfo.bmiHeader.biYPelsPerMeter = 0;
biBitmapInfo.bmiHeader.biClrUsed = 0;
biBitmapInfo.bmiHeader.biClrImportant = 0;
biBitmapInfo.bmiColors[0].rgbBlue = 0;
biBitmapInfo.bmiColors[0].rgbGreen = 0;
biBitmapInfo.bmiColors[0].rgbRed = 0;
biBitmapInfo.bmiColors[1].rgbBlue =1;
biBitmapInfo.bmiColors[1].rgbGreen = 1;
biBitmapInfo.bmiColors[1].rgbRed = 1;
CDC *pDC = CDC::FromHandle(hDC);
/*TCHAR szString[255] = {0x0043, 0x0068, 0x0069, 0x006E, 0x0065, 0x0073, 0x0065, 0x003A, 0x0020, 0x96C5,
0x864E, 0x641C, 0x661F, 0x575A, 0x51B3, 0x5426, 0x8BA4, 0x80E1, 0x6208, 0x63A5,
0x62CD, 0x96C5, 0x864E, 0x5E7F, 0x544A };*/
wchar_t szString[255] = _T("Print Test");
PUINT8 pui8ImageContent;
// Create rendering canvas
HBITMAP hBmp1 = CreateDIBSection(hDC,
&biBitmapInfo,
DIB_PAL_COLORS,
(void**)&pui8ImageContent,
NULL,
0);
HBITMAP holdObj = (HBITMAP)SelectObject(hDC, hBmp1);
if (NULL == holdObj)
{
AfxMessageBox(L"Bitmap Selection failed");
}
CBitmap* aBMP = CBitmap::FromHandle(hBmp);
BITMAP* abmpDim = NULL;
aBMP->GetBitmap(abmpDim);
memset(pui8ImageContent, 0, m_iOverallSizeInBytes);
LOGFONT SLogFont = {0};
memset(&SLogFont, 0, sizeof(LOGFONT));
SLogFont.lfHeight = 50;
SLogFont.lfWidth = 50;
SLogFont.lfCharSet = GB2312_CHARSET /*HANGUL_CHARSET*//*DEFAULT_CHARSET*/;
SLogFont.lfEscapement = 2700;
SLogFont.lfOrientation = 2700;
SLogFont.lfItalic = FALSE;
SLogFont.lfUnderline = FALSE;
SLogFont.lfStrikeOut = FALSE;
SLogFont.lfOutPrecision = OUT_DEFAULT_PRECIS;
SLogFont.lfClipPrecision = CLIP_DEFAULT_PRECIS;
SLogFont.lfQuality = DEFAULT_QUALITY;
SLogFont.lfPitchAndFamily = VARIABLE_PITCH|FF_ROMAN;
wcscpy(SLogFont.lfFaceName,_T("@Simsun"));
HFONT hChFont = CreateFontIndirect(&SLogFont);
if (NULL == hChFont)
{
AfxMessageBox(L"Font Creation failed");
}
CFont* pFont = pDC->GetCurrentFont();
HFONT hFont = (HFONT)SelectObject(hDC, hChFont);
if (NULL == hFont)
{
AfxMessageBox(L"Font selection failed");
}
BOOL aStringWtitten = ExtTextOut(
hDC, // Rendering canvas
SSize.cy + iVerStartBit + 50, // x-offset
100, // y-offset
ETO_OPAQUE,
NULL,
szString,
wcslen(szString),
NULL);
if (false == aStringWtitten)
{
AfxMessageBox(_T("Write text failed"));
}
BitBlt(pDisplayDC->GetSafeHdc(),50, 0, 500, 500, hDC, 0, 0, SRCCOPY);
}
|
|
|
|

|
Have i asked the question in a wrong forum
|
|
|
|

|
Nope, this is the correct forum; but your question might be a bit too advanced for most of us. I'd be looking for an alternative by now, like painting the text on a bitmap and rotate that.
Did you solve your problem? If yes, how?
|
|
|
|

|
I guess this is a bug, its not uncommon. Especially because the win32 (more maintained) sibling works well.
|
|
|
|

|
Hi,
I tried to port the fork API in Linux to Windows (Windows 7 and Windows 8) using the native API RtlCloneUserProcess as discussed in the following link.
http://social.msdn.microsoft.com/Forums/en-US/windowsgeneraldevelopmentissues/thread/afdf1b68-1f3e-47f5-94cf-51e397afe073/
With the RtlCloneUserProcess function, child process is created, but didn’t get the console handle, stdin, stdout etc. The solution is to inform the CSR /win32 subsystem about the new process. But I could not able to do that. Please help me to re link the child process to the CSR.
|
|
|
|

|
akhilmv88 wrote: With the RtlCloneUserProcess function, child process is created, but didn’t get the console handle, stdin, stdout etc.
I see more risks; an app locking a file that gets forked, will be in trouble.
akhilmv88 wrote: The solution is to inform the CSR /win32 subsystem about the new process.
I did not see that "solution" in the thread you linked.
akhilmv88 wrote: But I could not able to do that.
Include the error-message, or at least the return-value.
|
|
|
|

|
In the link it is given that “For the console, you do need to re-establish a link to csrss, but the setup is only done in ntdll if the CsrPort handle is NULL. This isn't the case in the forked process which of course, has the parent processes handle value. Nowhere in ntdll sets it to back to NULL so there's no chance of getting that to work unless you d/l the ntdll symbols, find where the handle is, and NULL it out yourself.”
Also on further analysis on the CRS, it is understood that CSRSS is responsible for Win32 console handling. The link, http://translate.google.co.in/translate?hl=en&sl=ru&u=http://www.wasm.ru/forum/viewtopic.php%3Fid%3D42246&prev=/search%3Fq%3DCsrClientCallServer%26hl%3Den%26tbo%3Dd%26biw%3D991%26bih%3D598&sa=X&ei=e17FUNP7NMrtrQeA7IFo&ved=0CGAQ7gEwBg , gave some idea to manually notify the CSR about the new process, but I could not able to do that in windows 7.
The CsrClientCallServer function returns a negative value and the data buffer to the api CsrClientCallServer got corrupted after the call.
|
|
|
|

|
Not a word on that function in MSDN. CsrClientCallServer is an undocumented (internal) function, and it's fingerprint may vary without warning.
Sorry, can't help here.
|
|
|
|

|
How can an item be added to context menu that pops up when highlighting a part of text in any program and right clicking ? And a code should be associated with that which processes the piece of text highlighted. The item should be added to every programs context menu when text can be selected;ex Internet Explorer , Firefox , notepad, etc...
I have some general methods in my mind from my studies revolving around windows internals. But no specifics.
What is the best way to do it ? can this be done by writing code in kernel mode ? how ? is it necessary ? what are other methods which involve user mode programming ?
|
|
|
|

|
You cannot add items to every context menu on the system; not all of them are dynamic. You can add to Windows Explorer and (probably) IE by writing extensions or via other published interfaces. Try a Google search for samples and articles on the subjects.
One of these days I'm going to think of a really clever signature.
|
|
|
|
 |
|