|
glyfyx wrote: I won't do that again
I wish I could say the same. That's my #1 typo! It'll always be ID to me, apparently.
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
For the sake of closure on this thread, if you exactly follow Microsoft's rules to set a LOCAL low-level keyboard hook don't expect it to run because Microsoft forbids its execution.
According to Microsoft the following will result in a setting a LOCAL hook:
HHOOK hhkLowLevelKybd = SetWindowsHookEx( WH_KEYBOARD_LL,
HookProc, NULL, GetCurrentThreadId());
However, it fails execution, returning NULL.
I took the trouble to rerun it in order to get extended error information and got this surprising formatted error message in a MessageBox:
"SetWindowsHookEx failed with error 1429: This hook procedure can only be set globally."
Do I laugh or cry?
|
|
|
|
|
glyfyx wrote: "SetWindowsHookEx failed with error 1429: This hook procedure can only be set globally."
That is documented under SetWindowsHookEx in the SDK. Low-level keyboard hooks key events before
they are dispatched to a given thread message queue so it makes sense.
glyfyx wrote: Do I laugh or cry?
I try to cry first, then laugh. If it happens the other way around I'm in trouble
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
I have a form (in PDF) that I want to print. Its
a small form, only a quarter of a sheet of paper.
I can make lines match with the form but when I
print text, there the font look the same size, but
the fonts on the original form are more spaced out
and a sentence will look longer.
Any ideas on how I can print a form precisely so
that it will look absolutely identical? I can convert
it to a bitmap and print text on top of the bitmap
but that prints slowly. If I go into the PDF file, I
can see what font was used and what the spacing was.
I just dont know how to mimic that programmatically
in my own program.
Any ideas any one has will be greatly appreeciated.
Sincerely,
Danielle Brina
|
|
|
|
|
Danielle,
Printer drivers and/or printers have to translate the PDF code (which I believe is based on postscript) to approximate what you see on the display. Very seldom, there is a one-to-one relationship with the fonts stored on the printer (an ink jet printer won't have stored fonts and depends on the printer driver to renderings) with those used in the PDF or with the capabilities of the printer. So, if you managed to get that "perfect" output on one printer, you may not be able to duplicate it on another printer or duplicate the same result on the same printer after making modifications to the PDF.
George
"We make a living by what we get, we make a life by what we give." --Winston Churchill
|
|
|
|
|
DanYELL wrote: If I go into the PDF file, I
can see what font was used and what the spacing was.
I just dont know how to mimic that programmatically
in my own program.
Any ideas any one has will be greatly appreeciated.
I have found that when programmatically converting my GDI calls to specific PDF postscript commands, that utilizing GDI+ for some metric calculations allows for the closest approximations. By mixing GDI and GDI+, I can render the drawing primitives on screen, to the printer, and translate those commands to PDF postscript with a fair level of accuracy. GDI+ really comes in handy for glyph/font rendering/calculations/placement and handling the various image formats and converting the bits to PDF image streams.
However, you appear to want to consume a PDF, modify it, and then write it back to the binary stream to print it. Creating PDF's is no easy task. Parsing a PDF binary stream (correctly) is a task not for the faint hearted. Take a look at the PDF Reference Version 1.7[^] and you'll see what I mean.
Adobe employs some very talented, but I must add, very unique and interesting characters in their company. When struggling with the PDF Reference, I get the feeling that the individuals are some of the most hardcore academic types and mathematical purists you will find outside of the 3D programming community. The reference severely lacks a practical side (There are hardly any examples in the book) and the PDF is a binary/indexed file so examples can't just be typed into notepad and viewed making those first steps completely unbearable.
George L. Jackson provided a friendly warning about fonts and I would have to agree 100%. When dealing with PDF postscript, you get forced to get very intimate with glyphs, glyph spacing, font files, font metrics, glyph terminology, GDI font functions from the bowels of Windows, font embedding, font embedding licensing issues, multiline vertical text placement (you have to draw each line of text individually), font substitution (Not all fonts you use will be installed on every machine your PDF will be viewed on), synthesizing strikeout and underlining (There is no such concept in glyph design. You have to synthesize these effects. GDI always provided this so we tend to take it for granted), etc...
I'm not trying to discourage your quest. I am just providing a friendly word of caution to let you know of the perils that lie ahead should you choose to accept your mission. I have found that most people who have already gone down the road of writing PDF writers/converters/readers are not very willing to share their experiences or insights. Usually, they'll recommend you use one of their libraries instead. PlanetPDF is a good example of a site where novice PDF programmers' questions are not answered, but merely used as an opportunity to promote the well established PDF library writers products.
Just for a reference, it took me about 6 long months to get a GDI to PDF writer completed. I still had to skip things like digital signing, annotations, various redundant encoding schemes, and a long list of available items I did not need to use during PDF creation but things I would most definitely need if I were to attempt to consume/read any arbitrary PDF that was already written.
Sorry about the long post. I hope it helps somehow.
|
|
|
|
|
Hello,
I need to write a MFC application to access a camera attached to a USB port.
I am completely new to VC++ and MFC applications.
Could anyone please give me a correct direction to start in?
Thank you.
|
|
|
|
|
I would start with an activeX control - You may have one installed on your computer that will work or you may be able to find one.. get it working with the control to get an idea of whats involved.. On my computer I have an ActiveX control for FTI Device Digital USB Control and snapshot Viewer Control and yahoo! web cam viewer -
just start with a dialog box - in visual c++ 6.0 you can right click it and choose insert activeX..
If you don't have any camera activex - you may be able to download one..
-- modified at 23:46 Saturday 14th April, 2007
Check this page for USB help-
http://www.codeproject.com/system/HwDetect.asp[^]
|
|
|
|
|
|
HELP!HELP!
i want to use HOOK stop message of CTRL+ALT+DEL,Some one can help me!
|
|
|
|
|
Why? To prevent a user from using his/her system?
Try here[^] for more info about why this is not supposed to be possible and
why it shouldn't be done - there's lots of articles.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
This can be done by creating a GINA.DLL.
And I don't remember exactly how, but modifying some registry keys was possible also to achieve that.
I'm sure that there are other ways to do that, some of them have been explained here in the CP.
hope this helps.
|
|
|
|
|
You can prevent task manager but CTRL+ALT+DELETE will always go to windows. Additionally, you must not do such a thing.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
brahmma wrote: you must not do such a thing
What if you implement proprietary systems and the user must only use your app in the computer that is embedded inside that system? if the user can it ctrl+alt+del then he can go into the OS and harm something...
I'm sure that there are lots of reasons to need this. In my case, for example, I make machines that are controlled by PC's... those machines can hurt people... I must be sure that people wont be able to touch something that is "delicate" and use only my app with all it's restrictions...
|
|
|
|
|
I am sure you can do it – but do not do that – enough said.
INTP
"Program testing can be used to show the presence of bugs, but never to show their absence."Edsger Dijkstra
|
|
|
|
|
|
Is it possible to destroy a domodal dialog once a child dialog appears on button click of the domodal dialog.
To be more specific,
Lets say in a dialog based application there 3 dialogs: Dlg1, Dlg2, Dlg3 and lets assume a button is there in Dlg1 and Dlg2,Now on button click on Dlg1 I am trying to invoke DoModal dialog Dlg2, and on button click of Dlg2 I am trying to invoke another DoModal dialog Dlg3, and my question is on invoking DoModal dialog Dlg3, can we destroy Dlg2??
|
|
|
|
|
why don't you send a wm_close message?
|
|
|
|
|
Super Hornet wrote: Lets say in a dialog based application there 3 dialogs: Dlg1, Dlg2, Dlg3 and lets assume a button is there in Dlg1 and Dlg2,Now on button click on Dlg1 I am trying to invoke DoModal dialog Dlg2, and on button click of Dlg2 I am trying to invoke another DoModal dialog Dlg3, and my question is on invoking DoModal dialog Dlg3, can we destroy Dlg2??
No. If the parent is window is destroyed, the child windows will be destroyed too.
Nobody can give you wiser advice than yourself. - Cicero
|
|
|
|
|
Super Hornet wrote: my question is on invoking DoModal dialog Dlg3, can we destroy Dlg2??
Doing it FROM Dlg3 kinda goes against the grain for the concept of "modal".
An alternative is, when the button is clicked in a modal dialog that should make that dialog go
away, do something like -
In Dlg2, call EndDialog(some_return_code) in response to the button click.
In Dlg1, check the return code from DoModal for Dlg2
If the return code is "some_return_code" then create a Dlg3 and call its DoModal.
Mark
"Posting a VB.NET question in the C++ forum will end in tears." Chris Maunder
|
|
|
|
|
Thanks Mark I will try your method.
|
|
|
|
|
how to find adapter is exixts in system or not.
|
|
|
|
|
Is GetAdaptersInfo helpfuls ?
|
|
|
|
|
I have a server app which is connected to a client applicatio through tcp/ip using CSocket derived classes in both. I want to be intimated in the server when the lan connection of the system in which client application is running goes off.
Is it possible?
Thank you.
KIRAN PINJARLA
|
|
|
|
|