|
Haakon S. wrote:
I can't figure out how to interpret it
Every key on the keyboard has a unique scan code. You can retrieve that code from the bits 0 to 15 of the nFlags parameter. IIRC the scan codes for the main keypad are standard, but all other keys are OEM specific, they are not guaranteed to be the same across all systems.
UINT scancode = nFlags & 0xFF;
Sonork 100.11743 Chicken Little
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
Within you lies the power for good - Use it!
|
|
|
|
|
PJ Arends wrote:
You can retrieve that code from the bits 0 to 15 of the nFlags parameter
But MSDN reads, under OnChar():
"Value 0-15
Specifies the repeat count. The value is the number of times the keystroke is repeated as a result of the user holding down the key."
If you look up under OnKeyDown(), you'll see a description more in line with yours, but it also says that the scan codes are OEM specific. However, I'll try to dig into this. If Excel can do it, so can I.
Thanks alot, anyway.
Haakon S.
Runners live two years longer. But those two years they spend running.
|
|
|
|
|
Not sure if this belongs here or in the COM discussion. Since I created an mfc ActiveX control with the mfc ActiveX Wizard, I'll try here...
I created my first ActiveX control, and successfully installed it on my machine with
regsvr32 "my controls name"
Then I fired up VB and verified that I could use the control in a VB application. I was fat dumb and happy. To test it, I sent the .ocx file to a friend and had him put it in C:\temp. (The controls name is transponder.ocx)
I had him execute the following from "Start" "Run"...
regsvr32 C:\temp\transponder.ocx
When he executed the command, he got the following error...
Load Library
“C:\temp\transponder.ocx” failed – the specified module could not be found.
Any idea what this is trying to tell me? I set up the project as a static build, so I don't think it's looking for any dlls.
|
|
|
|
|
Use dependancy walker to see what DLLs it does need. Even if it is statically linked to MFC, it may still require the C-runtime DLLs (e.g. msvcrt.dll).
Dave
|
|
|
|
|
WOW...
According to dependency walker, it requires the following...
kernel32.dll, user32.dll, gdi32.dll, comdlg32.dll, winspool.drv, advapi32.dll, shell32.dll, comctl32.dll, ole32.dll, olepro32.dll, oleaut32.dll at the first level
Then each of them has a list!
Is it necessary to include all these in an install utility?
Does one of these look like a good candidate for something that's not typically loaded in a Win2000 installation?
Thanks!
|
|
|
|
|
Hello,
I was wondering if it was possible to pass variables from Macromedia Director into a C++ programme? It can be done rather easily using Flash (from the look of things) but I need to be able to do it in Director. I have searched the web and very little is mentioned. Any help would be greatly appreciated.
Regards,
Moo
|
|
|
|
|
Any one have any ideas about it?
|
|
|
|
|
Hello,
I'm debugging my last program... and today I've acquired Rational Purify (trial version) in order to receive help on this task...
after running my program under Rational Purify, I've found some memory leaks... but now I'm not sure of which is my name (almost)...
let's see, it says that this code is leaking memory:
-------------------------------------------------------------
-------------------------------------------------------------
// Variables que permeten la construcció del codi HTML.
CString csCodiHTML = "HTML STRING...";
BSTR bstr;
int iWidthAreaClientHTMLCtrl = 0;
// Tractament del SafeArray.
HRESULT hrTractarAmbSafeArray = S_OK;
SAFEARRAY *pSafeArray = NULL;
VARIANT *pElement = NULL;
extern CTCCApp TCCApp;
//------------------------------------------------
// Obtenir accés al control HTML via ATL.
//------------------------------------------------
CComQIPtr<IHTMLDocument2> spHTMLDocument = this->m_HTMLCtrl.GetHtmlDocument();
if(spHTMLDocument)
{
CComQIPtr<IHTMLElement> spHTML;
spHTMLDocument->get_body(&spHTML);
if (spHTML)
{
bstr = csCodiHTML.AllocSysString();
spHTML->put_innerHTML(bstr);
spHTML.Release();
SysFreeString(bstr);
csCodiHTML.ReleaseBuffer();
csCodiHTML.FreeExtra();
}
else
{
pSafeArray = ::SafeArrayCreateVector(VT_VARIANT, 0, 1);
if (pSafeArray)
{
hrTractarAmbSafeArray = ::SafeArrayAccessData(pSafeArray,(LPVOID*) &pElement);
pElement->vt = VT_BSTR; // HERE!
pElement->bstrVal = csCodiHTML.AllocSysString();
hrTractarAmbSafeArray = ::SafeArrayUnaccessData(pSafeArray);
hrTractarAmbSafeArray = spHTMLDocument->write(pSafeArray);
::SafeArrayDestroy(pSafeArray);
csCodiHTML.ReleaseBuffer(); // HERE TOO!
csCodiHTML.FreeExtra();
}
}
}
if (spHTMLDocument) spHTMLDocument.Release();
-------------------------------------------------------------
-------------------------------------------------------------
Where you can see HERE! and HERE TOO! is where that program Rational purify is detecting some memory leaks... do you think that the code is leaking memory?
and if so... why? I thought that if I have not called new I should'nt call delete and that whenever the function goes out of scope the local variables are destructed automatically... isn't it true?
Thank you in advance...
|
|
|
|
|
You are missing a call to SafeArrayUnaccessData.
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
"Resource acquisition is initialization"
I love it.
It's not the fall that kills you: it's the sudden stop - Down by Law, Jim Jamursch (1986)
|
|
|
|
|
|
Actually, it is in the code. I must have missed it first time around.
*shrug*
Tim Smith
I'm going to patent thought. I have yet to see any prior art.
|
|
|
|
|
I don't think there are leaks in your code.
It could be that the complaint is about the line below //HERE, as your tool has no way of knowing that SafeArrayDestroy() will delete the BSTRs in the array.
Also, in my opinion, your calls to ReleaseBuffer() and FreeExtra() are not necessary.
Cheers,
Rob.
|
|
|
|
|
hi, I need some advice about using and connecting the CBaseControlWindow into the IGraphBuilder interface.thnx
J.
|
|
|
|
|
Does anybody know of a good way to convert a bitmap to jpeg.
At the moment i'am wrinting a small application that creates BITMAPS but i actually need to convert them to jpeg?
What is the best or esiest way to do so?
|
|
|
|
|
|
I have a Rect say (0, 16, 0, 154) and i want to print it out with that same rect on a printer.
on the printer dc i say
int nOldMapMode = dc.SetMapMode(MM_HIENGLISH);
dc.DPtoLP(rect);
it converts it to (0, -27, 0, 257) wich is way to small for the printer.
How do i convert this rect to the same rect for a printer?
Scott
|
|
|
|
|
HDC hdcPrinter;
CPrintDialog dlg(FALSE);
CDC dcScreen;
HDC hdcScreen = ::GetDC(NULL);
dcScreen.Attach(hdcScreen);
if (dlg.DoModal() == IDOK)
{
hdcPrinter=dlg.GetPrinterDC();
long logicalPixelsPerInchX_Screen = GetDeviceCaps(hdcScreen, LOGPIXELSX);
long logicalPixelsPerInchY_Screen = GetDeviceCaps(hdcScreen, LOGPIXELSY);
long logicalPixelsPerInchX_Printer = GetDeviceCaps(hdcPrinter, LOGPIXELSX);
long logicalPixelsPerInchY_Printer = GetDeviceCaps(hdcPrinter, LOGPIXELSY);
}
- Nitron
"Those that say a task is impossible shouldn't interrupt the ones who are doing it." - Chinese Proverb
|
|
|
|
|
ok i have the pixals per inch, what do i do with them to convert the rect?
|
|
|
|
|
Hi :
I'm a VC++ beginner and i have a problem with stand alone (.EXE) MFC application!!
Whenever that i want to run a .EXE file written with mfc in other machine i recieve the
following error for example :
The MFC42D.DLL not found....and etc.
Now i want to know what files(.DLL or ...) are needed for running a MFC program.
Please Help Me.
My english isn't very well because it isn't my native language,excuse me for bad
comments.
|
|
|
|
|
You need to compile your app in Release mode, not debug. You can watch the file dependencies with "Dependency Walker"
regards
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Hi guys
I've discovered that my problems about GDI resources are due to use a class designed for NT or w2000 working in w98.
How could I discover what calls are exclusive for w2000?
The class is a CStatic derived class that works like a 2 states button, changing the bitmap from one to another depending the state.
I don't know if this info is enough for you.
Best Regards
Dr. pi
|
|
|
|
|
doctorpi wrote:
How could I discover what calls are exclusive for w2000?
By reading the documentation?
|
|
|
|
|
I don't know how to progamme an application without tittle bar,menu bar, toolbar, status bar... such as many games we have been seen. Please help me.
(I'm sorry! My English is not good.)
|
|
|
|
|
What you want is a Dialog based application. The default is:
1) No menu bar
2) No toolbar
3) No status bar
To get rid if the title bar go to the dialog properties and and clear the title bar option.
Art
|
|
|
|