|
I can get the other exe's ocx control's handle.
I try to use handle to control's point,but it is error!
example:
p = (CSpreadSheet *)CWnd::FromHandle(glhTargetWnd);
//error,because the p is my exe, the ocx control is belong to the other exe,I cant use FromHandle.
How can I do?
Please help me!!!!
555555 7456
|
|
|
|
|
Some printers have the capability to print the last page first.
I cant figure out how to set this option programatically. I dont't see anything in the DEVMODE structure that address reverse printing.
can anyone help?
Thanks in advance
|
|
|
|
|
hey:
to realize reverse print ,then that print program must support "what you get is what you see",that is to say:the same function not only finish display but also print.because only this way,the Document in screen can be corresponding to the printing length.and at the same time we can set the maxpage in OnParePrinting.
now i give a little example ,hope to give you some instructive things.
for example:(1)now there is a student database
(2)by Appwizard,the sixth step set PrintView (base class :scrollView)
(3)extracted data from the database then display them in scrollview
(3)below about your reverse print
1.Bool CPrintView::OnPreparePrinting(CPrintInfo*pInfo)
{pInfo->SetMaxPage(StudRecNum/5);
//StudRecNum is student recordnumber,iwant set 5 records in a page
return DoPreparePrinting(pInfo);}
2,in OnBeginPrinting
{m_bPrintEnd=false;
//m_bPrintEnd is declared in CPrintView to point whether stop printing
studentRec->MoveLast();
if(studentRec->IsBOF())
m_bPrintEnd=true;
}
3.void CPrintView::OnPrepareDC(CDC*pDC,CPrintInfo*pInfo)
{
CSrollView::OnPrepareDC(pDC,pInfo);
if(pInfo!=NULL)
pInfo->m_bContinuePrinting!=m_bPrintEnd;
}
4.void CPrintView::OnPrint(CDC*pDC,CPrintInfo*pInfo)
{
int Curpage=pInfo->m_nCurPage;
studentRec->SetAbsolutePosition(StudRecNum);
......
//set output map mode,and get the auguments of text metrics
//print the column headers
//print student records in one page by loop
//set for next printing
....
studentRec->MovePrev();
if(studentRec->IsBOF()
{m_bPrintEnd=true;
break;
}
CSrollView::OnPrint(pDC,pInfo);
}
i only give a thinking ,not write completely,try to finish ,then post your harves to make us all progress.
|
|
|
|
|
I am new to VC++ and have no idea where to start. I have VB.NET DLL that I need to call from VC++.net. How can I do that? please help
|
|
|
|
|
Hi,
i am facing some problem while working with streams in my C++ program using STL
main(){
..
..
char buf[256];
stringstream infLine(buf);
infline<
|
|
|
|
|
What is your actual problem?
The code you've posted looks bogus, the constructor for 'infLine' and the two instances of 'infLine' on the next line.
Paul
|
|
|
|
|
Infact we are doing migration from IOC to standard C++
#define FIELD_DELIM "~"
#define RECORD_LEN 450
#define RECORD_DELIM '!'
main (int argc, char *argv[])
{
IString filename (argv[1]);
ifstream inFile(filename);
char buf[RECORD_LEN+1];
IString inLine;
IString notUsed;
int i;
while (inFile.getline(buf, RECORD_LEN+1, RECORD_DELIM)) {
inLine = buf;
inLine >> notUsed >> FIELD_DELIM >> // record counter
recordType >> FIELD_DELIM >>
effDate >> FIELD_DELIM >>
productType >> FIELD_DELIM >>
notUsed >> FIELD_DELIM >> // collateral type
baseMargin >> FIELD_DELIM >>
rateType >> FIELD_DELIM >>
vehicleAge >> FIELD_DELIM >>
ltv >> FIELD_DELIM >>
inLine;
}
ealier this peice of code worked but now when i am using string as i mentioned above instead of istring this is not getting compiled and giving problems
What might be the problem.I am trying out various ways but couldnt do it
Your help will be greatly appreciated
|
|
|
|
|
Hi everyone, im new to this place..
I need to create, make, use, or whatever, a custom search.
Here is what I want to do and possibly complete.
Here is a (sample) of The "new" FreeBay. http://www.thefreebay.com/sample
I want to put a search on the site that I can customize and add items to.
Not a search with http links and titles, but one that could search for
"free items in custom tables" and then for the results to appear
embedded just like on the sample page.
To get a clear picture of this.......
I dont know about making the search engine to search for its results
(free items) on the pages within the free bay, but an easier way would
be to use a system that I could input the "items with tables" into,
and the engine would search the text within the seperate custom
tables/items, and appear them as shown on the sample. Just the items,
that means the sponsors name, brief description, along with the rating
and link.
There has got to be something that can search for text within a 3
column 2 row table and out put that table exactly as is.
I hope this is all understandable. Please help me..
Thnx..
|
|
|
|
|
You are posting this to a wrong discussion board. Try ASP.NET discussion board instead.
Sonork 100.41263:Anthony_Yio
Life is about experiencing ...
|
|
|
|
|
Hi,
I need a global print screen hook, not based on keyboard hooks, but based on the actual process of getting the bitmap of the print screen.
Does anybody know a place to start? Ive worked with keyboard hooks, but i dont know WHAT to hook for this specific thing!!!
Thanks in Advance!!!
|
|
|
|
|
The first thing you do is figure out where and when the printscreen key is processed. For example, the shell does a lot of processing, so if you open a paint program and kill the shell (explorer) then hit printscreen, does it still work?
Yes it does.
So, it would seem that it may happen in the kernel. There are two ends you could attempt to start watching for PRINT SCREEN. The starting end, where the keys are sent from or the other end, where the bitmap ends up.
The bitmap ends up in the clipboard. So, my guess would be WIN32K.SYS in the kernel may have something to do with it.
So, you get out your kernel debugger and you load up Microsoft's symbols and you start to look for anything you think may occur at that time. For example, print screen functions in the kernel, key strokes or clipboard functions.
We want to find out who puts the image in the clipboard, usermode or kernel mode and see where you want to hook.
So, I did this for you. I searched WIN32K.SYS for symbols. Found nothing on print screen. So, as I said, we know that paint programs get the bitmap from the clipboard. So, what I did was searched for *clip*board* symbols and set some breakpoints on ones related to setting data.
kd> bl
0 e a00b0cc8 0001 (0001) win32k!InternalSetClipboardData
1 e a00b0c35 0001 (0001) win32k!NtUserSetClipboardData
2 e a0046c43 0001 (0001) win32k!NtUserOpenClipboard
Then, I pressed "Print Screen" and I get a break point!
kd> kb
ChildEBP RetAddr Args to Child
fb676b30 a00b0e72 fcdb8bf8 00000002 18050144 win32k!InternalSetClipboardData
fb676b54 a01038ea 00000002 18050144 00000000 win32k!_SetClipboardData+0x2f
fb676bac a00c3a34 0185000f 00000201 e1ccf948 win32k!xxxSnapWindow+0x212
fb676c8c a00152e2 00000100 fb676d10 00000000 win32k!xxxScanSysQueue+0x1056
fb676ce0 a001612e fb676d10 000021ff 00000000 win32k!xxxInternalGetMessage+0x280
fb676d4c 80461691 0103fd70 00000000 00000000 win32k!NtUserGetMessage+0x43
fb676d4c 77e1414f 0103fd70 00000000 00000000 nt!KiSystemService+0xc4
0103fd1c 766d16d3 0103fd70 00000000 00000000 USER32!NtUserGetMessage+0xb
0103fd90 766d15bd 00020070 00000000 766d2610 stobject!SysTrayMain+0x124
0103ffb4 77e92ca8 00000000 00ccfaa0 77fb80db stobject!CSysTray::SysTrayThreadProc+0x45
0103ffec 00000000 766d1578 00000000 00000000 KERNEL32!BaseThreadStart+0x52
kd> !process -1 0
PROCESS fcc88020 SessionId: 0 Cid: 0324 Peb: 7ffdf000 ParentCid: 0318
DirBase: 0684b000 ObjectTable: fcc7db68 TableSize: 200.
Image: explorer.exe
I found something odd, explorer sets the internal data. So, I killed explorer to see how it was working without it.
I found this.
kd> kb
ChildEBP RetAddr Args to Child
f766fb30 a00b0e72 fcdb8bf8 00000002 0a0501e1 win32k!InternalSetClipboardData
f766fb54 a01038ea 00000002 0a0501e1 00000000 win32k!_SetClipboardData+0x2f
f766fbac a00c3a34 0185000f 00000001 e1cb0a48 win32k!xxxSnapWindow+0x212
f766fc8c a00152e2 00000100 f766fd10 00000000 win32k!xxxScanSysQueue+0x1056
f766fce0 a001612e f766fd10 000021ff 00000000 win32k!xxxInternalGetMessage+0x280
f766fd4c 80461691 00cfff88 00000000 00000000 win32k!NtUserGetMessage+0x43
f766fd4c 77e1414f 00cfff88 00000000 00000000 nt!KiSystemService+0xc4
00cfff44 5ffb3036 00cfff88 00000000 00000000 USER32!NtUserGetMessage+0xb
00cffff4 00000000 0040fdf0 00fc5a4d 00000001 winsrv!ConsoleInputThread+0x15c
kd> !process -1 0
PROCESS fcdc45a0 SessionId: 0 Cid: 00a8 Peb: 7ffdf000 ParentCid: 008c
DirBase: 03798000 ObjectTable: fcdc4508 TableSize: 249.
Image: csrss.exe
CSRSS (Which you will have some trouble hooking!) sets it.
Taking a closer look you can actually see that the process doesn't matter. It's simply scheduled anywhere in the kernel off of any kernel call in win32k.sys.
A little more work tells us the thread is woken up and calls win32k!xxxScanSysQueue which eventually figures out to call xxxSnapWindow which does all the work.
This is all in the kernel. I don't have time to figure out more detail, but I think this is what you're looking for. What you could do is see if you can register for clipboard data events and get a notification when data arrives in the clipboard or possibly a snapshot window message if there is one.
This is a starting point for you at least.
|
|
|
|
|
I took a quick look again here in a little more detail and here's what I think is happening.
The keyboard generates the keydown event and it's most likely passed and filtered by the WH_KEYBOARD_LL hooks first. Eventually, it makes it way as a WM_KEYDOWN message into the active window. In the case where I saw it in CSRSS's message queue, was since I had the command window debugger active.
So, then the ScanQueue is called and there's a call to get the next message. Then, it's checked if it's a keydown. If it is, it then checks specific scan codes and performs certain system actions.
kd> r
eax=e1ba81e8 ebx=e1cb0a48 ecx=00000001 edx=00005d6e esi=00000000 edi=00000001
eip=a0025769 esp=f766fbac ebp=f766fc8c iopl=3 nv up ei pl zr na po nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00003246
win32k!xxxScanSysQueue+0xa2:
a0025769 e80d0f0000 call win32k!xxxGetNextSysMsg (a002667b)
kd> p;r
...
kd>
eax=00000000 ebx=e1cb0a48 ecx=f766fc20 edx=00000000 esi=00000000 edi=00000001
eip=a00257bf esp=f766fbb8 ebp=f766fc8c iopl=3 nv up ei ng nz na pe cy
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00003283
win32k!xxxScanSysQueue+0x10c:
a00257bf 8b4dac mov ecx,[ebp-0x54] ss:0010:f766fc38=00000100
kd>
eax=00000000 ebx=e1cb0a48 ecx=00000100 edx=00000000 esi=00000000 edi=00000001
eip=a00257c2 esp=f766fbb8 ebp=f766fc8c iopl=3 nv up ei ng nz na pe cy
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00003283
win32k!xxxScanSysQueue+0x10f:
a00257c2 6a23 push 0x23
kd>
eax=00000000 ebx=e1cb0a48 ecx=00000100 edx=00000000 esi=00000000 edi=00000001
eip=a00257c4 esp=f766fbb4 ebp=f766fc8c iopl=3 nv up ei ng nz na pe cy
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00003283
win32k!xxxScanSysQueue+0x111:
a00257c4 5a pop edx
kd>
eax=00000000 ebx=e1cb0a48 ecx=00000100 edx=00000023 esi=00000000 edi=00000001
eip=a00257c5 esp=f766fbb8 ebp=f766fc8c iopl=3 nv up ei ng nz na pe cy
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00003283
win32k!xxxScanSysQueue+0x112:
a00257c5 894d08 mov [ebp+0x8],ecx ss:0010:f766fc94=e1cb0a48
kd>
eax=00000000 ebx=e1cb0a48 ecx=00000100 edx=00000023 esi=00000000 edi=00000001
eip=a00257c8 esp=f766fbb8 ebp=f766fc8c iopl=3 nv up ei ng nz na pe cy
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00003283
win32k!xxxScanSysQueue+0x115:
a00257c8 2bca sub ecx,edx
kd>
eax=00000000 ebx=e1cb0a48 ecx=000000dd edx=00000023 esi=00000000 edi=00000001
eip=a00257ca esp=f766fbb8 ebp=f766fc8c iopl=3 nv up ei pl nz ac po nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00003216
win32k!xxxScanSysQueue+0x117:
a00257ca 0f841b0c0000 je win32k!xxxScanSysQueue+0xe3f (a00263eb) [br=0]
kd>
eax=00000000 ebx=e1cb0a48 ecx=000000dd edx=00000023 esi=00000000 edi=00000001
eip=a00257d0 esp=f766fbb8 ebp=f766fc8c iopl=3 nv up ei pl nz ac po nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00003216
win32k!xxxScanSysQueue+0x11d:
a00257d0 81e9dd000000 sub ecx,0xdd
kd>
eax=00000000 ebx=e1cb0a48 ecx=00000000 edx=00000023 esi=00000000 edi=00000001
eip=a00257d6 esp=f766fbb8 ebp=f766fc8c iopl=3 nv up ei pl zr na po nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00003246
win32k!xxxScanSysQueue+0x123:
a00257d6 0f84ce070000 je win32k!xxxScanSysQueue+0x6d2 (a0025faa) [br=1]
... 100h == WM_KEYDOWN.
kd>
eax=00000000 ebx=e1cb0a48 ecx=00000008 edx=00000036 esi=00000000 edi=a0187e21
eip=a0025ff0 esp=f766fbb8 ebp=f766fc8c iopl=3 nv up ei pl zr na po nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00003246
win32k!xxxScanSysQueue+0x767:
a0025ff0 837dfc2c cmp dword ptr [ebp-0x4],0x2c ss:0010:f766fc88=0000002c
I think 2c is the scancode for print (or the VK_xxx) but I'd have to look that up.
kd>
eax=00000000 ebx=e1cb0a48 ecx=00000008 edx=00000036 esi=00000000 edi=a0187e21
eip=a0025ff0 esp=f766fbb8 ebp=f766fc8c iopl=3 nv up ei pl zr na po nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00003246
win32k!xxxScanSysQueue+0x767:
a0025ff0 837dfc2c cmp dword ptr [ebp-0x4],0x2c ss:0010:f766fc88=0000002c
eax=f766fc2c ebx=e1cb0a48 ecx=00000008 edx=00000036 esi=00000000 edi=a0187e21
eip=a00c39e3 esp=f766fbb0 ebp=f766fc8c iopl=3 nv up ei pl zr na po nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00003246
win32k!xxxScanSysQueue+0x1005:
a00c39e3 e8252ff6ff call win32k!xxxSkipSysMsg (a002690d)
SkipSysMsg is called, then
eax=a03106e0 ebx=e1cb0a48 ecx=f766fbd4 edx=00000001 esi=00000000 edi=a0187e21
eip=a00c3a2f esp=f766fbb4 ebp=f766fc8c iopl=3 nv up ei pl nz na po nc
cs=0008 ss=0010 ds=0023 es=0023 fs=0030 gs=0000 efl=00003206
win32k!xxxScanSysQueue+0x1051:
a00c3a2f e86efc0300 call win32k!xxxSnapWindow (a01036a2)
SnapWindow is called.
So, what do you want to do if you don't want a keyboard filter? A kernel hook on xxxSnapWindow?
|
|
|
|
|
Hi. Thank you for the help so far!!! It has been of great help!
It seems ill have to make, as you say, a kernel hook on SnapWindow...
Ill start working on it, although im relativly new to global hooks.
Any extra help would be appreciated!!
|
|
|
|
|
xxxSnapWindow isn't an exported function, so it's going to be hard to find since it's offset would be specific to any version of win32k.sys
My suggestion would be WH_KEYBOARD_LL, but I don't know what you're trying to accomplish. BTW, I hope this is for NT?
|
|
|
|
|
Well, first, its only supposed to work on win2000+, so no legacy problem.
Ive checked win32k.sys with PEView application and i didnt found, as you said, xxxSnapWindow as an exported function.
Keyboard hook is no good, cause the printscreen message might not come from the keyboard, but might come by a call from a 3rd party capture application, which i want to avoid.
Basically, i require an almost fail-proof mechanism to avoid screen capture in a specific window of my application. I have it all figured out when it's copied to clipboard, but when the capturing application saves it to file, i havent been able to stop it from happening. Other options could include a hook to a file write to disk, but that could have disasterouses consequences!!!
|
|
|
|
|
Ok, so you also want to stop screen captures from anyone taking a picture of your application. This will be tough, because an application could do this:
GetDC(NULL); and get a screen shot of the desktop without going through the code I showed. (Or get your window handle and do a copy).
Then, they just do:
BitBlt();
to their HDC and write it to disk or whatever they want.
So, there's more than one way to take a screen shot without having to push "print screen" button or emulate they are taking a snapshot with the function I showed.
SnapShot is also a kernel function, you planed to write a driver to fix this?
|
|
|
|
|
Yeah, ive checked a few things and there are a lot of ways that this can fail.
Regarding BitBlt(), i guess i could make a hook just for that, as it is a windows GDI function.
Reguarding SnapShot, i've been reading an article here on codeproject on how to make a kernel-mode spying driver. Ill eventually have to make it, as it will be essential in the following months to my app. Combining a lot of these protection, i might then be able to completly protect the system from screenshots, and, who knows, even sell the overall protection system
|
|
|
|
|
Hello, there, I got a C2065 compiler error. The error message is
error C2065: 'RBN_CHEVRONPUSHED' : undeclared identifier
But when I go to that line and right click on RBN_CHEVRONPUNSHED and then click on "Go to definition of RBN_CHEVRONPUSHED" I can actually go to the CommCtrl.h and see the definition. This is very strange.
How could I solve the problem?
Thanks a lot in advance
Bin
|
|
|
|
|
Your compiler knows where the file is, but your code is not including the file, so it doesn't. Include the file, and try again.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
Thanks for your reply. I put the #include <commctrl.h> in the StdAfx.h file and also in that file with error. But I still got the same compiler error.
I am so confused.
Thanks again for your reply.
Bin
|
|
|
|
|
Not a solution, but a step. Is the error in your own code ? If so, try copying the #define into the top of your .cpp file and see if it compiles. If so, then it cannot see that file, for whatever reason. If not, the problem is somewhere else, and the error message is just not very helpful.
Christian
I have drunk the cool-aid and found it wan and bitter. - Chris Maunder
|
|
|
|
|
I haven't tried this so I'm not sure it'll work, but try to define the _WIN32_WINNT macro as 0x0400 or later in stdafx right at the begining, before any other lines.
|
|
|
|
|
If you change something in stdafx.h you must recompile (manually) the file stdafx.cpp to update the precompiled header.
Robert-Antonio
"Love without sex is like a fish without antlers"
|
|
|
|
|
Hi all;
I am working on an SDI application and everything went fine until i tried to used some library to skin my application. I used the SkinMagic library and still everything is fine. The only problem is that i get a very ugly error each time i close my application (either by selecting the little X or by clicking the "Exit" button within my app).
The error reported is as follows:
The instruction at XXX referenced memory at YYYY. The memory could not be read. The debugger told me that it was an unhandled exception and pointed to a call to an assembly fx (i guess) called mov. It reported the error to be there.
Can somebody please help me out of this stuff. I really need to skin my application since it has to be nice-looking.
Ps. Anyway, if you know some cool way of skinning an application, could you please help me too.
Thank you;
Krugger.
Krugger
|
|
|
|
|
Sounds like you are closing your window, but neglecting to close down something the skin library requires you to shut down before your window handle is gone.
Check the skin library cocde for any explanaiton of tasks you must perform before your program has closed its main window. In your window's message handle, you can handle the WM_CLOSE message, and do the processing to shut down the skin library there.
|
|
|
|
|