|
|
Usintg the PreTranslateMessage to obtain and process keyboard input but all the normal keys I process seem to be upper case (e.g. pMsg->wParam, seem to be ASCII upper case) even when I change the Caps Lock.
ARe they a flag that controls the case?
grahamfff
|
|
|
|
|
There are no such things as lower case keys on the keyboard. All keys are defined by a VK_xx value eg. VK_A thru VK_Z for A-Z. See winuser.h
To handle character case you need to check if the Shift Key is down or Caps Lock is on. For the shift key use:
if ( GetKeyState( VK_SHIFT ) & 0x8000 )
...;
Neville Franks, Author of ED for Windows www.getsoft.com and Surfulater www.surfulater.com "Save what you Surf"
|
|
|
|
|
Hi Guys
anyone have a clue where i can download the ddk with out being a msdn subscriber(too expensive for a student) and not paying 25 $ for shipping. Please help. I'm working on a kernel mode driver, but for this i need the DDK.
MFG
RedDragon2kx
Unix and C are the ultimate computer viruses.
|
|
|
|
|
Hi,
I am doing GUI programming using Win32 SDK (no MFC). I have a dialog box with 2 text fields, 2 static (labels) and 2 buttons. I wish resize the dialolg box and move / resize the 6 controls on it. Can anyone suggest how to get handles to all the 6 child windows to do SetWindowPos for each?
I have tried using GetWindow with GW_CHILD and GW_HWNDNEXT. However I can get only the text boxes on the dialog box. Moreover, I have noticed that the while loop to enumerate child windows goes into infinite loop.
Please suggest some solution.
|
|
|
|
|
if u have command identifiers of each control you can use GetDlgItem to get handle.
if u dont - then enumarate windows using FindWindow+FindWindowEx
4apai
There're no impossible tasks. There're tasks that required infinite period of execution time.
|
|
|
|
|
What about EnumWindows and EnumChildWindows?
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi,
Thanks for the replies. I finally managed to achieve the functionality using GetWindow itself. The problem was, I initially did a SetWindowPos immediately after acquiring the window handle to the child control. This changed the Z-order of the windows and because of which it went into infinite loop.
I have now implemented following solution:
1. Collect all the child window handles in a container such as list<hwnd>
2. Iterate through the list applying the modifications to each of the window using the window handles. This iteration has to be done using reverse_iterator. I suspect that this is essential because the first child of the parent window is the control with highest tab index, or highest Z-order. So to maintain the tab order, one has to do reverse-iteration. [Kindly confirm ]
Rgds,
Mandar
Wish you all a Very Happy New Year!
|
|
|
|
|
Hi all:
In the following code, after the TrackMouseEvent() call, does it means don't send WM_MOUSELEAVE message?
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(tme);
tme.hwndTrack = m_hWnd;
tme.dwFlags = TME_CANCEL | TME_LEAVE;
tme.dwHoverTime = 1;
_TrackMouseEvent(&tme);
and after
tme.cbSize = sizeof(tme);
tme.hwndTrack = m_hWnd;
tme.dwFlags = TME_LEAVE | TME_HOVER;
tme.dwHoverTime = 1;
_TrackMouseEvent(&tme);
does it means send WM_MOUSEHOVER and WM_MOUSELEAVE message? if so, then what about the ordinary WM_MOUSEHOVER and WM_MOUSELEAVE, Are they not function at all?
|
|
|
|
|
when you call
TRACKMOUSEEVENT tme;
tme.cbSize = sizeof(tme);
tme.hwndTrack = m_hWnd;
tme.dwFlags = TME_CANCEL | TME_LEAVE | TME_HOVER;
tme.dwHoverTime = 1;
_TrackMouseEvent(&tme);
Your application will stop receiving the WM_MOUSEHOVER and WM_MOUSELEAVE messages you previously requested by TrackMouseEvent()
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
I Need To write a program which can communicate to any connected USB device,But which device and the what data content is input by user when the program is start running.
Is There any universal driver of USB Or via Window API can be use to do this?
Under Windows XP,we can use many USB Devicies and don't need to install any USB driver,It's sholuld has a driver to handle that,Can anybody teach me how?
cheng in taipei
|
|
|
|
|
how can i develop for device driver
|
|
|
|
|
Get the device driver development kit for your OS.
I'm assuming that have hardware specs. If you don't have hardware specs, you need to get them first. Good luck - most places where not give them away.
|
|
|
|
|
I have written a dll,codes as below:
void __declspec(dllexport) __stdcall TestDialog(HWND hWnd)
{
AFX_MANAGE_STATE(AfxGetStaticModuleState());
AfxSetResourceHandle(theApp.m_hInstance);
AfxEnableControlContainer();
CTestDlg dlg;
dlg.DoModal();
AfxSetResourceHandle(AfxGetInstanceHandle());
}
void TestHello(HWND hWnd)
{
hMainDlg=hWnd;
MessageBox(hMainDlg,"Hello","Test",MB_OK);
}
µ÷Óãº
typedef void (*TestHello)(HWND);
TestHello t=NULL;
HINSTANCE hin=LoadLibrary("Test.dll");
if(NULL == hin)
return ;
t=(TestHello)GetProcAddress(hin,"TestHello");
if(NULL == t)
return;
t(m_hWnd);
FreeLibrary(hin);
typedef void (__stdcall *TestDlg)(HWND);
hin=LoadLibrary("TestHello.dll");
if(NULL == hin)
return ;
TestDlg t1=(TestDlg)GetProcAddress(hin,"TestDialog");
if(NULL == t1)
return;
t1(m_hWnd);
FreeLibrary(hin);
both the dll and exe are ok,but if I change
typedef void (*TestHello)(HWND);
into
typedef void (__stdcall*TestHello)(HWND);
Error happens in EXE,correspondingly.
typedef void (__stdcall *TestDlg)(HWND);
into
typedef void (*TestDlg)(HWND);
EXE also has a error
|
|
|
|
|
Hi,
i got the following 3 errors:
..\VC98\include\istream(546): error C2065: 'use_facet' undeclared identifier
..\VC98\include\istream(546): error C2440: 'initializing: cannot convert from 'int' to 'const class std::ctype<char>&' (No constructor could take the source type or constructor overload resolution was ambiguous)
..\VC98\include\istream(566): error C2440: cannot convert from 'int' to 'const class std::ctype<unsigned short="">'
As the compiler is showing errors in "stream" file, no guess what's wrong. Any help greatly appreciated.
|
|
|
|
|
could you show the code snippet?, It will help me and other programmer to sort out problem.
"I Think this Will Help"
Alok Gupta visit me at http://www.thisisalok.tk
|
|
|
|
|
using this code: http://www.jstookey.com/arcade/rawmouse/raw_mouse.c
http://www.jstookey.com/arcade/rawmouse/raw_mouse.h
http://www.jstookey.com/arcade/rawmouse/raw_mouse_test.c
to get raw mouse input for 2 or more mice.
What I need to be able todo is have this program running in the background while still logging the mice. So that I can use my computer while logging the movements of the other connected mice.
It is usuable just with one mouse, so you don't need 2 mice to run the code.
It also required Windows SDK to compile....
From MSDN: Reading Raw Input
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/rawinput/aboutrawinput.asp
An application receives raw input from any HID whose top level collection (TLC) matches a TLC from the registration. When an application receives raw input, its message queue gets a WM_INPUT message and the queue status flag QS_RAWINPUT is set (QS_INPUT also includes this flag). An application can receive data when it is in the foreground and when it is in the background.
So it is possible, I just don't know how....
|
|
|
|
|
Hi.
I'm hoping you could help me with a problem i have.
I'm a student at university who is currently doing a project on Anti-Patterns in Multithreading (using VB.net to demonstrate this...yes please dont mock me for the vb.net bit! :P).
Basically i need to see what common problems / mistakes made (nothing too complex) in multithreading in langauges such as Java/C++ and to see if these problems have been solved in VB.net or, if they still exist, to develop an anti-pattern solution for them. So i was wondering if during your experience you had come across some common problems / mistakes (aka Anti-Patterns) that programmers would make in coding Multi-threading applications (either due to a language limitation (Java mainly or C++) or just a general Multi-Threading problem (i.e Dead Locking ), as i'm struggling to find sources of information that lists the problems in any sort of detail. If you cannot help but could put me in the direction of sources online which would cover the common anti-patterns i would be extremely greatful.
Thanks in advance.
|
|
|
|
|
Does anyone know the algorithm used by ::MessageBox() to work out how big to make the buttons in the dialog box? It seems to depend on the font size chosen in Display Properties -> Advanced -> Item = Message Box. Information about the font is available in ncm.lfMessageFont after doing:
NONCLIENTMETRICS ncm;
memset(&ncm, 0, sizeof(ncm));
ncm.cbSize = sizeof(ncm);
::SystemParametersInfo(SPI_GETNONCLIENTMETRICS, 0, &ncm, 0);
but how does ::MessageBox() get from there to the default button width and height? I've had a look at all the Windows routines that give system information, but I can't find the answer.
Cheers,
Chris.
|
|
|
|
|
It is base on DialogBaseUnits. The buttons are sized in DialogBaseUnits, and the size in pixels is calculated using the MapDialogRect() function that converts from DialogBaseUnits to pixels depending on the font used.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
void CRegionWindowWnd::CreateGraphics(CWnd *pWnd)
{
if (pWnd == NULL)
return;
CRect rc;
// Get the client area
pWnd->GetClientRect(&rc);
//VALIDAREA(rc);
// Size not changed, don't do anything
if (rc.Width() == m_drawArea.Width() && rc.Height() == m_drawArea.Height())
return;
// Create bitmap
HWND hWnd = pWnd->GetSafeHwnd();
ASSERT (::IsWindow(hWnd));
Graphics graph(hWnd);
ASSERT (rc.Width() > 0);
ASSERT (rc.Height() > 0);
Bitmap *pBitmap = new Bitmap(rc.Width(), rc.Height(), (Graphics*)(&graph));//!!!error 1 here
ASSERT (pBitmap);
ASSERT (pBitmap->GetLastStatus() == Ok);
//Create graphics object
Graphics *pGraphics = new Graphics(pBitmap);//!!!error 2 here
ASSERT (pGraphics);
ASSERT (pGraphics->GetLastStatus() == Ok);
// If resizing, draw previous bitmap to reduce blinking
if (m_pBitmap)
{
pGraphics->DrawImage(m_pBitmap, 0, 0);
}
else
{
// Clean the bitmap
//Color clr(0,0,0);
//SolidBrush brush(clr);
//Rect rect = ToRect(rc);
//pGraphics->FillRectangle(&brush, rect);
}
// Store old members
Bitmap *pOldBitmap = m_pBitmap;
Graphics *pOldGraph = m_pGraphics;
// Set new graphics and bitmap
//m_pViewInfo->SetGraphics(pGraphics);
m_drawArea = rc;
m_pBitmap = pBitmap;
m_pGraphics = pGraphics;
delete pOldGraph;
delete pOldBitmap;
}
error C2660: 'Gdiplus::GdiplusBase::operator new' : function does not take 3 arguments
error C2660: 'Gdiplus::GdiplusBase::operator new' : function does not take 3 arguments
Why?
the initializing work had been done already...But this problem seems it not work...
|
|
|
|
|
Answer from Alex Farber :
This happens in Debug configuration of MFC project. I solve this problem by such way:
#ifdef _DEBUG
#undef new
Bitmap* pMemBitmap = new Bitmap(nWidth, nHeight);
#define new DEBUG_NEW
#endif
Looks ugly, but it works.
It did work,
thanks Alex Farber...
|
|
|
|
|
It is cleaner to just use the global new operator
Bitmap *pMemBitmap = ::new Bitmap(nWidth, nHeight);
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Hello,
I want to use crystalReport10 in my VC++ app.
But after instert it shows me a white paper only,
Can any one help me?
Happy Christmas.
Thanks.
|
|
|
|
|
Does anyone know how to add 'OK', 'Apply','Cancel' button to a modeless propertysheet just like the model one?
Thanks.
Lisoft
|
|
|
|