|
|
I'm writing a practice-program that sends key press to another window (obtained HWND of that window already). I've looked into MSDN for WM_KEYDOWN and WM_KEYUP messages but got a little confused by the sheer complexity of wParam and lParam. I think I just need a little real example (which I failed to find any) to get ahold of that.
Could someone please gimme the sample code which will send key press for character '?'(question mark) to a window, suppose hTestWnd is the valid HWND of that window. Thanks a lot.
|
|
|
|
|
::SendMessage(hTestWnd, WM_CHAR, (WPARAM) '?', (LPARAM) 0);
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Great, how about sending those special keys, say, VK_F12?
Thank you again.
|
|
|
|
|
I'm relying on the implicit conversion of int to char here, I suspect the second parameter is where you'd specify if it was an F key, unless that's one of the keys sent with the SYSKEY stuff. I really don't know - how would you see an F12 in an edit box anyhow ?
http://msdn.microsoft.com has full docs on WM_CHAR, that's where I looked in the first place.
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
Yeah I know i can't see F12... but as I said at beginning I was doing some practice so it's just that, a practice.
Anyway, I will dig into MSDN again and thanks very much for your help.
|
|
|
|
|
Can someone show me how to use MCI control on a dialog application? I need to:
(a) Play an avi file with movie window frame within the dialog itself...
(b) And I also need to STOP at the last frame.
I downloaded a sample from MSDN, but it's neither an SDI nor dialog application. I know that the VB code for the control is just a few lines - hope it's the same for VC.
Help!
norm
|
|
|
|
|
I'm trying to find away to print the flexgrid with the lines. Is there away of doing this.
|
|
|
|
|
Hi All,
I'm developing an MFC application using Doc/View and within this application I am making calls to a DLL. My problem is the DLL is asking for the:
Current window handle
Parent window handle
current HINSTANCE
How the heck do I find these things in MFC? I'm trying to get this information in a class that is derived from CFormView. Any help in this matter would be extremely helpful. Thank you in advance
Danielson
Slower is Faster
|
|
|
|
|
Current Window Handle -> *this or this->m_hWnd
Parent Window Handle -> *(this->GetParent());
Current HInstance -> AfxGetInstanceHandle();
Christian
No offense, but I don't really want to encourage the creation of another VB developer. - Larry Antram 22 Oct 2002
Hey, at least Logo had, at it's inception, a mechanical turtle. VB has always lacked even that... - Shog9 04-09-2002
During last 10 years, with invention of VB and similar programming environments, every ill-educated moron became able to develop software. - Alex E. - 12-Sept-2002
|
|
|
|
|
I created an application that displays user defined functions, and provides for performing various operations on them. I recently added a cursor (vertical line) the user can move around on the graph, and I display the x and y values on the status bar. I thought it would be nice to give the user the option to display the x and y values in a small user moveable window in the client area of the graph. The only way I've been able to implement this is by creating a dialog with a CStatic on it, then writing the values to the CStatic item in the dialog. Unfortunately, the dialog is much larger than needed to display this text, but I haven't been able to "create" a CStatic object that is moveable! I've done this in the past by having the parent of the CStatic object (I actually used a button) watch for mouse movement and button presses in the CStatic rect, but it was more work than I think is necessary.
Is there any way to create a CStatic object without a title bar that is moveable by the user? I want it to be just large enough to hold the text.
Whew... Thanks in advance
|
|
|
|
|
|
Thanks for the reply...
That's what I've done in the past. I thought by proper selection of window styles on creation of the CStatic (WS_???) I could get that functionality for free!
Guess I'll just have to brute force it again.
|
|
|
|
|
Hi,
I use a stored procedure for retrieve some recordset from my database.
I can calling my stored procedure but I can read my Recordset.
please find my sample :
_CommandPtr pCmd2("ADODB.Command");
pCmd2->ActiveConnection = m_pConn2;
//Store procedure
pCmd2->CommandText = "CheckNumSeg2";
pCmd2->CommandType = adCmdStoredProc;
pParam2 = pCmd2->CreateParameter ( _bstr_t ("TEST"), adVarChar,
adParamInput, strFileName.GetLength (), (_bstr_t) strFileName);
pCmd2->Parameters->Append ( pParam2);
_RecordsetPtr pRecordset;
pRecordset.CreateInstance(__uuidof(Recordset));
pRecordset = pCmd2->Execute(NULL, NULL, adCmdStoredProc);
pRecordset.Release(); //Only after this line is executed will the parameters be filled in Parameters collection.
//I would like to know how many record the stored procedure return me
long lnumCount = 0;
pRecordset->GetRecordCount();
//Close the DATABASE
if ( (m_pConn2->State & adStateOpen) == adStateOpen)
{
m_pConn2->Close();
}
Best Regards
youssef
|
|
|
|
|
|
Thanks a lot
It is my solution
Best Regards
youssef
|
|
|
|
|
I declare this CArray in Header file
CArray<int, int=""> m_arrHashFileListBoxWidth;
When I compile, there are error message show
error C2143: syntax error : missing ';' before '<'
error C2501: 'CArray' : missing storage-class or type specifiers
error C2059: syntax error : '<'
error C2238: unexpected token(s) preceding ';'
Do you know how to solve this problem?
Thank you for your answer.
|
|
|
|
|
First, you really should use > and < in place of > and < when posting code, as it'll mess up otherwise (or just uncheck the "display as HTML" checkbox).
Second, you most likely need to #include the file afxtempl.h, as that is where CArray is defined.
Third, if at all possible use the STL classes (i.e. vector<> ) instead; they work better, are more portable, and will in general ensure you less headaches in the future.
Shog9
------
So they took me down to the gallows
And this boy, he said to me:
"Why do you smile, when the rope's around your neck?"
I said, "I tell you boy, when i get back..."
|
|
|
|
|
Thank you.
I will use this when I post code
>
Thank you
<
|
|
|
|
|
Hi
Try like this and it should work.
CArray < Your class name, Your class name > m_arrHashFileListBoxWidth;
e.g.
CArray < CMyClass,CMyClass > m_arrHashFileListBoxWidth;
This is because CArray is a template class and it expects the type of argument whenever it try to initialize.
Kindly tell me whether it works or not.
Thanks
|
|
|
|
|
Hello,
Does anyone know where I can find a visually small calendar control (perhaps similar to the "Palm Desktop" mini calendars) that I could use? I would like to tweak it slightly for a project. It need not respond to mouse-clicks.
thanks!
JennyP
|
|
|
|
|
MS calender control won't cut it...?
Anyways have you looked under (i think) Misc. controls here at CP I know theres a mini calender control there which is totally rockin'
Cheers!
"An expert is someone who has made all the mistakes in his or her field" - Niels Bohr
|
|
|
|
|
Hello All,
In my project, I am using IStorage::CreateStream(). What I am doing is creating storage, and adding a file into the stream. For that I am using CreateStream, but the problem is, if the file name is large my program is crashing. I read MSDN, that CreateStream can't handle large filename (more than 31 characters.) Its giving me an error invalid pwcsName.Is there anyway to handle this problem???
Or is there any alternative which can solve this problem. Please, help.
Thanks,
|
|
|
|
|
The SDK reference for IStorage::CreateStream[^] is quite clear that pwcsName must not exceed 31 characters. Just use a short version of the file name (<= 31 chars long,) and put the real file name length as the first thing in your stream, and the actual name right after. When "walking" the streams in your storage, you can always read in the length and the actual file name from each stream.
Assuming your file name, strFileName, is an STL string , you can:
ULONG nLen = strFileName.length();
ULONG cbWritten = 0;
pIMyStream->Write(reinterpret_cast<void*>(&nLen), sizeof(ULONG), &cbWritten);
pIMyStream->Write(reinterpret_cast<void*>(strFileName.c_str()), nLen, &cbWritten);
And
ULONG nLen = 0;
ULONG cbRead = 0;
pIMyStream->Read(reinterpret_cast<void*>(&nLen), sizeof(ULONG), &cbRead);
char* pszBuf = new char[nLen + 1];
memset(pszBuf, 0, nLen + 1);
pIMyStream->Read(reinterpret_cast<void*>(pszBuf), nLen, &cbRead);
strFileName = pszBuf;
delete [] pszBuf;
Or something like that...
-- ian
http://www.ian-space.com/
|
|
|
|
|
I would like to know how one determines the state of all keys pressed when OnKeyDown is triggered in a MFC dialog. I need this to do a special key combination that only I will have access too while developing the application. Specifically "s" and "+" as well as "s" and "-"
Thanks,
Clint
|
|
|
|