|
i want to make a printer driver that captures the printed data in a tiff and stores it in a specific location. - something like print to file
anybody can give me some hints on how to get this on the road ?
|
|
|
|
|
|
ya..that is little-bit difficult but can be done..
use DDK to make driver & so some basic study needed for ddk.
then
next step would be to create a pipe (server & client).
The main thing to note is server would be in your in your application & client in driver dll. when your application start then means pip server start then it'll allow user to get operation from printer driver. then server would take bitmap form data from printer driver & make a tiff file from that..
How to make bitmap to tiff...this can be checked from my article in code project.
that's it.. little difficult but possible to do..i think
OK! Good Bye..best of luck;)
Never consider anything Impossible before trying to solve that..---Sumit Kapoor--- sumit_kapoor1980@hotmail.com
|
|
|
|
|
Hi
I have written this simple console application that prints a given maths time table, in this case - 12x table.
<br />
#include <iostream.h><br />
<br />
class CMathsTable<br />
{<br />
private:<br />
public:<br />
void PrintTable(int TimesTable)<br />
{<br />
int x = 0;<br />
int y = 0;<br />
int z = 0;<br />
int result;<br />
<br />
while(z < 12)<br />
{<br />
z++;<br />
<br />
x = TimesTable;<br />
y = z;<br />
<br />
result = x * y;<br />
<br />
cout << x; cout << " * "; cout << y; cout << " = ";<br />
cout << result << endl;<br />
}<br />
}<br />
};<br />
<br />
int main()<br />
{<br />
CMathsTable Maths;<br />
<br />
Maths.PrintTable(12);<br />
<br />
return 0;<br />
}<br />
How could I display this applications generated time table in a properly formatted table (i.e. columns and rows)?
A step in the right direction would very well appreciated.
Shuaib Latif
|
|
|
|
|
You have to #include <iomanip> and use the setfill() and setw() members.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
In the code editor in vs.net,there is a tree on the left,from which we can expand to show a function with all code, or collapse just to show the name of the function. How to implement this using MFC? Any ideas?
Thank you all!
Alick
|
|
|
|
|
|
Thank you very much.
I'm glad to do so
Alick
|
|
|
|
|
Hi.
Is there a way to override/redefine the maximum number of threads that can be created by an individual application running on XP.
I do not particulary want to redesign my application around thread pools, I just want to know if the default maximum number: 64 on my system, can be increased.
Best regards.
James.
|
|
|
|
|
What makes you think 64 is the maximum?
|
|
|
|
|
Because in WINNT.H MAXIMUM_WAIT_OBJECTS is defined as 64. If i create a 65th thread, WaitForMultipleObjects()
returns with a -1.
|
|
|
|
|
Laing,James wrote:
Is there a way to override/redefine the maximum number of threads that can be created by an individual application running on XP
A process can easily create more than 64 threads (just look at Task Manager on a busy server). It's true that MAXIMUM_WAIT_OBJECTS defines the maximum number of handles in the array passed in to WaitForMultipleObjects , but MAXIMUM_WAIT_OBJECTS is not related to how many threads a process can create, which was your original question.
Laing,James wrote:
I do not particulary want to redesign my application around thread pools
Are you actually using thread pools? It sounds like you are, since passing thread handles into WaitForMutlipleObjects is a standard way to implement them. If you are, and you want a to wait on more than 64 threads at one time, rather than create more than 64 threads, I would suggest splitting the array of handles passed in to WaitForMultipleObjects into several smaller arrays (64 or less handles each), and making several calls to WaitForMultipleObjects , one after the other, one for each array.
|
|
|
|
|
Thanks for the update.
My application creates a new thread as required, so the number maybe considerably more than 64.
I had not thought of simply splitting the array of handles.
Thanks for the help.
|
|
|
|
|
I want to capture the entire screen with DirectX 8 or 9?
And the performance will not too bad.
Who could help me ?
Thanks!! ^^
|
|
|
|
|
Hi there!
I am creating a custom control in MFC, which, when finished, should be something like a Command Prompt. I have ruled out the possibility of using a standard CEdit control as I need loads of different features which can only be accomplished by using a customized control.
It already is working fairly well: it outputs the character input by the user; it performs backspace action (with validation); and some other (very basic) features.
This is my first time creating custom controls in MFC and as you may have figured out by now, I am having some problems. So here it is:
- Obviously enough the Control must have keyboard input but whenever it has the focus and a key is pressed, a beep is sounded as if the control is not supposed to accept keyboard input. Why? Is it not correctly setup? How can I workaround this?
- Also, the only way I can get access to the keyboard input is by listening to the OnKeyDown message as OnChar doesn't work for some reason. Is this normal? Moreover, the keyboard input I get is based on virtual keys and not on the Keys themselves. Can someone tell me the best way to get the actual input char (upper/lower/plus flags)?
- Finally, whenever the control receives the focus, the event handler tries to show the caret (which was previously created), but it just doesn't show up. Again, is this occurring due to lack of proper setup?
Thank you for taking the time to read through.
Any help is greatly appreciated.
David
dNimrod#X
________________________
|
|
|
|
|
dNimrod#X wrote:
Obviously enough the Control must have keyboard input but...
Second time this has come up during the last days. Handle WM_GETDLGCODE , returning DLGC_WANTALLKEYS .
dNimrod#X wrote:
Also, the only way I can get access to the keyboard...
It might very well be. You haven't stated what type of control you derive from. WM_CHAR is sent as a result of a WM_KEYDOWN in the message loop TranslateMessage . Seeing that you would like to get the actual key pressed, the OnKeyDown -handler is more "low-level" than OnChar , so this should not pose any problem for you? As for the physical key, you don't want it. The VK_- codes will among other things guarantee that some other input-device emulating a keyboard can "fake" keys, which is a Good Thing. You have 8 bits (if memory serves) of "OEM scan code" in the input param flag, which ought to indicate the physical key, if you must have it. There is also GetAsyncKeyState if you want to check the state of other keys. Beware, this function will have to be called twice, the first time to clear some state (you might want to search MSDN for GetAsyncKeyState for more info on this).
dNimrod#X wrote:
Finally, whenever the control receives the focus,
Never shown? There are a lot of restrictions governing a caret, it has to be shown the same amount of time it has been hidden, the position has to be set etc. etc. etc. Have you tried the caret with a normal CEdit to begin with?
While you are to be commended on this brave endeavor, be prepared that it is not easy if you want to add stuff such as selection, copy and cut etc. Personally, I would have used a normal CEdit embedded in a larger CWnd -derived control.
|
|
|
|
|
Johan Rosengren wrote:
Handle WM_GETDLGCODE, returning DLGC_WANTALLKEYS.
This is what I was missing!!!. The control was behaving much like if it wasn't enabled - I was racking my brains out because of that. And, in the end, I just had to handle ONE message: WM_GETDLGCODE!
Johan Rosengren wrote:
While you are to be commended on this brave endeavor, be prepared that it is not easy if you want to add stuff such as selection, copy and cut etc. Personally, I would have used a normal CEdit embedded in a larger CWnd-derived control.
Thanks for the comment. I am aware of the coding needed to implement all those (and other) features and I personally take that as the easy part. : )
Johan Rosengren wrote:
Never shown? There are a lot of restrictions governing a caret, it has to be shown the same amount of time it has been hidden, the position has to be set etc. etc. etc.
Yeah apparently you have to follow a number of different steps (which you have described) in order to construct and display a caret. I have definitely done so. But still the bastard won't show up!
I must be missing something out, surely.
Thanks a lot for all your help Johan.
dNimrod#X
________________________
|
|
|
|
|
I need to save a CString to regedit this is what I gave done.
HKEY hKey;
LONG lResult = ERROR_SUCCESS;
DWORD dwType;
CString str;
CString sTest;
sTest = "Ok ok";
str = "RegName";
lResult = RegCreateKey(HKEY_LOCAL_MACHINE,
USER_SETTINGS_KEY, &hKey);
dwType = REG_SZ;
lResult = RegSetValueEx( hKey, str, NULL, dwType, (unsigned char*)&sTest, dwSize );
RegCloseKey( hKey );
When this does to regedit it locks like this = Œ.Â
It sems like it save as a char but how can i make it saves like a CString???
|
|
|
|
|
You can't save it as a CString, the registry has a limited amount of variables you can save data as....CString isn't one of them. Check out MSDN for the types....
|
|
|
|
|
Well if LPTSTR str how can I get a CString value into str??
|
|
|
|
|
GetBuffer(0) and ReleaseBuffer
modified 12-Sep-18 21:01pm.
|
|
|
|
|
Larsson wrote:
(unsigned char*)&sTest
pass in the CString, not the address of the CString. The CString's LPCTSTR() operator will take care of passing the pointer.
(unsigned char*)sTest
Also, I do not see where you set the value for dwSize. It must be the length of the string, plus 1 for the terminating NULL.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
PJ Arends wrote:
It must be the length of the string, plus 1 for the terminating NULL.
The size is in bytes, so for a Unicode build, you have to double it. Safest way is to use
dwSize = (sTest.GetLength() + 1) * sizeof(TCHAR)
|
|
|
|
|
You are correct, but Larsson was casting it to an unsigned char* so he is not using Unicode. Introducing TCHARs in the answer would more than likely confuse a beginner.
"You're obviously a superstar." - Christian Graus about me - 12 Feb '03
"Obviously ??? You're definitely a superstar!!!" mYkel - 21 Jun '04
Within you lies the power for good - Use it!
|
|
|
|
|
Given how it's used, casting to char* doesn't say anything about the build. RegSetValueEx takes CONST BYTE* as the fifth parameter, so a CString passed in would *have* to be cast in a Unicode build (preferably to BYTE* , but since BYTE is typedef'ed to unsigned char anyway, casting to unsigned char* works).
|
|
|
|