|
|
Hi, thanks for your reply
I tested the program with a Microsoft-Example and i see the (propably) error :
PDCurses retrieves the number of columns and rows of the console window and gets 1x1
which is too small
PDCurses gets this informations with a getenv("LINES");
Propably LINES and COLS are environment variables, especially for consoles.
And with a redirected output it's not calculated.
I tested already to set the LINES and COLS by setting the STARTUP_INFORMATION
dwXSize and dwYSize to values over 200 pixels
No effect
|
|
|
|
|
baerten wrote: PDCurses
Sorry I dont have any idea about the PDCurses. if LINES and COLS are environmental varibles you guss, just confirm it with the some utility like process explorer.
|
|
|
|
|
I have created an MFC application with doc/view support, SDI having editview window.
I want to know what is the position (Co-ordinate) of the cursor every time the position of the cursor is changed.
How to achieve this?
Thanks and regards.
|
|
|
|
|
Hi,
handle the ON_MOUSEMOVE Message. Then you get the coordination of the mouse by
creating a COORD and assign it to the LPARAM ( if not the WPARAM )
CPoint point(LOWORD(lParam),HIWORD(lParam));
There are seriously syntax error in my example ( i'm not on a developer maschine )
but it works
|
|
|
|
|
Sorry, but I am not talking about Mouse Cursor Position.
I meant to retrieve the coordinates of the selected text
initial and final.
|
|
|
|
|
GetEditCtrl().GetSel()
Or maybe you will have to catch some notifications, like EN_CHANGE .
Though I speak with the tongues of men and of angels, and have not money, I am become as a sounding brass, or a tinkling cymbal. George Orwell, "Keep the Aspidistra Flying", Opening words
|
|
|
|
|
I am telling again, I want Co-Ordinates not the index of the cursor.
I mean to say that X and Y distance in PIXEL from the top left corner from the view window for the current scroll position.
Apology if I could not communicate properly earlier.
|
|
|
|
|
Use the EM_GETSEL , EM_LINEFROMCHAR , and EM_LINEINDEX messages.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Sorry, but none of the above returns the Co-Ordinates.
I want the coordinates not the index of the cursor.
Is there any function or property which returns the X and Y distance of the cursor from top-left corner of the view window?
|
|
|
|
|
Anurag Gandhi wrote: I want the coordinates not the index of the cursor.
And the distinction is? What I suggested to you would provide you with the row/column of the cursor.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
very sorry if you have been miscommunicated.
row/column number doesnot mean the distance in pixel.
Thanks anyway.
|
|
|
|
|
Anurag Gandhi wrote: ...distance in pixel.
It would help if you conveyed ALL the information in your OP rather than drag it out needlessly.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
Anurag Gandhi wrote: I want the coordinates not the index of the cursor.
if you have the index call the PosFromChar() function to get the coordinates.
|
|
|
|
|
If you want to get mouse cursor position then you have to add WM_MOUSEMOVE message handler to your view class.
then you will get a function like following..
void ClassView::OnMouseMove(UINT nFlags, CPoint point)
{
// Act with the point
}
///////////////////////////////////////////////////////////////
if you want to get key cursor position then you can use following........
POINT pt;
GetCursorPos(&pt);
//// See details in MSDN /////////////
|
|
|
|
|
Md. Ali Naser Khan wrote: If you want to get mouse cursor position...
See here.
"A good athlete is the result of a good and worthy opponent." - David Crow
"To have a respect for ourselves guides our morals; to have deference for others governs our manners." - Laurence Sterne
|
|
|
|
|
I believe you meant the caret, not the cursor.
Maybe try GetCaretPos()?
Mark
<ph:data>
Last modified: 46mins after originally posted --
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I'm new in MFC.
How to dynammically change control size in CFormView?
I do this:
void CSalesmanView::OnSize(UINT nType, int cx, int cy)
{
CFormView::OnSize(nType, cx, cy);
CTabCtrl * tab = (CTabCtrl *)this->GetDlgItem(IDC_TABMAIN);
if (tab != NULL)
{
tab->SetWindowPos(this,0,0,cx,cy,nType);
}
}
But nothing is happening;
Thanks.
-- modified at 9:08 Friday 7th September, 2007
|
|
|
|
|
SOLVED:
tab->MoveWindow(0,0,cx,cy);
|
|
|
|
|
Mine is a unicode application.I have some part of the code like,
WCHAR wsz [MAX_PATH]; // buffer for Unicode string
// Ensure that the string consists of ANSI characters.
MultiByteToWideChar (CP_ACP, 0, pszLinkFile, -1, wsz, MAX_PATH);//pszLinkFile is a variable of type LPCTSTR.
I got an error as following,
error C2664: 'MultiByteToWideChar' : cannot convert parameter 3 from 'const unsigned short *' to 'const char *'
Please help me out in this.
-- modified at 8:23 Friday 7th September, 2007
|
|
|
|
|
revanth1985 wrote: pszLinkFile is a variable of type LPCTSTR.
That is the problem: LPCTSTR type depends if UNICODE has been defined or not. If it has been defined, then it will be a unicode string otherwise a standard char array. So, in your case UNICODE is probably defined, which means you are trying to convert a string which is already a UNICODE to a UNICODE string.
|
|
|
|
|
|
Hello,
Am having a problem with PE file binary output.
We'd given our project to our client and the binary file generated by them is having a
[-> 3A48 [ 50] RVA [size] of Import Directory <-]
as offset address for import directory.
Where as the same project if we compile in our machine, it is
having a RVA a
[-> 3A58 [ 50] RVA [size] of Import Directory <-].
Both are differing by 16 bytes exactly.
Due to this the addresses referred are differing by 16 bytes in the file.
This is the only place where the address gets differred, due to this the
A sample dumbin out put of two files having only the headers alone are placed here.
Please help us in this regard to solve this problem.
===========================MAIN FILE=======================================
Microsoft (R) COFF/PE Dumper Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file MAIN.exe
PE signature found
File Type: EXECUTABLE IMAGE
FILE HEADER VALUES
14C machine (x86)
4 number of sections
46E1277D time date stamp Fri Sep 07 15:57:09 2007
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
10F characteristics
Relocations stripped
Executable
Line numbers stripped
Symbols stripped
32 bit word machine
OPTIONAL HEADER VALUES
10B magic # (PE32)
7.10 linker version
1C00 size of code
2E00 size of initialized data
0 size of uninitialized data
22BD entry point (004022BD)
1000 base of code
3000 base of data
400000 image base (00400000 to 00407FFF)
1000 section alignment
200 file alignment
4.00 operating system version
0.00 image version
4.00 subsystem version
0 Win32 version
8000 size of image
400 size of headers
0 checksum
2 subsystem (Windows GUI)
0 DLL characteristics
100000 size of stack reserve
1000 size of stack commit
100000 size of heap reserve
1000 size of heap commit
0 loader flags
10 number of directories
0 [ 0] RVA [size] of Export Directory
3A48 [ 50] RVA [size] of Import Directory
6000 [ 1888] RVA [size] of Resource Directory
0 [ 0] RVA [size] of Exception Directory
0 [ 0] RVA [size] of Certificates Directory
0 [ 0] RVA [size] of Base Relocation Directory
3230 [ 1C] RVA [size] of Debug Directory
0 [ 0] RVA [size] of Architecture Directory
0 [ 0] RVA [size] of Global Pointer Directory
0 [ 0] RVA [size] of Thread Storage Directory
3750 [ 48] RVA [size] of Load Configuration Directory
0 [ 0] RVA [size] of Bound Import Directory
3000 [ 228] RVA [size] of Import Address Table Directory
0 [ 0] RVA [size] of Delay Import Directory
0 [ 0] RVA [size] of COM Descriptor Directory
0 [ 0] RVA [size] of Reserved Directory
----------------------------------------------------------------------------
===========================Other Compiled FILE=============================
Microsoft (R) COFF/PE Dumper Version 7.10.3077
Copyright (C) Microsoft Corporation. All rights reserved.
Dump of file MAIN.exe
PE signature found
File Type: EXECUTABLE IMAGE
FILE HEADER VALUES
14C machine (x86)
4 number of sections
46E127EB time date stamp Fri Sep 07 15:58:59 2007
0 file pointer to symbol table
0 number of symbols
E0 size of optional header
10F characteristics
Relocations stripped
Executable
Line numbers stripped
Symbols stripped
32 bit word machine
OPTIONAL HEADER VALUES
10B magic # (PE32)
7.10 linker version
1C00 size of code
2E00 size of initialized data
0 size of uninitialized data
22BD entry point (004022BD)
1000 base of code
3000 base of data
400000 image base (00400000 to 00407FFF)
1000 section alignment
200 file alignment
4.00 operating system version
0.00 image version
4.00 subsystem version
0 Win32 version
8000 size of image
400 size of headers
0 checksum
2 subsystem (Windows GUI)
0 DLL characteristics
100000 size of stack reserve
1000 size of stack commit
100000 size of heap reserve
1000 size of heap commit
0 loader flags
10 number of directories
0 [ 0] RVA [size] of Export Directory
3A58 [ 50] RVA [size] of Import Directory
6000 [ 1888] RVA [size] of Resource Directory
0 [ 0] RVA [size] of Exception Directory
0 [ 0] RVA [size] of Certificates Directory
0 [ 0] RVA [size] of Base Relocation Directory
3230 [ 1C] RVA [size] of Debug Directory
0 [ 0] RVA [size] of Architecture Directory
0 [ 0] RVA [size] of Global Pointer Directory
0 [ 0] RVA [size] of Thread Storage Directory
3750 [ 48] RVA [size] of Load Configuration Directory
0 [ 0] RVA [size] of Bound Import Directory
3000 [ 228] RVA [size] of Import Address Table Directory
0 [ 0] RVA [size] of Delay Import Directory
0 [ 0] RVA [size] of COM Descriptor Directory
0 [ 0] RVA [size] of Reserved Directory
----------------------------------------------------------------------------
mithun.nss
|
|
|
|
|
I guess they've either got a dfferent minor compiler version or one or more Dlls on their system have more entry points than on yours. You need to compare the full verison numbers of all the statically linked Dlls, the Depends.exe MS tool is good for that also ensure that both compilers are identical.
You could try compiling without the /GS switch or its relatives so you get less compiler injected security stuff if you're not already doing this.
Make sure incremental linking is switch off and you're building everything from scratch.
I don't really see why it's a problem but I like a mystery as much as the next guy. Let me know if you get to the bottom of it.
Nothing is exactly what it seems but everything with seems can be unpicked.
|
|
|
|
|
Sir,
Thanks for your reply.
We'll try as per your valuable suggestion and let you know the result in this regard.
Thanks and Regards,
Sundareswaran S @ mithun.nss
mithun.nss
|
|
|
|