|
How can I detect when the ALT key is pressed and no other key is pressed? I wanted to change my cursor when the ALT is pressed. So i wanted to know which message is sent in this case.
Thanks
|
|
|
|
|
Try with WM_SYSKEYDOWN
<bold>- Nilesh
<italics>"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
It works only if i press a key followed by ALT. I want an event which fires when i press just the ALT key .
|
|
|
|
|
Is GetAsyncKeyState() of any help?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Yes i am using it get the state of the ALT key but the point is I want to change my cursor as soon as the user presses the ALT key so for that i would require an event being fired or Currently i am using a timer which uses GetAsyncKeyState() to get the state and then i change the app cursor.
Thanks
|
|
|
|
|
Vikash Dubey wrote:
It works only if i press a key followed by ALT.
Could you show me how and where you have written the code.
<bold>- Nilesh
<italics>"Reading made Don Quixote a gentleman. Believing what he read made him mad" -George Bernard Shaw
|
|
|
|
|
What about the WM_CHAR message?
"Ideas are a dime a dozen. People who put them into action are priceless." - Unknown
|
|
|
|
|
Hi Everybody!
what shude I do for create and develop a simple Windows Service in "Visual Studio.Net 2003" with "Visual C++" Project Type?
Is it possible that I use the "MFC" instructions in this?
If the answer is "Yes" please tel me "What To Do?"
and if not, please help me in another way.
Thanks for your guidance.
|
|
|
|
|
|
Hello everybody,
I'm looking for a client library to get and delete mails from an imap server.
Now, I use the IP Works library and the delete of the mails is too long (30 sec).
Thanks
BriceDeNice
|
|
|
|
|
On one of my dialogs I have about 70 check boxes which when checked toggle the associated bool value in an array (one bool for every check box).
Rather than create 70 check boxes on the dialog and also then write (copy) the handling code for each check box, is there an easy way to do this?
|
|
|
|
|
I would do it like that: you keep an array of CButton (I think this is the class that handle check boxes messages), then in OnInitDialog, I will instantiate this array and create the check boxes:
BOOL CyourDlg::OnInitDialog()<br />
{<br />
m_pCheckBoxesArray = new CButton[m_ChckBoxCount];<br />
for (int i=0;i<ChckBoxCount;i++)<br />
m_pCheckBoxesArray[i].Create(......);<br />
}
In the Create function, you will need to pass the Id of the control and its position. For the Id, edit the ressource file and use consecutive Id's so you can just do something like that:
for (int i=0;i<ChckBoxCount;i++)<br />
m_pCheckBoxesArray[i].Create(.., IDC_FIRSTCHCKBOX+i ,....);<br />
In the ressource file, you can do something like that:
#define IDC_FIRSTCHCKBOX 10000<br />
#define IDC_LASTCHCKBOX 10070
Then you can use the ON_CONTROL_RANGE macro instead of ON_COMMAND to map the notification messages of all your check boxes (take a look in the MSDN).
Hope this helps
|
|
|
|
|
thanks, I'll give this a try,
Andy
|
|
|
|
|
If I were you I would decide whether I need so much of them and they are all needed at once. Notice that this way gives you 2^about70 different combinations. Is every combination allowed and does make sense? I would reprogram this interface.
|
|
|
|
|
|
I have downloaded a sample program from this web-site to read data from a com-port.
When I compile and run everything is fine.
When I edit the code, and then change it back to it's original, and run the program, every second character that is recieved by the comport is false. ie.
vv.v.v.v.v.v.v.v.v.v.v.v.v.v. or 00°0°0°0°0°0°0°0°0, I can't show all the wierd characters as they are not on the keyboard.
but if I only send 1 or 2 of the same characters, then it is ok, ie.
aabbccddefghij and so on
Does anyone know what the problem might be? I'm using Visual c++ 6
I think it might be using Unicode, but still don't understand why it'll do it if I change it back to the original code. For it to work again, I have to run a fresh copy of the source code.
Thanks heaps!
(Leonardo da Vinci)
Simplicity is the ultimate sophistication.
|
|
|
|
|
Show the code in which you send the data.
|
|
|
|
|
Part of the code, link is at the bottom.
LRESULT CChildView::OnSerialMsg (WPARAM wParam, LPARAM /*lParam*/)
{
CSerial::EEvent eEvent = CSerial::EEvent(LOWORD(wParam));
CSerial::EError eError = CSerial::EError(HIWORD(wParam));
if (eError)
DisplayEvent(_T("An internal error occurred."));
.
.
. //many if statements
.
.
if (eEvent & CSerial::EEventRecv)
{
// Create a clean buffer
DWORD dwRead;
char szData[101];
const int nBuflen = sizeof(szData)-1;
// Obtain the data from the serial port
do
{
m_serial.Read(szData,nBuflen,&dwRead);
szData[dwRead] = '\0';
// Scan the string for unwanted characters
for (DWORD dwChar=0; dwChar
|
|
|
|
|
Hi group
Can anybody help me out
I want to change the background color of the header(column tab)in the ListControl
Actually i am doing a project in VC++
I am able to change the background color of the CListCtrl but i failed to change the color of the header tab,
so can anybody help me out
VC++
vcforums@gmail.com
|
|
|
|
|
Hi,
you need to owner-draw the complete headercontrol to do so, which means:
- subclass the header control that is a child of the listcontrol in its PreSubclassWIndow handler
- for every button in the headercontrol set the HDF-OWNERDRAW flag
- draw the button in the DrawItem handler
takes only some 100 lines of code...
dirk
|
|
|
|
|
Hi,
I have created a CWnd in a CPropertyPage. I want to display some drawing inside the CWnd. How can this be achieved?
I tried the following approaches but did not succeed:
1) Tried creating CWnd object in the CPropertyPage class and then override the OnInit function to draw . I used the GetDC() to get the CDC and then the GetSafeHandle() function to get the HDC. I used this handle to render my drawing. The CWnd was created but the drawing is not displayed.
2) According to a suggestion from a colleague, I tried creating separate class for the CWnd object. This was to let me override the OnPaint function of the CWnd object.
My code in OnPaint function is as follows:
PAINTSTRUCT ps;
CDC * dc = this->BeginPaint(&ps);
//draw function takes in the CDC * dc obtained in fuction above
draw();
this->EndPaint( &ps );
Then I created a object of this class in CPropertyPage class. I tried calling the create function in the constructor and OnCreate function of the property page. Here again I could at the most get my window displayed but no drawing.
Any suggestions on how to achieve this?
Also, does MFC basically support GDI in CWnd objects when created as child window of a dialog or property page?
P.S. to make sure that the code to draw is working correctly, I tried testin that by having the rendering in a document using the view class. It works correctly i.e. I can get the display in a document window but cannot get it in dialog window or to be precise CWnd instance.
Thanks in advance for your help.
Regards,
Abhijit Deshmukh
|
|
|
|
|
Hi everyone.
I have an application with a photo realistic interface and i want to use a non standard LCD type font. Is there some way i can include this inside the app like a resource, or do i really need to install it onto the users machine with the program? I cant seem to find any information on how to do this?
Any pointers would be appreciated
M
|
|
|
|
|
|
I have been writing and testing my code on win xp, and today when I tested it on win 98 it allways fails at binding the socket. WSAGetLast error is returning 0 so i don't know what is wrong. Anyone had similar problems?
[CODE]
WSADATA wsaData3;
sockaddr_in service;
service.sin_family = AF_INET;
service.sin_addr.s_addr = INADDR_ANY;
service.sin_port = htons(1336);
char recvbufer[1000];
int bytes;
int err = WSAStartup( MAKEWORD(1,0), &wsaData3 );
if(err)
MessageBox(NULL, "couldnt start", "err", 0);
SOCKET m_socket3 = socket( AF_INET, SOCK_STREAM, IPPROTO_TCP );
if ( bind( m_socket3, (SOCKADDR*) &service, sizeof(service) ) == SOCKET_ERROR ) {
MessageBox(hwnd, "Error starting up. Is another server running on this port?\n", "Error", MB_ICONSTOP);
err = WSAGetLastError();
sprintf(recvbufer, "%i", err);
MessageBox(NULL, recvbufer, recvbufer, 0);
PostQuitMessage(0);
}
if ( listen( m_socket3, 1 ) == SOCKET_ERROR ){
MessageBox(hwnd, "Error listening on socket.\n", "Error", MB_ICONSTOP);
PostQuitMessage(0);
}
[/CODE]
|
|
|
|
|
Hi friends
Please help me!
I have opened a new project in Visual Studio,and have selected "Visual C++ Project ----> MFC" from "Project Type" OK?
I want to create a simple windows service,
Now
1) which item I shude select from "Templates" ?
2) Please tel me: "what shude I do then?"
Step By Step Please ( Such as a wizard )
Excuse me! I do not know English very well
|
|
|
|