|
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
|
|
|
|
|
Sir,
IJW (It Just Works, a term used in .NET, as you already know).
Thanks a lot for your timely reply for our problem.
Regards,
Sundareswaran S @ mithun.nss
mithun.nss
|
|
|
|
|
Hi
Forgive me for what is probably a very simple question!
I have 2 dialog applications that I am working on. In one I have laid out several button controls into various positions (dialog is maximized).
I wish to read these positions into another dialog app and display buttons in the same position. I have tried to get the co-ordinates from the '.rc' file, but when I use these in my 2nd dialog, they do not appear in the correct position or size.
Is the problem that I need to use ClientToScreen() or ScreenToClient() to convert the co-ords that I have?
I have looked, but have been unable to find a tutorial that will help me with this - anyone know of one?
Thanks for any help!
69 Bay
|
|
|
|
|
In the resource the controls are specified in client co-ordinates. And the controls are placed in the client co-ordinates. So it should be placed same as the first one.
Can you show me the relevent codes?
- NS -
|
|
|
|
|
Hi - thanks for looking!
In the '.rc' file I have the following for each button control
CONTROL "",IDC_BTN_PA_001,"Button",BS_OWNERDRAW | NOT WS_VISIBLE,
12,305,40,18,WS_EX_RTLREADING
What I would like to do is use the '.rc' file from the 1st app to load up a 2nd app with the same resources, in the same locations. What I want to do is read in the co-ordinates and size (12,305,40,18 in the above example) into my 2nd app, and interpret the information to make the 2nd app display a button in the same location - either by SetWindowPos(), or MoveWindow(), or any other method that you may know of
I hope you can help!
Thanks
69 Bay
|
|
|
|
|
In the resource, the units are dialog units (DLUs).
From the docs:
"A DLU is based on the size of the dialog box font, normally 8-point MS Sans Serif.
A horizontal DLU is the average width of the dialog box font divided by four. A vertical
DLU is the average height of the font divided by eight."
For an example of how to convert DLUs to pixels, you may want to check out the
_AfxConvertDialogUnitsToPixels() function in the MFC source code or the
ConvertDialogUnitsToPixels() method in the ATL _DialogSizeHelper class.
Mark
Mark Salsbery
Microsoft MVP - Visual C++
|
|
|
|
|
I am sorry, I ignored the DLU used in rc files. Thanks to Mark Salsbery.
- NS -
|
|
|
|