|
Sh*t/Alt/Ctrl keys can't be sent using postmessage.
|
|
|
|
|
njhy wrote: sh*t/Alt/Ctrl keys can't be sent using postmessage.
Wrong. Those keys can be sent by using PostMessage()
::PostMessage(myHwnd, WM_KEYDOWN, VK_SHIFT, 0);
::PostMessage(myHwnd, WM_KEYUP, VK_SHIFT, 0);
This code will send a shift key press and release event to the window with the handle myHwnd . And similarly you could send just any key press event, even multiple (simultaneous) key press events.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
Try it your self. It does not work.
::PosMessage(myWnd, WM_KEYDOWN, VK_F13, 0); // VK_13 is SHIFT + F1
::PosMessage(myWnd, WM_KEYUP, VK_F13, 0);
or
::PosMessage(myWnd, WM_KEYDOWN, VK_SHIFT, 0);
::PosMessage(myWnd, WM_KEYDOWN, VK_F1, 0);
::PosMessage(myWnd, WM_KEYUP, VK_F1, 0);
::PosMessage(myWnd, WM_KEYUP, VK_SHIFT, 0);
|
|
|
|
|
Hmm... I've got it working by executing my code from within a DLL (a hook, to be precise). Neither do I have dev tools on this machine, so I can't test something right now.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
I tried in a hook DLL, but did not work either. Can you post your codes here?
|
|
|
|
|
I'll be happy to share code with you if that would help you. I'll write to you when I am on my Dev machine.
Nobody can give you wiser advice than yourself. - Cicero
.·´¯`·->Rajesh<-·´¯`·.
Codeproject.com: Visual C++ MVP
|
|
|
|
|
what about a combination of keybd_event(Shift/Ctrl/Alt) and PostMessage(key).
|
|
|
|
|
Hi everybody,
- I want to scan a list of parallel port of my PC in my app.
- and I want to set parallel port to ECP mode in BIOS from my app.
I use VC++ 6.0, Win2k.
How to do that ?
Best Regards,
Quang,
|
|
|
|
|
Hi,
The OS's from Win2000 to greater versions will not allow to access the ports directly. you may need to use a third party component to do it. i think in net u can find free libraries.
|
|
|
|
|
quangpk wrote: - I want to scan a list of parallel port of my PC in my app.
Have you tried the Win32_ParallelPort WMI class?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
- I write a DLL with funtions inport/outport, use CreateFile,OpenSCManager,OpenService,StartService,....
- I copy my App with my DLL file to some PC. some of them work ok and some other didn'n work.
Why ?
|
|
|
|
|
quangpk wrote: Why ?
I have no clue. What have you discovered using the debugger? Have you narrowed the problem down to just one or two statements? Are you checking return values from functions?
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi, I copy file hwinterface.sys to folder .../window/system32/drivers/
(I use win NT2K) my App work.
|
|
|
|
|
quangpk wrote: my App work.
Great.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Hi
I want to disable pasting on an edit control
i have created a subclass control for CEdit and am using the following bit of code to disable pasting
which works in the way it stops the user being able to paste into the edit control
but it is disabling the v character as well so they are unable to type that in
Can anyone advise on a solution, so that it disables paste but the user can still use the v char
thanks
Simon
BOOL CCPEditControl::PreTranslateMessage(MSG* pMsg)
{
switch( pMsg->message )
{
case WM_KEYDOWN:
{
switch( pMsg->wParam )
{
case 0x56:
{
if( GetKeyState(VK_CONTROL) )
return true;
}
break;
}
}
break;
case WM_RBUTTONDOWN:
{
return true;
}
break;
}
return CEdit::PreTranslateMessage(pMsg);
}
|
|
|
|
|
si_69 wrote: Can anyone advise on a solution
No, and if there was one you certainly would not find it in the documentation[^]
led mike
|
|
|
|
|
You just need to override the default processing for the WM_PASTE message, something like:
LRESULT CCPEditControl::DefWindowProc(UINT message, WPARAM wParam, LPARAM lParam)
{
switch( message )
{
case WM_PASTE:
{
return 0;
}
break;
}
return CEdit::DefWindowProc(message, wParam, lParam);
}
Gavin Taylor
|
|
|
|
|
See replies here.
"Normal is getting dressed in clothes that you buy for work and driving through traffic in a car that you are still paying for, in order to get to the job you need to pay for the clothes and the car and the house you leave vacant all day so you can afford to live in it." - Ellen Goodman
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
You found he's the same guy and linking him to the replies over there? You're such a detective.
|
|
|
|
|
We can also find questions by George_George at other sites.
Maxwell Chen
|
|
|
|
|
OK, That does it - he must be a cabal of nascent developers. All those questions cannot be the work of one man! (Or even a multi-tasking woman)
Iain.
Iain Clarke appearing in spite of being begged not to by CPallini.
|
|
|
|
|
VC++ 6.0
I am using CDatabase - for opening MDB file.
Does anyone knows anything that will give me number of tables present into databse with their names?
Thanks in advance
AmolM
|
|
|
|
|
|
Here ya go...SQLTables() wrapped in a CRecordset...
#if !defined(AFX_TABLESTABLE_H__C56C489A_652B_421F_A869_43D7E8E6D602__INCLUDED_)
#define AFX_TABLESTABLE_H__C56C489A_652B_421F_A869_43D7E8E6D602__INCLUDED_
#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000
#ifndef __AFXWIN_H__
#error include 'stdafx.h' before including this file for PCH
#endif
class CTablesTable : public CRecordset
{
DECLARE_DYNAMIC(CTablesTable)
public:
CTablesTable(CDatabase* pDatabase = NULL);
virtual BOOL Open(UINT nOpenType = forwardOnly, LPCTSTR lpszSQL = NULL,
DWORD dwOptions = readOnly);
CString m_strQualifier;
CString m_strOwner;
CString m_strTableName;
CString m_strTableType;
CString m_strRemarks;
CString m_strQualifierParam;
CString m_strOwnerParam;
CString m_strNameParam;
CString m_strTypeParam;
protected:
virtual CString GetDefaultConnect();
virtual CString GetDefaultSQL();
virtual void DoFieldExchange(CFieldExchange* pFX);
};
#endif // !defined(AFX_TABLESTABLE_H__C56C489A_652B_421F_A869_43D7E8E6D602__INCLUDED_)
#include "stdafx.h"
#include "TablesTable.h"
#if (_MANAGED == 1)
#pragma unmanaged
#endif
#ifdef _DEBUG
#define new DEBUG_NEW
#undef THIS_FILE
static char THIS_FILE[] = __FILE__;
#endif
IMPLEMENT_DYNAMIC(CTablesTable, CRecordset)
CTablesTable::CTablesTable(CDatabase* pDatabase)
: CRecordset(pDatabase)
{
m_strQualifier = _T("");
m_strOwner = _T("");
m_strTableName = _T("");
m_strTableType = _T("");
m_strRemarks = _T("");
m_nFields = 5;
m_strQualifierParam = _T("");
m_strOwnerParam = _T("");
m_strNameParam = _T("");
m_strTypeParam = _T("");
}
BOOL CTablesTable::Open(UINT nOpenType, LPCTSTR lpszSQL, DWORD )
{
ASSERT(lpszSQL == NULL);
lpszSQL;
RETCODE nRetCode;
SetState(nOpenType,NULL,noDirtyFieldCheck);
if (!AllocHstmt())
return FALSE;
TRY
{
OnSetOptions(m_hstmt);
AllocStatusArrays();
#if defined(_UNICODE)
AFX_SQL_ASYNC(this, (::SQLTables)(m_hstmt,
(m_strQualifierParam.IsEmpty()? NULL: (SQLTCHAR *)(const wchar_t *)m_strQualifierParam),
SQL_NTS,
(m_strOwnerParam.IsEmpty()? NULL: (SQLTCHAR *)(const wchar_t *)m_strOwnerParam),
SQL_NTS,
(m_strNameParam.IsEmpty()? NULL: (SQLTCHAR *)(const wchar_t *)m_strNameParam),
SQL_NTS,
(m_strTypeParam.IsEmpty()? NULL: (SQLTCHAR *)(const wchar_t *)m_strTypeParam),
SQL_NTS));
#else
AFX_SQL_ASYNC(this, (::SQLTables)(m_hstmt,
(m_strQualifierParam.IsEmpty()? (UCHAR FAR *)NULL: (UCHAR FAR *)(const char*)m_strQualifierParam),
SQL_NTS,
(m_strOwnerParam.IsEmpty()? (UCHAR FAR *)NULL: (UCHAR FAR *)(const char*)m_strOwnerParam),
SQL_NTS,
(m_strNameParam.IsEmpty()? (UCHAR FAR *)NULL: (UCHAR FAR *)(const char*)m_strNameParam),
SQL_NTS,
(m_strTypeParam.IsEmpty()? (UCHAR FAR *)NULL: (UCHAR FAR *)(const char*)m_strTypeParam),
SQL_NTS));
#endif
if (!Check(nRetCode))
ThrowDBException(nRetCode, m_hstmt);
AllocAndCacheFieldInfo();
AllocRowset();
MoveNext();
m_bBOF = m_bEOF;
}
CATCH_ALL(e)
{
Close();
THROW_LAST();
}
END_CATCH_ALL
return TRUE;
}
CString CTablesTable::GetDefaultConnect()
{
return _T("ODBC;");
}
CString CTablesTable::GetDefaultSQL()
{
ASSERT(FALSE);
return _T("!");
}
void CTablesTable::DoFieldExchange(CFieldExchange* pFX)
{
pFX->SetFieldType(CFieldExchange::outputColumn);
RFX_Text(pFX, _T("table_qualifier"), m_strQualifier);
RFX_Text(pFX, _T("table_owner"), m_strOwner);
RFX_Text(pFX, _T("table_name"), m_strTableName);
RFX_Text(pFX, _T("table_type"), m_strTableType);
RFX_Text(pFX, _T("remarks"), m_strRemarks);
} Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
Im currently working on CGridCtrl. I need to support atleast 50,000 rows so i opted for the virtual mode.
The problem raised when I have to add controls into my Grid such as Check boxes and combo boxes. I also want set the
color of the text in virtual mode.
Will you be able to help me out here.
Im very desperate...
Thanks
Rajith
|
|
|
|